Information Technology Reference
In-Depth Information
an illusion presented by the true operating system running underneath. One
reason for the operating system to provide a virtual machine is for application
portability. If a program only runs on an old version of an operating system,
then we can still run the program on a new system running a virtual machine.
The virtual machine hosts the application on the old operating system, running
on top of the new operating system. Another reason for virtual machines is as
an aid in debugging. If an operating system can be run as an application, then
the operating system developers can set breakpoints, stop, and single step their
code just as they would an application.
In addition to virtualization, operating systems mask many other limita-
tions inherent in physical hardware, by providing applications with the illusion
of hardware capabilities that are not physically present. For example, on a com-
puter with multiple processors sharing memory, each processor can update only
a single memory location at a time. The memory system in hardware ensures
that any updates to the same memory word are atomic, that is, the value stored
Denition: atomic
in memory is the last value stored by one of the processors, not a mixture of the
updates of the different processors. Atomicity at the level of a memory word
is preserved in hardware even if more than one processor attempts to write to
memory at exactly the same time. While this might seem sucient, applica-
tions (and the operating system itself) need to be able to update larger data
structures, ones spread over many memory locations. What happens when two
processors attempt to update the same data structure at roughly the same time?
As we'll discuss later, the results can be quite unexpected and quite dierent
from what would have happened had each of the processors updated the data
structure in turn. Ideally, the programmer would like to have the abstraction
of an atomic update to the entire data structure, not just to a single memory
word. As we will discuss, the illusion of atomic updates to data structures is
provided by the operating system using some specialized mechanisms provided
in hardware.
Persistent block storage devices, such as magnetic disk or flash RAM, provide
another example. At a physical level, these systems support block writes to
storage, where the size of the block depends on physical device characteristics.
If the computer crashes in the middle of a block write, it could leave the disk
in an unknown state, with neither the old nor the new value stored at that
location. Of course, applications need to be able to store data on disk that is
variable in size, possibly spanning multiple disk blocks. And users want their
data to be preserved even | or especially | if there is a machine failure while
the disk is being updated.
We will discuss techniques that the operating system uses to accomplish
these and other illusions. In each of these cases, the operating system provides
a more convenient and flexible programming abstraction than what is provided
by the underlying hardware.
Search WWH ::




Custom Search