For a operating system to function properly and for better customization it should be engineered in such a way that operating system has to be made from smaller components rather than one huge monolithic system.

Each module should be carefully defined inputs, outputs, and functions.

Simple Structure

We can explain by going through examples.

MS DOS

Old MS DOS

It was designed and implemented by few people who had no idea that it will become so popular.

It was produced to provide functionality in least space, so it was not divided into modules. The interface is not well separated.

The application program was able to access the I/O routines to write directly to disks etc… Such freedom made the MS-DOS so vulnerable to malicious programs causing the entire system to crash.

It was also limited by the hardware. Providing no support to dual mode and no hardware protection. (SECTION 1.5.1 Dual mode: Kernel mode and user mode. Mode bit will be 0 for kernel mode operation and 1 if its user mode. The operating system will be working on behalf of the user application then its in user mode. If the user application makes a system call(Call to access the services provided by the kernel ). then its in kernel mode. This provides privileged services that all programs cannot access or execute the kernel services, which in-turn makes the hardware more protected)

UNIX

Like the MS-DOS, UNIX was also initially limited by the hardware functionalities.

Everything are below the system call interface and the above the physical hardware.

Kernel provides CPU scheduling, Memory management, other services related to system calls etc…

This monolithic structure was difficult to implement and maintain.

Traditional UNIX system Structures

Layered Approach

With there is proper hardware support, operating system can be broken into pieces that are smaller and more appropriate than those allowed by the original MS-DOS and UNIX systems.

Implementer have more freedom in changing the inner working of the operating system and create modular operating system.

Top-down approach is adopted, functionality and features are determined and separated into components.

Information is given more importance and it is hidden from different layers.

A layered operating system

Layer 0: It is the hardware (lowest layer)

Layer N: It is the user-interface (highest layer)

Let Layer M be a random layer in between 0 and N. It contains data structures and routines that can be invoked by the higher layer. Layer M can invoke only the lower layer(s).

Advantage

Simplicity of construction and debugging. layer selected can only use the lower-level layer. Layer by layer construction is more easy to debugged without affecting the rest of the system. If the layer is made perfect the second layer can be added to the system.

A layer does not need to know how the layers are implemented.

Disadvantage/Difficulty

Careful planning is required in making each layers as we can use only the lower layer functions. Device driver for memory module must be at lower layer than the memory management routines.

More difficulty comes when there is inter dependence of each layer

Micro-kernels

Mach Operating system: used micro-kernel approach.

This method operating system is created by removing all non-essential components form the kernel and moving it to user-level programs. The result is a smaller kernel. Minimal processes at the kernel level such as memory management, communication facilities.

Communication facility is between client program and services that are also running as user program. the communication is not direct but they communicate through the micro-kernel. This communication are called message passing.

Easier to port the OS from one hardware design to another.

Examples of OS that use the micro kernels: Tru64(Digital UNIX), Mac OS X, QNX (real-time OS)

Micro-kernels provide lower performance. That is why the Microsoft Windows NT had poor performance compared to Windows95. Windows XP had monolithic kernels.

Modules

Best methodology for operating system, design involve the use of the object-oriented programming techniques to create modules. Kernels has set of core components and links to additional services either during the boot time or the run time.

Dynamically loadable modules. This is used in modern UNIX such as Solaris, Linux, Mac OS X.

Solaris loadable modules

More flexible than layered system. Primary modules has only core functions and knowledge of how to load and communicate with other modules. it is more efficient because modules do not need to involve message passing in order to to communicate.

Apple Mac OS X uses hybrid structure

Mac OS X Structure

Top layer includes the application environment and set of services providing GUI to applications. Mach provides memory management, inter-process communication, message passing and thread scheduling. BSD component provides CLI for networking and file systems and implementation APIs

Operating System Concepts By, Abraham Silberschatz, Peter B Galvin, Greg Gagne

Data Science Enthusiastic | Web and App Developer