Processes and multitasking — Computing, 14–17 years
A computer can keep many programs apparently running at once. The operating system gives each process resources and turns between them, while protecting one program from another.
A process is a running program
A program is a stored set of instructions; a process is that program brought to life with memory, a position in its instructions and resources such as open files. The operating system can pause one process, save its situation and let another run. Fast switching makes several activities appear simultaneous, even on one processor core.
Why does the operating system share time?
The problem is that many tasks want the processor, memory and devices at the same time. Without a manager, one program could keep the processor forever, overwrite another program’s memory or use a file while someone else changes it. The operating system coordinates access so programs can be useful without taking complete control.
Three tasks sharing one core
Suppose music, a browser and a download are running on one core. The operating system gives music 5 milliseconds, saves its position, gives the browser 5 milliseconds, then gives the download 5 milliseconds, repeating the cycle. If the browser waits for the network, it can be paused sooner, so the processor works elsewhere instead of sitting idle.
Multitasking is not free
It is easy to think that adding another program creates more computing power, because everything stays visible. In fact, switching processes takes time, and each needs memory. If too many compete, the computer may slow down badly; if memory fills, it may move data to storage, which is much slower. Sharing resources improves use, but cannot create extra ones.
Why your phone can do several things
A phone can play audio, show a notification and upload a photo because its operating system schedules processes and gives them carefully limited access. It may stop background work to save battery, or give a video more processor time when smooth motion matters. These choices are practical resource management, not proof that every task runs at exactly the same moment.
Keep exploring
Other languages
Loading MyLeoNes™…