How does one processor seem to do many things at once?
Your computer has only a few processor cores but runs dozens of programs. It is a magic trick, and the magician is the scheduler.
▶ Start the storyOne processor seems to do many things at once because it does them one at a time, in tiny slices, and switches so fast that you cannot see the joins. This is : give each task a small slice of processing time, and the quick switching gives the illusion of simultaneous execution. The part of the operating system that decides whose slice comes next is the scheduler, and scheduling is what makes multitasking possible with a single CPU.
Picture one teacher marking the work of thirty pupils by giving each a few minutes in turn, over and over. Every pupil feels the teacher is always there for them, though only one is being helped at any moment. On a computer the slices are measured in milliseconds: a thread's turn is often capped at 100 to 200 when others are waiting, and switching happens often enough that you perceive the programs running in parallel.
The idea was invented because the alternative was miserable. In the , a programmer's work could take days to run, and the programmer might never see the computer. Letting someone sit at the machine directly was far too expensive, since the computer stayed idle while the user typed. fixed that: the first interactive system for software development, CTSS, was started at MIT by John McCarthy's memo in 1959, and Fernando Corbató led it to a working prototype by 1961.
Batch era
- Programs handed to an operations team
- Results could take days
- Programmer might never see the computer
Time-sharing
- Many users share one computer in small slices
- Interactive: the machine answers back
- Pioneered by CTSS at MIT, 1959–1961
Each switch means saving the state of the running program and loading another's, which is called a . It costs time, so a good scheduler balances fairness against speed.
Quiz me
0/3
Recap
One processor, many programs: tiny turns, switched so fast that it looks simultaneous.
💡 A trick to remember it · A teacher marking thirty exercise books a few minutes at a time, so every pupil feels attended to.
Surprising fact · Before time-sharing, a programmer's job could take days and the programmer might never see the computer.
Connects to
- 🛰️ How did a low-priority task freeze a spacecraft on Mars?
- 🏃 What is a process, and how can one program run twice?
- 🪄 Why does every program think it has the memory to itself?
- 🔁 What does a processor actually do billions of times every second?
- ⏳ How did a Danish telephone engineer invent the mathematics of waiting in line?
Sources (6)
No source, no claim. Every fact in this lesson (15 claims) cites at least one of these.