Device drivers are programs that allow the operating system to communicate with hardware.
Explain one reason why a device driver is often written in a low-level language.
Mark scheme
Award up to two marks for a linked explanation such as:
- The programmer can control/manipulate the hardware directly (1) because low-level instructions can access registers/memory addresses/hardware features (1)
- The code can be made to work efficiently with a specific device (1) because low-level languages are processor/chipset specific, so the instructions match that hardware (1)
- The code produced is fast to execute (1) because it is optimised for the specific processor/uses few instructions (1)
- The code produced is small (1) so it fits in the limited memory/ROM available in the device (1)
For both marks, the expansion must follow/associate with the statement.
Fast execution and small code size are typical advantages of low-level languages; award them only where the linked reason relates to the device.
Do not accept 'it is easier to write/learn/understand' or 'it is faster to write' as a point or as the expansion, because low-level languages are not easier for these.
Do not accept 'it is close to the hardware' or 'it works with hardware' without expansion of what that allows the program to do.
Do not accept 'because it is low-level' as the expansion; the answer must say what the language/hardware allows.
Example answers and how they were marked
It can control the hardware directly because the instructions can read and write to the device's registers and memory addresses.
Why: Linked point (1) of direct hardware control and reason (1) that low-level instructions access registers and memory addresses.
It runs quickly because it is a low-level language.
Why: Point (1) of fast execution, but 'because it is a low-level language' is not accepted as the linked reason.
Because it is easier to write programs for a particular device.
Why: Misconception that low-level languages are easier to write; no creditworthy point or linked reason about hardware control or efficiency.