OS — System Structure

Samir Shah
5 min readApr 4, 2019

--

A modern operating system is large and complex, if it is to be function properly and be modified easily, then it must be engineered very carefully.

A common approach is to partition the task into small components, or modules, rather than having one monolithic system.

Each of these modules should be a well-defined with inputs, outputs, and functions.

Followings are different operating system structure.

  1. Simple Structure
  2. Layered Approach
  3. Microkernels
  4. Modules
  5. Hybrid Systems

Simple Structure

Many operating systems do not have well-defined structures.

Such systems started as small, simple, and then grew beyond their original scope.

Two examples of Simple Structured Operating system.

  • MS-DOS
  • UNIX

MS-DOS

MS-DOS

MS-DOS was originally designed and implemented by a few people who had no idea that it would become so popular.

It was written to provide the most functionality in the least space, so it was not carefully divided into modules.

In MS-DOS, the interfaces and levels of functionality are not well separated.

For instance, application programs are able to access the basic I/O routines to write directly to the display and disk drives.

Such freedom leaves MS-DOS vulnerable to errant (or malicious) programs, causing entire system crashes when user programs fail.

Intel 8088 for which it was written provides no dual mode and no hardware protection, the designers of MS-DOS had no choice but to leave the base hardware accessible.

UNIX

UNIX

Another example of limited structuring is the original UNIX operating system.

Like MS-DOS, UNIX initially was limited by hardware functionality.

It consists of two separable parts: the kernel and the system programs.

The kernel is further separated into a series of interfaces and device drivers, which have been added and expanded over the years as UNIX has evolved.

The kernel provides the file system, CPU scheduling, memory management, and other operating-system functions through system calls.

Taken in sum, that is an enormous amount of functionality to be combined into one level. This monolithic structure was difficult to implement and maintain.

There is very little overhead in the system call or in communication within the kernel.

Layered Approach

A system can be made modular in many ways. One method is the layered approach, in which the operating system is broken into a number of layers.

The bottom layer (layer 0) is the hardware; the highest layer (layer N) is the user interface.

The main advantage of the layered approach is simplicity of construction and debugging.

The layers are selected so that each uses functions and services of only lower-level layers.

If an error is found during the debugging of a particular layer, the error must be on that layer, because the layers below it are already debugged.

A final 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 it does one on a nonlayered system.

Microkernels

This method structures the operating system by removing all nonessential components from the kernel and implementing them as system and user-level programs. The result is a smaller kernel.

Microkernels provide minimal process and memory management.

The main function of the microkernel is to provide communication between the client program and the various services that are also running in user space.

The resulting operating system is easier to port from one hardware design to another.

The microkernel also provides more security and reliability, since most services are running as user rather than kernel processes.

If a service fails, the rest of the operating system remains untouched.

Modules

The best current methodology for operating-system design involves using loadable kernel modules.

Here, the kernel has a set of core components and links in additional services via modules, either at boot time or during run time.

The idea of this design is for the kernel to provide core services while other services are implemented dynamically, as the kernel is running.

Linking services dynamically is preferable to adding new features directly to the kernel, which would require recompiling the kernel every time a change was made.

The overall result resembles a layered system in that each kernel section has defined, protected interfaces; but it is more flexible than a layered system, because any module can call any other module. The approach is also similar to the microkernel approach in that the primary module has only core functions and knowledge of how to load and communicate with other modules; but it is more efficient, because modules do not need to invoke message passing in order to communicate.

The Solaris operating system structure, shown in diagram, is organised around a core kernel with seven types of loadable kernel modules:

  • Scheduling classes
  • File systems
  • Loadable system calls
  • Executable formats
  • STREAMS modules
  • Miscellaneous
  • Device and bus drivers

Hybrid Systems

In practice, very few operating systems adopt a single, strictly defined structure. Instead, they combine different structures, resulting in hybrid systems that address performance, security, and usability issues.

Three hybrid systems are well-known: the Apple Mac OS X operating system and the two most prominent mobile operating systems — iOS and Android.

--

--