A structure of an Operating System determines how it has been designed and how it functions. There are numerous ways of designing a new structure of an Operating system. In this post we will learn about 6 combinations that have been tested and tried. These six combinations are, monolithic system, layered system, microkernels, client-server model, virtual machines, and exokernels.
Monolithic System structure in an Operating System
In this organizational structure, the entire operating system runs as a single program in the kernel mode. An operating system is a collection of various procedures linked together in a binary file. In this system, any procedure can call any other procedure. Since it is running in kernel mode itself, it has all the permissions to call whatever it wants.
In terms of information hiding, there is basically none. All procedures are running in kernel mode so they have access to all modules and packages of other procedures.
However, using this approach without any restrictions can lead to thousands of procedure calls and this can lead to a messy system. For this purpose, the actual OS is constructed in a hierarchy. All the individual procedures are compiled into a single executable file using the system linker.
Even a monolithic system has a structure in which it can run in user mode. There already is a basic structure given by the organization
- A main procedure that invokes the requested service procedures.
- A set of service procedures that carry out system calls.
- A set of utility procedures that help out the system procedures.
Layered Systems Structure in Operating Systems
As the name suggests, this system works in layers. It was designed by E.W. Dijkstra in 1968 along with some help from his students. This system was first implemented in THE system built at the Technische Hogeschool Eindhoven in the Netherlands. The THE system was a simple batch system for a Dutch computer, the Extralogica X8.
There are 6 layers in the system, each with different purposes.
|1||Memory and drum management|
|0||Processor allocation and multiprogramming|
Layer 0 – Processor Allocation and Multiprogramming – This layer deals with the allocation of processor, switching between the processes when interrupts occur or when the timers expire.
The sequential processes can be programmed individually without having to worry about other processes running on the processor. That is, layer 0 provides that basic multiprogramming of the CPU
Layer 1 – Memory and Drum Management – This layer deals with allocating memory to the processes in the main memory. The drum is used to hold parts of the processes (pages) for which space couldn’t be provided in the main memory. The processes don’t have to worry if there is available memory or not as layer 1 software takes care of adding pages wherever necessary.
Layer 2 – Operator-Process communication – In this layer, each process communicates with the operator (user) through the console. Each process has its own operator console and can directly communicate with the operator.
Layer 3 – Input/Output Management – This layer handles and manages all the I/O devices and it buffers the information streams that are made available to it. Each process can communicate directly with the abstract I/O devices with all of its properties.
Layer 4 – User Programs – The programs used by the user are operated in this layer and they don’t have to worry about I/O management, operator/processes communication, memory management or the processor allocation.
Layer 5 – The Operator – The system operator process is located in the outer most layer.
Microkernels system in an operating system
Traditionally, all the layers of the OS in a layered system went in the kernel. So they all had root access to the OS and any small bug in any layer could be fatal to the OS.
Popular examples of a microkernel system include Integrity, K42, PikeOS, Symbian, and MINIX 3
The main purpose of this system is to provide high reliability. Because of the high reliability that it provides, the applications of microkernels can be seen in real-time, industrial, avionics (electronics fitted in aircrafts and aviation), and military applications that are mission-critical and require high reliability.
The operating system is split into small well-defined modules, of which only one, the microkernel, runs in kernel mode. Rest of the modules run as powerless ordinary user processes. Running each device driver and file system as separate user processes is a fail-safe method as a bug in one of the driver, will result in the failure of only that component. A bug easily references an invalid memory address and brings the system to a grinding halt instantly.
Taking the example of MINIX 3 will help us understand microkernels much better.
The MINIX 3 is an OS written in C with 3200 lines of code and about 800 lines of code for the assembler to handle low-level functions like catching interrupts or switching processes. The C code handles managing and scheduling processes, handles interprocess communication. It also provides a set of 35 kernel calls to allow the rest of the operating system to do its work. These calls perform functions like hooking handlers to interrupts, moving data between address spaces, and installing new memory maps for newly created processes.
The process structure of MINIX 3 is divided into three parts above the kernel. The lowest layer contains device drivers. The middle layer contains servers. The uppermost layer contains user programs.
Client-Server Model in Operating Systems
The client-server model in an operating system is a variation of the microkernel system. The middle layer in the microkernel system is the one with servers. These servers provide some kind of service to clients. This makes up the client-server model.
Communication between clients and servers is obtained by message passing. To obtain a service, one of the client process constructs a message saying what it wants and sends it to the appropriate service. The service then does it work and sends back the answer.
If the clients and servers are on the same machine then some optimizations are possible. But generally speaking, they are on different systems and are connected via a network link like LAN or WAN.
The best example of this model is you reading this article learning about it right now. You are the client and you are requesting this page from whatever host this article has been uploaded to. The internet is basically the example since much of the web operates this way.
Virtual Machines in Operating systems
When many users wanted to work interactively in terminals, IBM started working on a time sharing system. The idea of a virtual machine is very simple. The virtual machine is run on the hardware of the OS it is being installed. A virtual machine thinks it has its own disk, with blocks running from 0 to some maximum so the virtual machine monitor must maintain tables to remap disk addresses and all other resources.
Exokernels are a subset of virtual machines. In this, the disks are actually partitioned and resources are allocated while setting it up. Different OS may be installed on different partitions. Beneath both, the partition is what we call the exokernel.
Where to go from here?
When people talk about OS they only think about Windows, macOS, and Linux. But there are more operating systems than what’s on your screen right now.