A levels Computer Science · Computer systems
Operating systems
1The role of the operating system
The operating system (OS) is software that manages the computer's hardware and provides a platform for applications.
Its jobs include:
- memory management: sharing RAM between programs;
- processor scheduling: sharing CPU time between processes;
- managing input and output devices, through device drivers;
- file management: organising files and folders on storage;
- security: user accounts, passwords and access rights;
- providing a user interface.
It also hides the complexity of the hardware: programs ask the OS to save a file instead of controlling the disk directly. This makes the computer act like a simpler "virtual machine".
Check yourself
Which job of the OS shares CPU time between programs?
Show the answer
Scheduling
Who runs next.
2Memory management
Programs need memory, and several must share RAM safely without overwriting each other.
- Paging splits memory into equal-sized pages (for example 4 KiB). A program's pages can be placed anywhere in RAM; a page table maps them.
- Segmentation splits a program into logical parts of different sizes, such as the code for one subroutine, or one data structure.
- Virtual memory uses part of the disk as if it were RAM. Pages not in use are moved (swapped) to disk to make room.
Paging. Program A's pages sit in any free frames of RAM, tracked by a page table; page A3 has been swapped out to disk.
If RAM is very short, the computer spends more time swapping pages than doing work: this is disk thrashing, and the computer becomes very slow.
Check yourself
What is virtual memory?
Show the answer
Part of secondary storage used as if it were extra RAM
Disk pretending to be RAM.
3Scheduling
A process moves between states: ready (waiting for the CPU), running (on the CPU) and blocked (waiting for input/output).
Process states. Only one process per core is running; others wait in the ready queue or are blocked waiting for input/output.
| Algorithm | How it works | Problem |
|---|---|---|
| first come, first served | runs jobs in arrival order to completion | long jobs hold up short ones |
| round robin | each process gets a fixed time slice, then goes to the back of the queue | no priorities |
| shortest job first | runs the shortest job next | needs run times in advance; long jobs may wait forever (starvation) |
| shortest remaining time | like shortest job first, but can interrupt for a shorter new job | starvation |
| multilevel feedback queues | several queues of different priority; processes move between them | complex |
Round robin with a time slice of 2
- Jobs A (5 units), B (3 units) and C (1 unit) arrive together.
- A runs 0–2, B 2–4, C 4–5 (C finishes at 5).
- A runs 5–7, B 7–8 (B finishes at 8).
- A runs 8–9 (A finishes at 9).
Check yourself
What is a time slice?
Show the answer
The fixed amount of CPU time a process gets in round robin before the next process runs
Quantum.
4Types of operating system
| Type | Feature | Example use |
|---|---|---|
| single-user multitasking | one user runs many programs at once | a laptop |
| multi-user | many users share one computer's resources fairly | a mainframe or server |
| distributed | one OS spread across several computers that work as one | large scientific computing |
| embedded | small and built for one device, with limited resources | a washing machine |
| real-time | must respond within a guaranteed time | aircraft controls, car airbags |
Check yourself
Which type of OS is needed for a car's airbag system?
Show the answer
Real-time
Guaranteed response.
5BIOS and device drivers
The BIOS (or modern UEFI) is firmware stored in non-volatile memory on the motherboard. When the computer is switched on, it:
- runs the power-on self-test (POST) to check the hardware;
- finds the bootloader on the storage device;
- loads the operating system into RAM.
A device driver is software that lets the OS talk to a particular piece of hardware, such as a printer. It translates general OS commands into the specific instructions the device understands, so the OS does not need to know every device in detail.
Check yourself
Why is the BIOS stored in non-volatile memory?
Show the answer
It must be available when the computer is first switched on, before anything is loaded
Not lost when off.
6Virtual machines and utility software
A virtual machine is software that imitates a computer. Uses:
- running a different operating system inside the current one (for example to test software);
- running intermediate code such as Java bytecode on any platform;
- separating servers safely on one physical machine.
Virtual machines are slower than running directly on the hardware.
Utility software helps maintain the computer:
- antivirus software scans for and removes malware;
- defragmentation rearranges file pieces on a hard disk so they are next to each other;
- backup software copies files, either full or incremental (only what has changed);
- compression software makes files smaller.
Check yourself
What does disk defragmentation do?
Show the answer
Rearranges parts of files so they are stored together, speeding up access on a hard disk
Tidies the pieces.
Now test yourself
This lesson has a 8-question quiz and 5 exam-style questions with mark schemes in Impera. Free, with your progress saved.
Practise in Impera