OS Structure

Understanding the difference between monolithic and layered operating systems structures.

Monolithic Systems

In the monolithic approach, an operating system runs as a single program in kernel mode. It is written as a collection of procedures linked to a single large executable binary program. Using this model, each procedure is free to call any other procedure, meaning every procedure is globally visible. Although efficient, it introduces an opportunity for a complete system crash if one procedure crashes.

Structure, however, is possible if the services provided by the OS are called and parameters are placed in a well-defined location, such as a stack. When control is transferred to the OS, it will fetch the parameters from the well-defined location and index them into a table containing some slot k, a pointer to the procedure that carries out system call k. In such a system, there are three primary components:

  • A program that manages system calls and invokes the requested services.

  • Procedures that implement the functionality expected by a particular call.

  • Utility for helping the procedures.

Layered Systems

In a layered system, each layer is constructed to consider the layer below it. Because the functionality of any layer depends on the layer below it (except for the last / lowest layer; it depends on other hardware and interacts with the layer above it), each layer must interact with the layer below it. Such flow control also introduces isolation and removes the global transparency of monolithic systems; in other words, a higher layer is only aware of the operations that allow it to interact with the layer directly below and above it. Higher layers are generally unaware of other layers.

Primitive Example

A primitive example of a layered system is the THE System shown below, illustrating the fundamental idea behind a layered system.

LayerFunction

5

The operator ( a cononical name for user)

4

User programs

3

I/O Management

2

Operator-process communication

1

Memory management

0

Processor allocation and multiprogramming

In the example above, layer 0 is responsible for processor allocation, controlling which process has the right to use the system's single (I know, it's old) processor. This layer also handled context switching, interrupts, etc. Crucially, this responsibility was abstracted away from higher layers (1 - 5), allowing sequential processing where higher layers were unconcerned with other processes.

Layer 1, responsible for memory management, allows higher layers (2 - 5) to remain unconcerned about their state in (or out of) memory. Layer 2 handled communication with the user console. Layer 3 handled information streams to and from block devices; of course, this means user programs (developed by operators) are unconcerned with how information is gathered from these devices.

Modern operating systems (OSs) can be categorized as either layered or monolithic, but many incorporate elements of both designs to leverage their respective advantages. BSD typically has a modular layered structure that places system functionalities into a layer. Linux is traditionally considered a monolithic kernel but has modular capabilities (i.e., supporting dynamic loading and unloading of kernel modules).

Finally, Windows is a hybrid design incorporating a modular and microkernel design (described below).

Microkernels

Microkernels employ a modular design to minimize the impact of OS bugs. Only one module is permitted to run in kernel mode. Breaking up drivers and filesystems isolates the impact of a bug-related crash to just that module. For example, a bug in an audio driver will destroy the sound but not crash the system.

Drivers are restricted to necessary operations only, which limits the damage a software bug can do.

Last updated