Concurrency: An Introduction
Thus far, we have seen the development of the basic abstractions
that the OS performs. We have seen how to take a single phys-
ical CPU and turn it into multiple virtual CPUs, thus enabling
the illusion of multiple programs running at the same time. We
have also seen how to create the illusion of a large, private vir-
tual memory for each process; this abstraction of the address
space enables each program to behave as if it has its own mem-
ory when indeed the OS is secretly multiplexing address spaces
across physical memory (and sometimes, disk).
In this note, we introduce a new abstraction for a single run-
ning process: that of a thread. Instead of our classic view of
a single point of execution within a program (i.e., a single PC
where instructions are being fetched from and executed), a multi-
threaded program has more than one point of execution (i.e.,
multiple PCs, each of which is being fetched and executed from).
Perhaps another way to think of this is that each thread is very
much like a separate process, except for one difference: they
share the same address space and thus can access the same data.