A device driver is a special kind of software program that controls a specific hardware device attached to a computer. Device drivers are essential for a computer to work properly. These programs may be compact, but they provide the all-important means for a computer to interact with hardware, for everything from mouse, keyboard and display (user input/output) to working with networks, storage and graphics.Content Continues Below
How Do Device Drivers Work?
Device drivers generally run at a high level of privilege within the operating system runtime environment. Some device drivers, in fact, may be linked directly to the operating system kernel, a portion of an OS such as Windows, Linux or Mac OS, that remains memory resident and handles execution for all other code, including device drivers. Device drivers relay requests for device access and actions from the operating system and its active applications to their respective hardware devices. They also deliver outputs or status/messages from the hardware devices to the operating system (and thence, to applications).
Purpose of Device Drivers
Device drivers are necessary to permit a computer to interface and interact with specific devices. They define the messages and mechanisms whereby the computer (OS and applications) can access the device or make requests for the device to fulfill. They also handle device responses and messages for delivery to the computer.
Types of Device Drivers
Invariably, hardware devices belong to a specific class, such as Bluetooth or 802.11xx wireless networking. Creating any specific device driver starts by working within its class framework. Within that class, a particular type of device, such as Bluetooth audio, keyboards or mice, also falls within a related driver framework. Finally, for a specific individual device, within its class and type frameworks, its actual driver software interacts with that device using its native command set and data handling capabilities, as defined and published by its maker or manufacturer. In addition, device drivers can access physical devices (actual hardware) or virtual devices (emulations of hardware in a software program). The former are called physical drivers and the latter are called virtual drivers.
Device Driver Examples
If you run the driverquery command in Windows inside PowerShell or at the command line, it will produce a list of all device drivers installed on the host computer. For Linux and macOS, running the lsmod command at a command prompt also lists device driver modules. It is not unusual for a typical laptop or desktop PC to list hundreds of device drivers in response. Examining this output provides useful drive information, including module name, driver type and display name used to identify a driver. Here's a brief sample from Windows 10:
Module Name Display Name Driver Type Link Date ============ ====================== ============= ====================== 1394ohci 1394 OHCI Compliant Ho Kernel 3ware 3ware Kernel 5/18/2015 5:28:03 PM ACPI Microsoft ACPI Driver Kernel AcpiDev ACPI Devices driver Kernel
Device Driver Software
In the early days of programming, device drivers would often be written using assembly language, a low-level language that can access hardware and CPU instructions immediately and directly. Today, most programmers who write device drivers work either in the C or C++ programming language, because it offers excellent access to low-level instructions along with more complex program and data structures. Testing device drivers must incorporate security as well as operational issues. Because such software runs at high levels of privilege, it could lead to system compromise or vulnerabilities on the security side, or outright failure (crashing or freezing) and performance problems on the operational side.