Multitasking

The earliest computers did one thing at a time. A lab computer might calculate detonation waves for one of the physicists. Next it would calculate mixing ratios for a chemist. All programs were run sequentially, one at a time; and each had full control of the computer. However two programs couldn't run at the same time. This is called batch processing, and it's a very efficient way to get maximum usage out of a very expensive computer. Almost all the computer's time is spent on user programs. However batch processing can be very annoying when your differential equation integration program that would take two seconds of CPU time gets stuck in line behind the physics department's nuclear structure modeling project that's going to run for the next three days.

Time sharing operating systems were invented to allow multiple people to use one then very expensive computer at the same time. On a time sharing system many people could run programs at the same time. The operating system is responsible for splitting the time among the different programs that are running. That way you can finish integrating your differential equation while the physics department's nuclear modeling program is still churning away. The physics department nuclear modeling program might take two weeks to run instead of three days, but everyone with the shorter programs was happy (at least until the physicists figured out how to hack the computer so that it only ran their program).

Once systems allowed different users to run programs at the same time it was a short step to letting the same user run multiple programs simultaneously. Each running program (generally called a process) had its own memory space, its own set of variables, its own stack and heap, and so on. One process could spawn another process, but afterwards the two processes behaved more or less independently. Mechanisms like inter procedure calls (IPC) were developed to allow processes to interact with each other, but such interaction was expensive and difficult. And this is where matters rested for about twenty years.

However it's not just users that want to do different things at the same time. Many programs also need to do several things at once. A web browser, for instance, can print a file in the background while it downloads a page in one window and formats the page as it downloads. The ability of an individual program to do more than one thing at the same time is most efficiently implemented through threads.


Next | Top | Cafe au Lait

Copyright 1997, 2006 Elliotte Rusty Harold
elharo@metalab.unc.edu
Last Modified August 22, 2006