The program that hides the truth about the hardware from the programmer and presents a nice,
simple view of named files that can be read and written is, of course, the operating system. Just as
the operating system shields the programmer from the disk hardware and presents a simple file-
oriented interface, it also conceals a lot of unpleasant business concerning interrupts, timers,
memory management, and other low-level features. In each case, the abstraction offered by the
operating system is simpler and easier to use than that offered by the underlying hardware.
In this view, the function of the operating system is to present the user with the equivalent of an
extended machine or virtual machine that is easier to program than the underlying hardware.
How the operating system achieves this goal is a long story, which we will study in detail
throughout this book. To summarize it in a nutshell, the operating system provides a variety of
services that programs can obtain using special instructions called system calls. We will examine
some of the more common system calls later in this chapter.
1.1.2. The Operating System as a Resource Manager
The concept of the operating system as primarily providing its users with a convenient interface is a
top-down view. An alternative, bottom-up, view holds that the operating system is there to manage
all the pieces of a complex system. Modern computers consist of processors, memories, timers,
disks, mice, network interfaces, printers, and a wide variety of other devices. In the alternative
view, the job of the operating system is to provide for an orderly and controlled allocation of the
processors, memories, and I/O devices among the various programs competing for them.
Imagine what would happen if three programs running on some computer all tried to print their
output simultaneously on the same printer. The first few lines of printout might be from program 1,
the next few from program 2, then some from program 3, and so forth. The result would be chaos.
The operating system can bring order to the potential chaos by buffering all the output destined for
the printer on the disk. When one program is finished, the operating system can then copy its
output from the disk file where it has been stored to the printer, while at the same time the other
program can continue generating more output, oblivious to the fact that the output is not really
going to the printer (yet).
When a computer (or network) has multiple users, the need for managing and protecting the
memory, I/O devices, and other resources is even greater, since the users might otherwise
interfere with one another. In addition, users often need to share not only hardware, but
information (files, databases, etc.) as well. In short, this view of the operating system holds that its
primary task is to keep track of who is using which resource, to grant resource requests, to account
for usage, and to mediate conflicting requests from different programs and users.
[Page 6]
Resource management includes multiplexing (sharing) resources in two ways: in time and in space.
When a resource is time multiplexed, different programs or users take turns using it. First one of
them gets to use the resource, then another, and so on. For example, with only one CPU and
multiple programs that want to run on it, the operating system first allocates the CPU to one
program, then after it has run long enough, another one gets to use the CPU, then another, and
then eventually the first one again. Determining how the resource is time multiplexedwho goes
next and for how longis the task of the operating system. Another example of time multiplexing is
sharing the printer. When multiple print jobs are queued up for printing on a single printer, a
decision has to be made about which one is to be printed next.