Skip to content
Part IA Lent Term

What is an Operating System?

The extended machine

An operating system is a layer of software that sits between the hardware and the application programs. It presents the hardware to programmers through a cleaner, more convenient interface — the extended machine (or virtual machine) metaphor.

The raw hardware provides registers, memory addresses, and I/O ports. The OS wraps these in abstractions:

HardwareOS Abstraction
Physical memoryVirtual address space, files mapped into memory
Disk blocksFiles and directories
Network interfaceSockets, streams
CPU coresThreads or processes
Timer chipAlarms, sleep, scheduling quanta

Programmers write to these abstractions, not to the bare metal. If the hardware changes, only the OS needs to adapt; the application interface stays stable.

The resource manager

The OS also acts as a resource manager, arbitrating competing demands for the machine’s physical resources. It decides:

  • Which process runs on the CPU and for how long
  • Which regions of memory are allocated to which process
  • Who can read or write a file
  • Which disk blocks belong to which file

In a multi-user, multi-process system, the OS provides multiplexing (sharing resources in time or space) and protection (preventing interference between processes).

Kernel and user mode

To enforce protection, the CPU provides at least two privilege levels:

  • Kernel mode (supervisor mode): can execute all instructions, including privileged ones like I/O operations and page table manipulation.
  • User mode: restricted; attempts to execute privileged instructions cause a trap into the kernel.

The OS kernel runs in kernel mode; user programs and most services run in user mode. The boundary between them is the system-call interface.

System calls

A system call is how a user program requests a service from the kernel — opening a file, reading data, spawning a process, sending a signal. The sequence is:

  1. Program puts arguments in registers (or on the stack).
  2. Program executes a special trap instruction (e.g., syscall on x86-64, svc on ARM).
  3. CPU switches to kernel mode and jumps to a predefined kernel entry point.
  4. Kernel validates arguments, performs the operation, and returns a result.
  5. CPU returns to user mode at the instruction after the trap.

System calls are expensive compared to ordinary function calls (context switch overhead), but they are the only gateway into the kernel.

Summary

  • The OS is both an extended machine (providing clean abstractions) and a resource manager (arbitrating hardware).
  • Hardware-enforced dual-mode operation separates user code from kernel code.
  • System calls are the controlled entry point from user mode into the kernel.

Past Paper Questions

2019 Paper 2 Question 4(a): Describe the mechanisms by which an operating system protects a user process’ use of system resources (CPU, memory, I/O) from accidental or deliberate interference. Indicate what special hardware is required. [6 marks]