ArticleslgStudy

science

Hardware abstraction

Hardware abstraction is a 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 Hardware abstraction rather than just read about it. In short: A hardware abstraction is software that provides access to hardware in a way that hides details that might otherwise make using the hardware difficult. Typically, access is provided via a software interface that allows devices that share a level of similarity to be accessed via the same software actions even though the devices provide different hardware interfaces.

Hardware abstraction — main illustration
Hardware abstraction — illustration

Key takeaways

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

Reference excerpt

A hardware abstraction is software that provides access to hardware in a way that hides details that might otherwise make using the hardware difficult. Typically, access is provided via a software interface that allows devices that share a level of similarity to be accessed via the same software actions even though the devices provide different hardware interfaces. A hardware abstraction can support the development of cross-platform applications. Early software was developed without a hardware abstraction, which required a developer to understand multiple devices in order to provide compatibility. With hardware abstraction, the software leverages the abstraction to access significantly different hardware via the same interface. The abstraction (often implemented in the operating system) then performs the hardware-specific operations. This allows software to be compatible with all devices supported by the abstraction. Consider a joystick device, of which there are many physical implementations. It could be accessible via an application programming interface (API) that supports common operations such as moving, firing, configuring sensitivity, and so on across variety of different joysticks. A Joystick abstraction hides details (e.g., register format, I2C address) so programmers using the abstraction do not need to understand details regarding the device's physical interface. This also allows code reuse since the same code can process standardized messages from any kind of implementation which supplies the joystick abstraction. For example, a "nudge forward" can be from a potentiometer or from a capacitive touch sensor that recognizes "swipe" gestures, as long as they both provide a signal related to "movement". As physical limitations may vary with hardware, an API can do little to hide that, other than by assuming a "least common denominator" model. Thus, certain deep architectural decisions from the implementation may become relevant to users of a particular instantiation of an abstraction. A good metaphor is the abstraction of transportation. Both bicycling and driving a car are transportation. They both have commonalities (e.g., it must be steered) and physical differences (e.g., power source). One can always specify the abstraction "drive to" and let the implementer decide whether bicycling or driving a car is best. The "wheeled terrestrial transport" function is abstracted and the details of "how to drive" are encapsulated.

Programming A high-level programming language provides for hardware abstraction by allowing a programmer write an algorithm without using instructions that are unique to a central processing unit (CPU) or its instruction set architecture (ISA) – the primitive operations of a CPU. For example, a compiler generates the CPU-specific instructions for a particular ISA. In this way, source code can support portability across multiple platforms.

Hardware abstraction layer A hardware abstraction layer (HAL) is an abstraction layer, implemented in software, between the physical hardware of a computer and the software that runs on that computer. Its function is to hide differences in hardware from most of the operating system kernel, so that most of the kernel-mode code does not need to be changed to run on systems with different hardware. On Microsoft Windows, HAL can basically be considered to be the driver for the motherboard and allows instructions from higher level computer languages to communicate with lower level components, but prevents direct access to the hardware. CP/M (CP/M BIOS), DOS (DOS BIOS), Solaris, Linux, BSD, macOS, and some other portable operating systems also have a HAL, even if it is not explicitly designated as such. Some operating systems, such as Linux, have the ability to insert one while running, like Adeos. The NetBSD operating system is widely known as having a clean hardware abstraction layer which allows it to be highly portable. As part of this system are uvm(9)/pmap(9), bus_space(9), bus_dma(9), and other subsystems. Popular buses which are used on more than one architecture are also abstracted, such as ISA, EISA, PCI, PCIe, etc., allowing drivers to also be highly portable with a minimum of code modification. Operating systems having a defined HAL are more easily portable across different hardware. This is especially important for embedded systems that run on dozens of different platforms. In a software stack, the HAL resides below the application programming interface (API), whereas the application layer (often written in a high-level language) resides above the API and communicates with the hardware by calling functions in the API.

Microsoft Windows

The Windows NT kernel has a HAL in the kernel space between hardware and the executive services that are contained in the file ntoskrnl.exe under hal.dll. This allows portability of the Windows NT kernel-mode code to a variety of processors, with different memory management unit architectures, and a variety of systems with different I/O bus architectures; most of that code runs without change on those systems, when compiled for the instruction set applicable to those systems. For example, the SGI Intel x86-based workstations were not IBM PC compatible workstations, but due to the HAL, Windows 2000 ran on them. Since Windows Vista and Windows Server 2008, the HAL used is automatically determined during startup; in fact since Windows Vista, Windows NT only allows ACPI based HAL. The Windows CE also has a HAL called OEM Adaptation Layer (OAL), and it's compiled to oal.exe or oal.dll, and it's included in the nk.bin boot image. In Windows 9x, both the actual kernel and the actual HAL is vmm32.vxd.

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Hardware abstraction

Start with the simplest possible case. Write down what Hardware abstraction claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In 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 Hardware abstraction 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 Hardware abstraction 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 Hardware abstraction

In research
Hardware abstraction appears in 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 Hardware abstraction 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
Hardware abstraction is common in secondary-school and first-year university syllabi. It links to neighbouring topics Booting, Device drivers, Firmware, so understanding it makes those chapters shorter.
In everyday life
Look for Hardware abstraction 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.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Hardware abstraction” →

How to study Hardware abstraction in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Hardware abstraction 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 Hardware abstraction out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Hardware abstraction in simple terms?

A hardware abstraction is software that provides access to hardware in a way that hides details that might otherwise make using the hardware difficult. Typically, access is provided via a software interface that allows devices that share a level of similarity to be accessed via the same software ac…

Why does Hardware abstraction matter?

Because it connects several 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 Hardware abstraction?

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 Hardware abstraction.

Tags

  • Booting
  • Device drivers
  • Firmware
  • Operating system technology

Keep exploring