CHAPTER 5
Parallel System Tools
“Telling the Monkeys What to Do”
Most computers spend a lot of time doing nothing. If you start a system monitor tool
and watch the CPU utilization, you’ll see what I mean—it’s rare to see one hit 100
percent, even when you are running multiple programs.* T h e r e a r e j u s t t o o m a n y d e l a y s
built into software: disk accesses, network traffic, database queries, waiting for users
to click a button, and so on. In fact, the majority of a modern CPU’s capacity is often
spent in an idle state; faster chips help speed up performance demand peaks, but much
of their power can go largely unused.
Early on in computing, programmers realized that they could tap into such unused
processing power by running more than one program at the same time. By dividing the
CPU’s attention among a set of tasks, its capacity need not go to waste while any given
task is waiting for an external event to occur. The technique is usually called parallel
processing (and sometimes “multiprocessing” or even “multitasking”) because many
tasks seem to be performed at once, overlapping and parallel in time. It’s at the heart
of modern operating systems, and it gave rise to the notion of multiple-active-window
computer interfaces we’ve all come to take for granted. Even within a single program,
dividing processing into tasks that run in parallel can make the overall system faster,
at least as measured by the clock on your wall.
Just as important is that modern software systems are expected to be responsive to
users regardless of the amount of work they must perform behind the scenes. It’s usually
unacceptable for a program to stall while busy carrying out a request. Consider an
email-browser user interface, for example; when asked to fetch email from a server, the
program must download text from a server over a network. If you have enough email
or a slow enough Internet link, that step alone can take minutes to finish. But while the
* To watch on Windows, click the Start button, select All Programs → Accessories → System Tools → Resource
Monitor, and monitor CPU/Processor usage (Task Manager’s Performance tab may give similar results). The
graph rarely climbed above single-digit percentages on my laptop machine while writing this footnote (at
least until I typed while True: pass in a Python interactive session window...).
177
Do
wnload from Wow! eBook <www.wowebook.com>