The Operating System as a Resource Manager

The Operating System as a Resource Manager

The idea of an operating system as primarily providing abstractions to application programs is a top-down view. An alternative, bottom-up, view holds that the operating system is there to manage all the pieces of a complicated system. Present computers contain processors, memories, timers, disks, mice, network interfaces, printers, and a large variety of other devices. In the alternative view, the job of the operating system is to provide for an orderly and controlled distribution of the processors, memories, and I/O devices among the several programs competing for them.

Current operating systems permit multiple programs to run simultaneously. Imagine what would happen if three programs running on some computer all tried to print their output at the same time 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 for 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 several 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. Moreover, 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 main task is to keep track of which programs are using which resource, to grant resource requests, to account  for usage, and to mediate conflicting requests from different programs and users.

Resource management comprises multiplexing (sharing) resources in two different 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 various 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 ultimately the first one again. Determining how the resource is time multiplexed, who goes next and for how long is the task of the operating system. Another example of time multiplexing is sharing the printer. When many 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.

The other type of multiplexing is space multiplexing. Instead of the customers taking turns, each one gets part of the resource. For instance, main memory is usually divided up among various running programs, so each one can be resident at the same time (for example, in order to take turns using the CPU). Assuming there is sufficient memory to hold multiple programs, it is more efficient to hold several programs in memory at once rather than give one of them all of it, especially if it only requires a small fraction of the total. Of course, this raises issues of fairness, protection, and so on, and it is up to the operating system to resolve them. One more resource that is space multiplexed is the (hard) disk. In many systems a single disk can hold files from many users at the same time. Assigning disk space and keeping track of who is using which disk blocks is a typical operating system resource management task.




Tags

operating system, main memory, i/o devices