Layered Approach
- With proper hardware support, OSs can be broken into pieces that are smaller and more appropriate than those allowed by the original MS-DOS or UNIX systems. Under the top-down approach, the overall functionality and features are determined and are separated into components.
- A system can be made modular in many ways. One method is the layered approach, in which the OS is broken up into a number of layers (levels). The bottom layer (layer 0) is the hardware; the highest (layer N) is the user interface. This layering structure is depicted in Fig. 12.
Figure 12:
A layered operating system.
|
- The first system constructed in this way was the THE system built at the Technische Hogeschool Eindhoven in the Netherlands by E. W. Dijkstra (1968) and his students.
- The system had 6 layers, as shown in Fig. 13.
Figure 13:
Structure of the THE operating system.
|
- Layer 0 dealt with allocation of the processor, switching between processes when interrupts occurred or timers expired. Layer 0 provided the basic multiprogramming of the CPU.
- Layer 1 did the memory management. It allocated space for processes in main memory. Layer 1 software took care of making sure pages were brought into memory whenever they were needed.
- Layer 2 handled communication between each process and the operator console.
- Layer 3 took care of managing the I/O devices and buffering the information streams to and from them. Above layer 3 each process could deal with abstract I/O devices with nice properties, instead of real devices with many peculiarities.
- Layer 4 was where the user programs were found. They did not have to worry about process, memory, console, or I/O management.
- The system operator process was located in layer 5.
- A further generalization of the layering concept was present in the MULTICS (Multiplexed Information and Computing Service, an extremely influential early time-sharing OS, 1964) system. Instead of layers, MULTICS was described as having a series of concentric rings, with the inner ones being more privileged than the outer ones.
- A typical operating-system layer-say, layer M-consists of data structures and a set of routines that can be invoked by higher-level layers. Layer M, in turn, can invoke operations on lower-level layers.
- The main advantage of the layered approach is simplicity of construction and debugging. The layers are selected so that each uses functions (operations) and services of only lower-level layers. This approach simplifies debugging and system verification.
- Each layer is implemented with only those operations provided by lower-level layers. A layer does not need to know how these operations are implemented; it needs to know only what these operations do. Hence, each layer hides the existence of certain data structures, operations, and hardware from higher-level layers.
- A problem with layered implementations is that they tend to be less efficient than other types. For instance, when a user program executes an I/O operation, it executes a system call that is trapped to the I/O layer, which calls the memory-management layer, which in turn calls the CPU-scheduling layer, which is then passed to the hardware. Each layer adds overhead to the system call; the net result is a system call that takes longer than does one on a nonlayered system.
Cem Ozdogan
2010-02-19