How unit 5 is examined
This unit covers how the OS drives devices (polling, interrupts, DMA, buffering, drivers) and introduces network, distributed and multiprocessor systems; the distributed-systems topic carries almost all the marks.
Principles and Programming
<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Not asked since 2022</span>
Definition. I/O principles describe how the OS hides device hardware behind a uniform interface, using a device controller for each device and a driver for each controller.
Key points.
- A device controller is the electronic part that operates the device and has status, command and data registers.
- The CPU programs I/O by writing commands into controller registers, either through I/O ports or memory-mapped I/O.
- Devices are block devices (disk, fixed-size blocks) or character devices (keyboard, stream of bytes).
- <mark>The OS should give device independence and uniform naming, so programs never depend on the hardware.</mark>
Input/Output Problems
<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Not asked since 2022</span>
Definition. I/O problems are the difficulties caused by devices being far slower and more varied than the CPU.
Key points.
- Speed mismatch: a CPU executes millions of instructions while a disk or printer completes one operation, so the CPU would sit idle.
- Devices differ in data rate, unit of transfer, data format, and error conditions, which makes one uniform interface hard.
- Devices are shared, so requests must be scheduled to avoid conflict and deadlock.
- <mark>Buffering, interrupts, DMA and spooling are the standard solutions to the speed mismatch.</mark>
Different I/O operations: Program Controlled
<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Not asked since 2022</span>
Definition. In program-controlled (programmed) I/O the CPU itself starts the transfer and repeatedly tests the device status until it is ready; this is called polling or busy waiting.
Key points.
- The CPU issues the command, then loops reading the status register until the ready bit is set.
- It is simple and needs no extra hardware.
- It wastes CPU time because the CPU does no useful work while waiting.
- <mark>Polling is acceptable only when the device is fast or the wait is short.</mark>
Interrupt Driven
<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Low weight</span>
Definition. In interrupt-driven I/O the CPU starts the transfer and continues other work; the device raises an interrupt when it is done and an interrupt handler moves the data.
| Point | Interrupt driven | Polling |
|---|---|---|
| CPU use | Free between events | Busy waiting |
| Overhead | Context switch per event | Loop per check |
| Latency | Fast response | Depends on poll interval |
| Best for | Rare events | Very frequent events |
Key points.
- A single serial port sends few characters, so an interrupt per character is cheap and the CPU stays free between them.
- A front-end processor (terminal concentrator) has data almost always ready, so interrupts would fire constantly; <mark>polling costs less than thousands of context switches</mark>.
Asked: [7 marks] (Jun 2025) Why might a system use interrupt driven I/O to manage a single serial port but polling I/O to manage a front end processor, such as a terminal concentrator.
Concurrent I/O
<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Not asked since 2022</span>
Definition. Concurrent I/O lets I/O overlap with computation; Direct Memory Access (DMA) is the hardware that does it by moving a block between device and memory without the CPU.
Key points.
- The CPU gives the DMA controller the device, memory address, and byte count, then carries on.
- The DMA controller transfers the whole block and raises one interrupt at the end.
- It steals memory cycles from the CPU (cycle stealing) but far fewer than programmed I/O.
- <mark>DMA gives one interrupt per block instead of one per byte.</mark>
Asynchronous Operations
<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Not asked since 2022</span>
Definition. Asynchronous (non-blocking) I/O returns control to the caller at once and the process is told later when the transfer completes.
Key points.
- In synchronous (blocking) I/O the process waits until the operation finishes.
- In asynchronous I/O the process continues and is notified by a signal, callback, or flag.
- It improves overlap of computation and I/O but the program is harder to write.
- <mark>Blocking waits for the result; asynchronous continues and gets notified.</mark>
Logical structure of I/O function
<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Not asked since 2022</span>
Definition. I/O software is organised in layers, each hiding the details of the layer below.
Key points.
- From top to bottom: user-level I/O software, device-independent OS software, device drivers, interrupt handlers, hardware.
- Interrupt handlers save state, service the device and wake the blocked driver.
- Device drivers hold the device-specific code that talks to the controller registers.
- Device-independent software does naming, protection, buffering, error reporting and allocation.
- <mark>Layering gives device independence: changing a device only changes its driver.</mark>
I/O Buffering
<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Low weight</span>
Definition. Buffering keeps data in a memory area while it moves between a device and a process, to smooth the speed mismatch. Spooling queues output (or input) for a dedicated device, such as a printer, on disk.
Key points.
- Single buffer: the device fills one buffer while the process uses the previous data.
- Double buffer: the device fills one buffer while the process empties the other, giving more overlap.
- Circular buffer: many buffers in a ring for bursty transfers.
- Spooling lets many jobs "print" concurrently into disk files; a spooler daemon sends them to the printer one by one, so the device appears shared.
- <mark>Buffering holds data for one transfer; spooling queues whole jobs for a non-shareable device.</mark>
Asked: [7 marks] (Nov 2023) Explain the concept of buffering and spooling.
Kernel I/o Subsystem
<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Not asked since 2022</span>
Definition. The kernel I/O subsystem provides the services built on drivers and hardware.
Key points.
- I/O scheduling orders requests to improve average waiting time and fairness.
- Buffering and caching keep data in memory; a cache holds a copy of data for faster access.
- Spooling and device reservation manage devices that cannot be shared.
- Error handling retries transient failures and reports permanent ones.
- <mark>The subsystem also provides protection: users reach devices only through system calls.</mark>
Introduction to Network, Distributed and Multiprocessor Operating Systems
<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">High weight</span>
Definition. A network OS lets users log in to and use remote machines that know they are networked; a <mark>distributed operating system makes a collection of independent computers appear to the user as a single system</mark>. A multiprocessor OS manages several CPUs sharing one memory.
Key points.
- Network OS: users are aware of machines and copy files explicitly; distributed OS: the system decides where work runs.
- Design issues: transparency (access, location, migration, replication, concurrency, failure), communication (message passing, RPC), reliability, scalability, heterogeneity and security.
- Transparency advantages are ease of use, resource sharing and location independence; disadvantages are overhead, hidden failures, security exposure and loss of user control.
- Failure types: crash (node halts), omission (message or response lost), timing (response too late), Byzantine (arbitrary or malicious behaviour), network partition.
- DFS benefits over a centralised file system: scalability, replicated files for fault tolerance and availability, parallel access for performance, and sharing from any node.
- On a totally reliable network, drop retransmission, timeouts and message-loss handling; keep naming, migration, performance and node-crash tolerance.
- RPC: a client calls a remote procedure like a local one; the client stub marshals the arguments into a message, the server stub unmarshals them and runs the procedure, and the result comes back the same way. Example: NFS.
- Process migration: freeze the process, copy its state (registers, address space, open files), and resume it on the target node.
Process migration method.
Step 1: Select process and destination; freeze the process.
Step 2: Capture state: registers, address space, open files, signals.
Step 3: Transfer the state to the destination.
Step 4: Same OS: restore directly. Different OS or architecture: convert data formats and system calls.
Step 5: Resume; forward messages, redirect open files.
Answer frame. Open with the definition of a distributed OS; for design issues develop point 2 in order transparency, communication, reliability, scalability, heterogeneity, security; for transparency, give advantages then disadvantages then types; for failures, define the three then the impact on reliability; for migration draw the steps above; close with the trade-off between transparency and performance.
Pitfall: Answering "failures" with only crash; name three with a line each.
Asked: [7 marks] (Nov 2023) Discuss the design issues of distributed operating system. Asked: [7 marks] (Jun 2024) What are the advantages and disadvantages of making the computer network transparent to the user? Asked: [7 marks] (Jun 2024, Jun 2025) List three possible types of failures in a distributed system. Asked: [7 marks] (Jun 2024) What are the benefits of a DFS when compared to a file system in a centralized system? Asked: [7 marks] (Jun 2025) What aspects of a distributed system would you select for a system running on a totally reliable network. Asked: [7 marks] (Jun 2025) Describe a method for process migration across different architecture running: (i) the same operating system, (ii) different operating system. Asked: [3 marks] (Jun 2023) Write short notes: Remote Procedure Call (RPC)
I/O management in UNIX & Windows
<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Not asked since 2022</span>
Definition. UNIX treats every device as a file, while Windows uses a layered I/O manager with drivers.
Key points.
- UNIX devices appear in /dev as block or character special files, using the same open, read, write and close calls.
- UNIX uses a buffer cache for block devices and character queues for terminals.
- The Windows I/O manager passes I/O request packets (IRPs) down a stack of drivers.
- Windows supports asynchronous I/O and plug and play drivers.
- <mark>UNIX: "everything is a file"; Windows: I/O manager plus driver stack.</mark>
Last-minute revision
- Polling wastes CPU; interrupts free it; DMA gives one interrupt per block.
- Serial port: interrupts; terminal concentrator: polling.
- Buffering is temporary memory; spooling queues jobs on disk.
- Double buffering overlaps device and process.
- Distributed OS gives a single-system image.
- Failure types: crash, omission, timing, Byzantine.
- RPC uses client and server stubs with marshalling.
- Layers: user software, device-independent, driver, interrupt handler, hardware.
- UNIX devices are files in /dev.
- Reliable network: no retransmission needed.
Memory hooks
- CO-TB: Crash, Omission, Timing, Byzantine.
- DMA = one interrupt per block, not per byte.
- Spooling = Simultaneous Peripheral Operations On-Line.
- Transparency: Access, Location, Migration, Replication, Concurrency, Failure.
Coverage checklist
- Principles and Programming: definition, controllers, device independence.
- Input/Output Problems: speed mismatch, variety.
- Different I/O operations: Program Controlled: polling.
- Interrupt Driven: Jun 2025 serial port vs concentrator.
- Concurrent I/O: DMA.
- Asynchronous Operations: blocking vs non-blocking.
- Logical structure of I/O function: layers.
- I/O Buffering: Nov 2023 buffering and spooling.
- Kernel I/o Subsystem: scheduling, caching, spooling.
- Introduction to Network, Distributed and Multiprocessor Operating Systems: Nov 2023, Jun 2024 (three), Jun 2025 (three), Jun 2023 RPC.
- I/O management in UNIX & Windows: device files, IRPs.