Key Idea: The operating system manages the hardware and shares it between programs. That is why an application can ask for a file or the screen without knowing anything about the actual device underneath.
Paper 1
- Short answers and structured questions.
- Define, state, describe — one precise line per mark.
Paper 2
- Applied, scenario-based.
- Calculations — conversions, capacities, transfer times.
Both
- Explain wants the mechanism AND its consequence.
- Show every step of a conversion — method marks survive a wrong answer.
🧩 What the operating system does
Questions ask you to name a function and say what it actually does. Naming alone earns little.
| Function | What it actually does |
|---|---|
| Memory management | Tracks free memory, allocates it, stops one program reaching another's, reclaims it |
| Process management | Creates processes, records their state, schedules and ends them |
| File management | Directory structure, permissions, create/open/delete, hides the disk layout |
| Device management | Drivers, queuing competing requests, spooling |
| Security | Accounts, authentication, permissions, privilege levels |
| User interface | Graphical, or command line |
Without an OS every program would need its own code for every disk, screen and keyboard, and would only run on the exact hardware it was written for. The OS gives one consistent interface, and stops two programs using one device at once.
⏱️ Scheduling
A core runs one process at a time. Scheduling is the rule deciding which runs next, and for how long — and no single rule is best at everything.
| Algorithm | How it chooses | Its weakness |
|---|---|---|
| First come first served | Arrival order | One long job blocks everything behind it |
| Round robin | Fixed time slice each, in turn | Every switch costs overhead |
| Shortest job first | Lowest expected run time | Run times must be guessed; long jobs starve |
| Priority | Highest priority first | Low priority can starve unless priorities age |
Important: Waiting time is the time before a process starts. Average waiting time = total waiting ÷ number of processes — and you must reorder the processes first if the scheme requires it.
🔔 Polling and interrupts
| Polling | Interrupts | |
|---|---|---|
| Who starts it | The CPU asks each device | The device signals the CPU |
| Cost when idle | Wasted — most checks find nothing | None |
| Response | Up to one full cycle late | Immediate |
| Suits | One device, nothing else to do | A machine doing many things |
What happens on an interrupt
- The processor finishes the instruction it is currently executing
- Registers and the program counter are saved, so the program can resume
- The handler routine for that interrupt is looked up and run
- The saved values are restored and the interrupted program continues
- Handlers are kept short — while one runs, everything else waits
📝 Exam-style questions
Three processes arrive together needing 8 ms, 2 ms and 5 ms of processor time. Determine the average waiting time under first come first served in that order, and under shortest job first.
🔒 Model answer plan
See the mark-by-mark plan — for / against / judgement, with marking guidance — in study mode.
A program enters an endless loop. Explain why a pre-emptive scheduler means the machine keeps working, and what would happen under a non-pre-emptive one.
🔒 Model answer plan
See the mark-by-mark plan — for / against / judgement, with marking guidance — in study mode.
A keyboard sends a few characters a second while the processor executes billions of instructions in the same time. Explain why interrupts suit this device better than polling.
🔒 Model answer plan
See the mark-by-mark plan — for / against / judgement, with marking guidance — in study mode.
✅ Quick check
Cover the answers.
Which scheduling algorithm gives the lowest AVERAGE waiting time? Shortest job first — but run times must be estimated, and long jobs can starve.
What does pre-emptive mean? The OS can take the processor away from a running process before it finishes.
What is the first thing the processor does when an interrupt arrives? Finishes the instruction it is currently executing — interrupts are checked at the end of a cycle.
Why are interrupt handlers kept short? While one runs, the interrupted program makes no progress and further interrupts are delayed — an event can be missed entirely.
What is thrashing? Spending more time moving data between RAM and disk than doing useful work.
Exam tips
- Name the OS function AND say what it does — naming alone scores little.
- Waiting time is the time BEFORE a process starts, not how long it runs.
- Reorder the processes first if the scheduling scheme requires it.
- Pre-emptive means the OS can take the processor back; that is what stops one loop freezing the machine.
- Polling: the CPU asks. Interrupts: the device speaks. Say who starts the conversation.
- Starvation is fixed by ageing — raising a waiting process's priority over time.