OCR H446, section 1.2.1 (g)
What is a device driver?
A device driver is a small program that lets the operating system communicate with a particular piece of hardware, such as a printer, a graphics card, a keyboard or a network adapter.
It acts as a translator: it turns the general commands from the operating system (such as "print this page" or "draw this image") into the specific instructions and signals that this model of device understands.
Why drivers are needed
- There are thousands of different devices, from many manufacturers, and each works in its own way.
- The operating system can't contain the code for every device that will ever exist.
- Each manufacturer can write a driver for its own device, and the OS can then use any device in a standard way.
- Applications and the OS don't need to know how the hardware works. This hides the complexity of the hardware, which is one of the OS's main purposes (1.2.1 (a)).
So when you buy a new printer, you add its driver, and every program can use the printer with no changes.
How drivers work
- A driver is installed on the computer (often automatically when the device is plugged in, called plug and play) and is loaded when the device is needed.
- It runs with high privileges, close to the kernel, because it needs direct access to the hardware.
- It handles sending commands, receiving data from the device, and responding to the device's interrupts.
- Different devices may need different versions of a driver for different operating systems.
Updating drivers
Manufacturers release new versions of drivers, to:
- fix bugs and security weaknesses;
- improve performance, especially for graphics cards in games;
- add new features or support for new software;
- keep working with new versions of the operating system.
Problems with drivers
- A faulty, missing or out-of-date driver may cause the device to malfunction, or the whole computer to crash. Many "blue screen" crashes are caused by drivers.
- A device may not work at all until the correct driver is installed, or if there is no driver for that operating system.
- Drivers run with high privileges, so a malicious or poorly written driver is a security risk.
- A driver update can introduce new problems.
Worked example
Task: a user plugs a new colour printer into their computer. Describe the role of the driver.
- The OS detects the new device, and loads or asks for its driver.
- When the user prints a document, the application sends the data to the OS in a general form.
- The printer driver converts it into the commands that this model uses: its colour settings, resolution and page format.
- The driver sends the commands to the printer, and reports back to the OS (for example "out of paper" or "job finished").
- If the user later buys a different printer, only the driver changes. The application and the OS need no alterations.
Exam tip: describe a driver as translating the OS's general commands into device-specific ones. Explain why they're needed (so the OS can work with many different devices without having to know about each), and mention a problem such as crashes from faulty drivers.
Check yourself
What is a device driver?
A small program that allows the operating system to communicate with a particular piece of hardware, by converting general commands into the specific instructions for that device.
Why does an operating system need device drivers?
There are very many different devices that work in different ways, and the OS can't contain code for all of them. Drivers let it use any device in a standard way.
Give two reasons for updating a driver
Any two of: to fix bugs; to fix security weaknesses; to improve performance; to add features; to stay compatible with a new version of the operating system.
What can happen if a driver is faulty?
The device may not work properly, or the whole computer may crash.