🔒 Pro · Component 1 · 1.2 Software and Software Development
1.2.1d Device Drivers and Virtual Machines
OCR H446 · A Level Computer Science · ~11 min read
Notes
—
Video
—
Slides
—
Worksheet
—
Quiz
Device Drivers
A device driver is a piece of software that acts as an intermediary between the operating system and a specific hardware device. It translates the generic I/O requests issued by the OS into the device-specific instructions the hardware understands.
Why drivers are needed:
Hardware devices vary enormously — keyboards, printers, GPUs, network cards all have different internal protocols.
Without drivers, the OS would need to include code for every possible hardware device — impractical.
Drivers allow hardware manufacturers to provide software support independently of the OS developer.
Drivers enable the same OS to work with many different hardware configurations.
How drivers work:
The OS provides a standardised interface (API) for device types (e.g. "print" for all printers).
The driver implements this interface and translates OS requests into the specific commands the device understands.
The driver also handles communication in the other direction: receiving data/status from the device and passing it to the OS in a standardised form.
Drivers typically run in kernel mode (privileged mode) as they need direct hardware access.
Advantages of device drivers:
Applications can communicate with hardware without knowing hardware-specific details.
New hardware can be supported by installing a new driver without modifying the OS itself.
Faulty drivers can be updated or replaced independently.
Virtual Machines (VMs)
A virtual machine (VM) is a software emulation of a complete computer system. It runs inside a host operating system and behaves as if it were a separate physical computer with its own CPU, memory, storage, and network interfaces.
Key terminology:
Host machine: the physical hardware and OS running the virtualisation software.
Guest OS: the operating system running inside the virtual machine.
Hypervisor (Virtual Machine Monitor, VMM): the software that creates and manages VMs, allocating physical resources and isolating VMs from one another.
Types of hypervisor:
Type
Description
Examples
Use case
Type 1 (Bare-metal)
Runs directly on the hardware — no host OS. The hypervisor IS the OS.
VMware ESXi, Microsoft Hyper-V Server, Xen
Enterprise servers, cloud computing (AWS, Azure)
Type 2 (Hosted)
Runs on top of a host OS as an application.
VMware Workstation, VirtualBox, Parallels
Development, testing, running different OS on desktop
Advantages of virtual machines:
Testing and development: developers can test software on different OS versions without needing multiple physical machines.
Isolation/sandboxing: malware can be safely executed inside a VM without affecting the host; VMs are isolated from each other.
Server consolidation: multiple VMs run on one physical server, reducing hardware costs, power usage, and cooling requirements.
Snapshots: the VM's state can be saved and restored, enabling easy rollback to a known good state.
Portability: a VM can be moved between physical machines as a file (e.g. migration in cloud computing).
Legacy software support: old applications that require outdated OS versions can run in a VM on modern hardware.
Disadvantages of virtual machines:
Performance overhead: virtualised hardware is slower than native hardware; the hypervisor adds a layer of abstraction.
Resource intensive: each VM needs its own allocated RAM, storage, and CPU cores, limiting how many can run simultaneously.
Complexity: managing many VMs, particularly in cloud environments, adds administrative complexity.
VMs vs Containers:
Modern systems also use containers (e.g. Docker) which share the host OS kernel rather than running a separate guest OS. Containers are lighter-weight but offer less isolation than full VMs.
Feature
Virtual Machine
Container
Isolation
Full OS-level isolation
Process-level isolation
OS
Full guest OS per VM
Shares host OS kernel
Startup time
Minutes
Seconds
Resource usage
High (separate OS per VM)
Low (shared kernel)
Security
Higher (separate kernel)
Lower (shared kernel)
Exam tip: Know the two hypervisor types: Type 1 (bare-metal, runs directly on hardware, better performance) vs Type 2 (hosted, runs on host OS, easier to use). Be able to give the advantages of VMs: testing, isolation, server consolidation, snapshots, portability.
Exam tip: For driver questions: a driver translates OS generic requests into device-specific commands. Drivers allow different hardware to work with the same OS without modifying the OS itself.
⚠ Common Mistakes
Saying a VM IS an OS — a VM is a software emulation of a complete computer; it runs a guest OS but is not the OS itself.
Confusing Type 1 and Type 2 hypervisors — Type 1 runs directly on hardware (server/enterprise use); Type 2 runs on top of an existing OS (desktop/development use).
Saying device drivers are part of application software — they are part of system software and typically run in kernel mode.
✓ Notes completed!
▶
Video coming soon
Click to advance · Arrow keys also work
Click slide or press arrow keys to navigate
✍
Worksheet — 1.2.1d Device Drivers and Virtual Machines
8 questions · 20 marks · instantly marked
Q1Explain what a device driver is and why it is necessary for hardware to function with an operating system.[3 marks]
✓ Mark scheme
A device driver is software that acts as an intermediary between the OS and a specific hardware device [1]; it translates the generic I/O requests made by the OS into the device-specific commands the hardware understands [1]; it is necessary because hardware devices vary greatly in their internal protocols and the OS cannot contain specific code for every possible device; drivers allow new hardware to be supported without modifying the OS itself [1].
Q2Explain why device drivers typically run in kernel mode rather than user mode.[2 marks]
✓ Mark scheme
Device drivers need direct access to hardware registers, memory-mapped I/O, and interrupt handling mechanisms [1]; these operations require privileged access which is only available in kernel mode; user mode processes are restricted from direct hardware access to maintain system stability and security [1].
Q3Explain what a virtual machine is and distinguish between the 'host' and 'guest' in a VM environment.[3 marks]
✓ Mark scheme
A virtual machine is a software emulation of a complete computer system that runs inside another system, providing an isolated environment with its own virtual CPU, memory, storage, and OS [1]; the host machine is the physical hardware and underlying OS that provides the real resources and runs the hypervisor [1]; the guest OS is the operating system running inside the VM, unaware it is sharing hardware with other VMs or a host OS [1].
Q4Compare Type 1 and Type 2 hypervisors. Give one example of each and state one scenario where each is preferred.[4 marks]
✓ Mark scheme
Type 1 (bare-metal): runs directly on the physical hardware without a host OS; example: VMware ESXi / Microsoft Hyper-V Server / Xen [1]; preferred for enterprise server consolidation and cloud computing where performance is critical [1]; Type 2 (hosted): runs on top of a conventional host OS as an application; example: VirtualBox / VMware Workstation / Parallels [1]; preferred for development, testing, and educational use on desktop machines where ease of use is more important than raw performance [1].
Q5A company runs its website on a cloud hosting service that uses virtual machines. Give three advantages of using VMs in this scenario.[3 marks]
✓ Mark scheme
Any three from: server consolidation — multiple VMs share one physical server, reducing hardware costs [1]; isolation — each VM is isolated so one customer's VM crashing does not affect others [1]; scalability/portability — VMs can be quickly provisioned, scaled, or migrated between physical servers [1]; snapshots — the state of a VM can be saved and quickly restored in case of failure [1]; resource flexibility — CPU/RAM resources can be dynamically allocated to VMs based on demand [1].
Q6Explain why a cybersecurity researcher might run malware samples inside a virtual machine rather than on a physical computer.[2 marks]
✓ Mark scheme
A VM provides an isolated sandbox environment; malware executing inside the VM cannot affect the host machine or other VMs [1]; the researcher can safely observe the malware's behaviour, and if the VM is compromised, it can be quickly restored to a clean state using a snapshot [1].
Q7State two disadvantages of virtual machines compared to running software directly on the host hardware.[2 marks]
✓ Mark scheme
Any two: performance overhead — the hypervisor adds a layer of abstraction, making virtualised hardware slower than native hardware [1]; resource intensive — each VM requires its own allocated RAM, storage, and CPU, limiting how many can run simultaneously on one physical machine [1]; management complexity — managing large numbers of VMs adds administrative overhead [1].
Q8Briefly explain one difference between a virtual machine and a container (e.g. Docker) in terms of how they use operating system resources.[2 marks]
✓ Mark scheme
A virtual machine includes a complete guest OS for each VM, resulting in higher resource usage but stronger isolation [1]; a container shares the host OS kernel between all containers, making them more lightweight and faster to start, but with less isolation since all containers share the same kernel [1].
Topic Quiz
1 of 15
You scored
out of 15
🎯
Mini Test — 1.2.1d Drivers & VMs
10 questions · 10 marks · 10 minutes
5 MCQ + 5 short answer
⏱10:00
10 marks
Section A — Multiple Choice
Q1A device driver acts as an intermediary between:
Q2A Type 1 hypervisor runs:
Q3Which of the following is an advantage of virtual machines for software testing?
Q4Containers differ from VMs in that containers:
Q5Which of the following best explains why device drivers run in kernel mode?
Section B — Short Answer
Q6What is the role of a hypervisor?
Mark schemeSoftware that creates and manages virtual machines, allocating physical resources and isolating VMs from each other. [1 mark]
Q7State one use of VM snapshots.
Mark schemeA snapshot saves the complete state of a VM at a point in time, allowing quick rollback to that state if the VM becomes corrupted or compromised. [1 mark]
Q8Give one disadvantage of virtual machines related to performance.
Mark schemePerformance overhead — the hypervisor layer adds an abstraction between the VM and physical hardware, making virtualised systems run slower than equivalent native (bare-metal) systems. [1 mark]
Q9Why do device drivers allow new hardware to be supported without modifying the OS?
Mark schemeThe driver implements the OS's standard device interface for the specific hardware; the OS communicates via this standard interface without needing to know the hardware's internal details. New hardware is supported by installing a new driver. [1 mark]
Q10Give one reason a server company uses virtualisation to consolidate multiple workloads onto fewer physical servers.
Mark schemeReduced hardware, power, and cooling costs — running multiple VMs on one physical server means fewer physical machines are needed, saving capital and operational expenditure. [1 mark]