Information Technology Reference
In-Depth Information
Chapter 4
Concurrency and Threads
Many hands make light work.
{anon
In the real world|outside of computers|dierent activities often proceed
at the same time: five jazz musicians play their instruments while reacting
to each other; one car drives north while another drives south; one part of a
drug molecule is attracted to a cell's receptor while another part is repelled; a
humanoid robot walks, raises its arms, and turns its head; I fetch one article
from the The New York Times website while you fetch another; or millions of
people make long distance phone calls on Mother's Day.
Internally, computers also harness concurrency. For example, a modern
server might have 8 processors, 10 disks, and 4 network interfaces; a work-
station might have a dozen active IO devices including a screen, a keyboard, a
mouse, a camera, a microphone, a speaker, a wireless network interface, a wired
network interface, an internal disk drive, an external disk drive, a printer, and
a scanner; today, even mobile phones can have dual-core processors.
However, programmers are used to thinking sequentially. For example, when
reading or writing the code for a procedure, we identify an initial state and a
set of preconditions, think through how each successive statement changes the
state, and from that determine the postconditions. How would one even think
about a program where dozens of things are happening at once?
To simulate or interact with the real world, to manage hardware resources,
and to map parallel applications to parallel hardware, computer systems must
provide programmers with abstractions for expressing and managing concur-
rency. These abstractions are used both by applications and within the operat-
ing system, itself.
137
Search WWH ::




Custom Search