ArticleslgStudy

computer science

Hw.sensors

Hw.sensors is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Hw.sensors rather than just read about it. In short: The hw.sensors framework is a kernel-level hardware sensors framework originating from OpenBSD, which uses the sysctl kernel interface as the transport layer between the kernel and the userland. As of 2019, the framework is used by over a hundred device drivers in OpenBSD to export various environmental sensors, with temperature sensors being the most common type.

Key takeaways

  • Hw.sensors belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Hw.sensors to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Hw.sensors from memory before moving on to harder problems.

Reference excerpt

The hw.sensors framework is a kernel-level hardware sensors framework originating from OpenBSD, which uses the sysctl kernel interface as the transport layer between the kernel and the userland. As of 2019, the framework is used by over a hundred device drivers in OpenBSD to export various environmental sensors, with temperature sensors being the most common type. Consumption and monitoring of sensors is done in the userland with the help of sysctl, systat, sensorsd, OpenBSD NTP Daemon (OpenNTPD, ntpd), Simple Network Management Protocol (snmpd), ports/sysutils/symon and GKrellM.

Drivers In OpenBSD, the framework is integrated with Dell's ESM, Intelligent Platform Management Interface (IPMI) and I2C, in addition to several popular Super I/O chips through lm(4). A major difference compared to other solutions like lm_sensors is simplicity and a works-by-default approach in the drivers, which don't need or support any configurability; no installation or configuration actions are required by the system administrator to get the sensors going. This is coupled with a fine-tuned ad-hoc read-only scan procedure on the I2C bus, written by Theo de Raadt in a centralised way with a cache, making it possible to leave it enabled by default at all times, unlike the competing solutions.

RAID drive sensors

Support for automatic monitoring of RAID drives is also provided through the sensors framework, this concept of sensors of drive type has been backported by NetBSD back into envsys in 2007.

OpenNTPD timedelta sensors

OpenNTPD uses sensors of type timedelta to synchronise time. These are provided by NMEA and other drivers.

History The framework was originally devised in 2003 by Alexander Yurchenko, when he was porting several envsys-based drivers from NetBSD. Instead of porting NetBSD's envsys, a simpler sysctl-based mechanism was developed. Framework use by the device drivers rose sharply with the release of OpenBSD 3.9. Then, in only 6 months, the number of individual drivers using the framework rose from 9 in OpenBSD 3.8 (released 1 November 2005) to 33 in OpenBSD 3.9 (released 1 May 2006). As of 23 December 2006, the framework was used by 44 device drivers. At this time, a patchset was committed converting a simple one-level addressing scheme into a more stable multi-layer addressing. In 2007, the framework was ported to FreeBSD as part of a Google Summer of Code grant. It was adopted by DragonFly BSD later that year. The usability of the sensorsd(8), the sensor monitoring daemon, was vastly improved in 2007, partly via the same GSoC grant. As of 1 November 2008, the total number of drivers stood at 68 in OpenBSD 4.4; growing by 7 drivers in a 6-month release cycle. This rate of growth, of one new driver per month on average, has been common throughout the history of the framework since OpenBSD 3.9. The values exported by the drivers through the framework are read-only; however, an external patch exists that implements the fan control functions in both the framework, and in one of the drivers for the most popular family of Super I/O chips. This patchset was provided for both OpenBSD and DragonFly BSD.

See also

lm_sensors SpeedFan

References

External links cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/sys/sensors.h asiabsdcon2009-sensors-paper.pdf asiabsdcon2009-sensors-slides.pdf

Worked examples

Example 1 — a first encounter with Hw.sensors

Start with the simplest possible case. Write down what Hw.sensors claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Hw.sensors before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Hw.sensors ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Hw.sensors

In research
Hw.sensors appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Hw.sensors in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Hw.sensors is common in secondary-school and first-year university syllabi. It links to neighbouring topics BSD software, DragonFly BSD, FreeBSD, so understanding it makes those chapters shorter.
In everyday life
Look for Hw.sensors outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Hw.sensors in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Hw.sensors means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Hw.sensors out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Hw.sensors in simple terms?

The hw.sensors framework is a kernel-level hardware sensors framework originating from OpenBSD, which uses the sysctl kernel interface as the transport layer between the kernel and the userland. As of 2019, the framework is used by over a hundred device drivers in OpenBSD to export various environm…

Why does Hw.sensors matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Hw.sensors?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Hw.sensors.

Tags

  • BSD software
  • DragonFly BSD
  • FreeBSD
  • OpenBSD
  • Software using the ISC license
  • System administration

Keep exploring