Bugsy
Explains
3 hearts left

The operating system

New idea

Hundreds of programs, one CPU

Right now your computer might be playing music, running a browser with 20 tabs and a chat app, all at once. Yet each CPU core follows just one list of instructions at a time, round and round the fetch, decode, execute loop.

So who keeps the peace? The operating system (OS), such as Windows, macOS, Linux, Android or iOS. It's the manager program that starts when you switch on and runs until you shut down. Each program it's running is called a process, and a laptop often has hundreds.

The OS's trick is taking turns, very fast. It lets one process run for a time slice of a few milliseconds, then a timer interrupts the CPU. The OS saves exactly where that process was (its registers and the address of its next instruction), loads where the next one left off, and lets it run. Like a chess master playing 20 boards at once, moving from board to board.