An operating system is the lowest level software on a computer that helps to manage hardware component through different programs and provide the base upon which application programs can be written. It provides application program with a better, simpler and easy to handle all the components of the computer. There are two modes of computer operation kernel mode and user mode. A kernel is nucleus of the operating system and it will usually provide features for low-level scheduling of processes, interprocess communication, process synchronization, context switching, manipulation of process control blocks, interrupt handling, process creation and destruction, and process suspension and resumption. The kernel is a part of the operating system which runs at the highest privilege level which is also known as supervisor mode. Kernel mode refers to a complete access to the entire hardware component and is allowed to execute all possible instructions where as in user mode programs are not allowed to perform certain instructions which may affect the system. To obtain services of Operating System, application must use System calls. System calls use a special machine instruction, called a trap, which causes the processor to change from user mode to kernel mode and to dispatch the kernel's system call handler. This way application or processes can request operating system services to perform restricted actions like accessing hardware. Processes can inter-communicate with help of interprocess communication facilities that which are implemented through a system call. Operating System main aim is to provide trustworthy and flawless application to user but fails to deliver till know. Most computer users are used to frequent operating system crashes. The reason for these problems is that today's operating systems suï¬€ers from fundamental design ï¬‚aws and bugs.
The structure of an operating system can be categorized based on their kernel design. Modern operating system could be divided into monolithic system, microkernel, layered system, exokernel or others by its architecture.
Monolithic Systems: In this approach operating system services are compiled as single, monolithic program that runs in kernel or supervisor mode to increase the performance of the system. Operating system is as a collection of procedures, each of which can call any of the other ones whenever it needs to. So, in terms of information hiding, there is essentially none-every procedure is visible to every other one which means there are mass of procedures which can call each other without any restriction which often leads to failure of the system reliability, security and flexibility. As explained earlier all the operating system services runs at highest privilege level which breaches Principle of Least Authorization (POLA) to increase the performance of the operating system. Due to huge amount of code in kernel it increases the complexity which becomes more difficult to manage. Device drivers are an integral part of the kernel and which have high level privilege with which they can bring down the entire system if the driver has problem in it.
A microkernel based operating system provides only a minimal set of core functionality which is required to execute with kernel privileges whereas all other applications run in user mode. That makes the kernel be less error prone, small Trusted Computing Base and suitable for verification. The most system services of microkernel are implemented as user-level servers, which make the system more flexible and extensible. The microkernel system is also designed with protection between individual components, therefore, systems could get more secure from it inter-component protection. Because when one of the components crashed, it does not crash the whole system. File system, device drivers, virtual memory are all implemented in unprivileged servers. So the servers must use IPC (interprocess communication) to communicate among different servers.
Layered Operating System:
In this approach the operating system as a hierarchy of layers, each one constructed upon the one below it. The system had 6 layers in kernel. Layer 0 deals with the processor allocation and multiprogramming which manages the processes. Layer 1 deal with memory management issues for the processes where as the layer 2 handles communication between the processes and interaction with user console. Layer 3 helps for Input/output management which manages all the I/O devices and the buffering of data. Layer 4 is location where user program can be found which do not need to worry about the lower layer functions like process, memory, console or I/O management. At the top most layer which is layer 5 system operator process are located here. Since this all layer are situated in kernel which is not necessary different approach is required to make it more reliable and flexible operating system in future.
Exokernel is well known as vertically structured operating systems. It does not provide a hardware abstraction layer like other operating systems; instead, they respectively duplicate or partition the hardware resources so that multiple operating systems can run next to each other with the illusion of having a private machine. Since exokernel runs in kernel mode and is responsible for the protection of resources and multiplexing, whereas each operating system runs in user mode, fully isolated from the other. Each of the operating systems running next to each other can either have a monolithic kernel or a microkernel structure. It is also augmented as Library Operating system because it only provides very low-level interface to the hardware and lacks high-level functionalities of other operating system.
Microkernel Based Operating System
Structure of Microkernel Operating System
From the above figure we can explain the exact approach of the microkernel operating system design. A microkernel is an operating system which provides kernel which, in its purest form, provides no operating-system services at all, only the mechanisms needed to implement those services. Microkernel systems only provide the essential system functions. A microkernel contains core functionalities like process management, very low-level of memory management, inter-process communication (IPC), threads, scheduling and System call interface. The microkernel is the only part of the system executing in a kernel mode. The main goal of a microkernel system is to keep it small. The services contained within the kernel itself are only provided because it would be difficult to provide them elsewhere. The operating system services run as applications on top of a microkernel as a user processes (called servers). Microkernel facilitates communication between the servers of the operating system. The kernel validates messages and either deals with them itself or passes them between servers. The user level services are granted access to hardware resources by issuing requests to the kernel via system or kernel calls. Although communication to hardware is done low level through the kernel, this is transparent to the user. The user simply calls a function through the server and the kernel and server communicate to accomplish the task. The microkernel itself is never scheduled for execution; it's simply called by processes or hardware interrupts. IPC is heart mechanism in a microkernel-based system. It provides functions like exchange data by value or by reference, synchronize threads, wakeup-calls, pager invocation, exception handling, interrupt handling, device control.
Modularity is the key property that gives power to microkernel. Microkernels are ï¬‚exible and can easily be extended because it is possible to replace servers or problem solving strategies. They are easier to maintain because small components are less complex and more manageable. The separation of responsibilities also is beneï¬cial for security and robustness of the operating system because faults are isolated and malfunctioning components may be replaced. Monolithic system often provides a good performance because all services are part of the kernel and thus can directly access each other. Since microkernel operating system requires additional communication to let system servers cooperate it is regarded as slow performance. The basic idea behind the microkernel designs to achieve high reliability by splitting the OS up into small, well defined modules. The modular nature of microkernel means it would be a lot easier to locate the errors. Should any problems occur then new fixed components can be inserted and processing can continue. One of the main ideas behind distributed systems is the ability to recover from device failures i.e. if one device goes down there is another that takes over its tasks and the system continues without any disruption. The same applies to software; inoperative components can be replaced as required without compromising system integrity.
To explain the basic nature of the Microkernel Operating system I have used Minix 3 as a example. In Minix 3 the idea of modularity is taken to limit and divide the operating system services into many independent user-mode processes. In the microkernel it has only some low-level functionality like handling interrupts, processes, scheduling and IPC, where as the user mode is divided into three layers such as drivers, servers and user programs. In the lowest layer of the user-mode it contains the device driver which don't have any access to I/O ports unless it is specified by the kernel. So authorization from the kernel is needed to read/write from the I/O devices. Another layer contains the servers which contains most of the operating system services such as file system, process manager. There are one or more file servers to manage the file system, process manager which helps to create, manage or destroy the processes. The topmost layer in the user mode is user program which obtains the operating system services by using IPC to the servers for the connection to the kernel calls. There is reincarnation server which helps to check and manage if all the servers and drivers are functioning correctly or not. If any fault is detected it will automatically replaced it with new server without any disruption to the system.
There are many advantages of using Microkernel Based operating system which are as follows:
It simpler and small kernel so it can be easily debug and maintained. Parts of a system can be upgraded bit by bit without having to replace the whole system i.e. maybe a file server is too slow. This could be replaced without having to replace any of the other servers. The same is true of microkernel servers. If a piece of code that handles the file system is too slow then a new service could be written and implemented by the user.
Flexibility and Portability:
The modular microkernel allows user level servers to be added and removed without having to shut-down the system. The flexibility of the microkernel comes from the fact that it does almost nothing so services can easily be added on. Each user level server has a well-defined interface that is easy to access and easy to understand. These servers are equally accessible to the clients irrespective of location, in fact the user it unlikely to know where the server resides. It is also easy to add a new service and debug it, as the whole system does not need to be stopped (as in the monolithic kernel architecture). With flexibility comes portability. Components (servers) can be mixed and matched to suit the system they are to run on.
With the modular components being simplified there is less that can go wrong. In the case of monolithic kernels there are hundreds of thousands of lines of code. If they go wrong finding the error would be a near impossible task. The modular nature of microkernels means it would be a lot easier to locate the errors. Should any problems occur then new fixed components can be inserted and processing can continue. One of the main ideas behind dividing operating system component is the ability to recover from server failures i.e. if one device goes down there is another that takes over its tasks and the system continues without any disruption.
Microkernel has good security properties. It helps to limit the power of each process in the system. Only authorized I/O ports can be used by the drivers. If a server or process illegally tries to access another's memory, this is detected by the kernel and an exception will be raised and action will be taken against it. Since the servers are independent of each other it can be only affected indirectly. For example: If server A relies on server B to perform a task, server A may be aï¬€ected by a malfunctioning in or malicious action by server B.
There are some disadvantages of the microkernel operating system which are causing real problem for its evolution and fast development in the modern operating system world is the performance. Microkernel based operating system often suï¬€ers from performance problems because multiple servers and processes must cooperate to perform a task. The reason for the performance loss is that extra use of interprocess communication (IPC) and which causes extra context switches are needed between user processes, system servers and the kernel. Furthermore, copying of data between cooperating servers causes additional overhead. A context switch from a user-space process to the kernel requires only changing a few bits at the CPU to switch to kernel mode and to restore the kernel's state.
Easy to debug
Easy to maintain
Easy to add/change services
Distributed services over the network
Failure of one service does not affect the OS and other services.
As services run in the user space as application programs, they can be easily restarted on failure.