Process Management
On a single-core CPU only one process can be carried out at any instant, because the core can only work through one instruction at a time. So that every program you are using keeps making progress, the operating system shares the CPU out, letting processes take turns.
A time slice is the small amount of CPU time the operating system gives a process before moving on, often just a few milliseconds. When a process's time slice runs out, it is paused and a different process gets a turn.
The scheduler is the part of the operating system that decides which process runs next and how long its time slice will be. The rules it follows are called a scheduling algorithm. One algorithm might be fair so every process gets a turn; another might let the process you are using run first, so the computer feels responsive.
The scheduler only makes the decision. The CPU is the hardware that actually carries out the process. This constant switching between processes is what makes multi-tasking possible.
Imagine a single-core computer running three processes: the text editor you are typing into, a video editor exporting a clip and a zip program compressing a folder, with each process given a 15 ms time slice.
| Turn | Time on the CPU (ms) | Process running |
|---|---|---|
| 1 | 0 to 15 | Text editor |
| 2 | 15 to 30 | Video export |
| 3 | 30 to 45 | Zip compression |
| 4 | 45 to 60 | Text editor |
Each process gets a regular turn, and because the switching happens so quickly the letters you type still appear straight away while the export and the compression carry on in the background.
Edexcel GCSE Computer Science · Process Management