Do you think IIT Guwahati certified course can help you in your career?
No
Introduction
In this article, we will delve into the architecture of operating systems. We'll explore how these different designs impact the OS's performance, usability, and security and what considerations go into choosing the right architecture for a given system.
What is Operating System?
The OS (Operating System) acts like a mediator between us and the computer hardware, providing us with an interface to execute programs quickly and efficiently.
An essential aspect of an operating system is its architecture, which refers to its different components' design and organization. These components include the CPU, memory management, file systems, device drivers, and user interface. The architecture determines how these components interact with each other and how they provide services to applications and users.
Before diving deep into the Operating System Architecture, let get familiar with some Operating system terminologies
Architecture of an (OS)Operating System
Kernel
Kernel is the central component( core ) of the operating system. It plays a critical role in ensuring the stability and security of the system. The Kernel performs tasks like process and memory management, file systems, etc.
Shell
In an operating system, a shell is a user interface( it can be a command line interface or graphical user interface ) that allows users to interact with the operating system by entering commands or running scripts. It acts like exposing the system services to the user and provides a more user-friendly interface.
Central Processing Unit (CPU)
A CPU is the primary component of a computer that performs most of the processing and calculations. It is also known as the "brain" of the computer and is responsible for executing instructions of the computer program.
Memory
Memory in a computer refers to the hardware components that store data, instructions, and information for the computer to access quickly. There are several types of memory in a computer, including:
RAM (Random Access Memory): It is the primary memory of a computer and is used to store data and instructions temporarily.
ROM (Read-Only Memory): A non-volatile memory stores essential instructions and data that the computer needs to access during startup.
Cache Memory: It is a type of high-speed memory that stores frequently accessed data and instructions to improve the computer's overall performance.
Virtual Memory: It is a memory management technique that uses hard disk space to extend RAM to improve the computer's performance.
Inter-Process Communication
The interaction of processes is referred to as interprocess communication. There are several threads in a process. Threads from any process interact with one another in the kernel space. Messages are sent and received via ports across threads. There are several ports at the kernel level, including process port, exceptional port, bootstrap port, and registered port. These ports all interact with user-space processes.
Memory Management
Memory management is assigning space in the main memory and managing different operations between the disk and main memory. However, there is also the creation of virtual memory for processes. Virtual memory means that if a process has a bigger size than the main memory, it is partitioned into portions and stored. After that, each part of the process is saved in the main memory one by one until the CPU executes it.
Operating systems are the backbone of modern computing devices, from smartphones to servers. However, not all operating systems are created equal, and different architectures of the operating system can significantly impact system performance, flexibility, and security.
Here, we will explore different operating system architectures and discuss each architecture's fundamental design principles, advantages and disadvantages, and some examples of operating systems that use each approach.
Monolithic Architecture
A monolithic operating system architecture includes all system functionalities in a single module, with the kernel and device drivers as key components. In this architecture, the operating system as a whole is working in the kernel space. The kernel directly controls all the file, memory, device, and process management.
Advantages of Monolithic Architecture
Fast: Monolithic operating systems are fast. Thus, they provide better process scheduling, memory management, file management, etc.
Direct Interaction between Components: All the components and the kernel can directly interact. It also helps in gaining a better speed.
Easy and Simple: Its structure is easy and simple as all the components are located in the same address space.
Better for Smaller Tasks: Monolithic OS works better for handling smaller tasks.
Disadvantages of Monolithic Architecture
Prone to Errors: Monolithic OS can generate errors and bugs in the system. It is because user programs use the same address space as the kernel.
Difficult to Update: In a monolithic OS, all the OS code is in a single big chunk; therefore, it is difficult to add or remove features in the OS.
Not Portable: The code written in a monolithic OS is difficult to carry with or transfer to another system: this is because all the code works in a big chunk only, and you have to move it all.
Examples of Monolithic-Based Operating Systems:
Windows
Linux
MacOS
Microkernel Architecture
The microkernel architecture includes only the major functions like memory and process management in the kernel. In this architecture, file management and input-output management are included in the user space.
Performance: Microkernel architecture is compact and isolated, it can perform better.
Security: Microkernels are safe since only those components are provided that would otherwise disturb the system’s functionality.
Scalable: It is easily expandable as compared to a monolithic kernel.
Modularity: Microkernels are modular, and the various modules can be swapped out, reloaded, and modified without affecting the Kernel. When compared to monolithic systems, there are fewer system crashes.The Microkernel interface aids in the implementation of a more modular system structure.
Disadvantages of Microkernel Architecture
Performance overhead: Performance overhead arises due to the need for inter-process communication between kernel modules. A context switch or a function call is required when the drivers are implemented as procedures or processes.
Limited hardware support: The microkernel architecture can be more difficult to port to new hardware platforms.
Higher cost: Compared to a monolithic system, providing services in a Microkernel system is costly.
Examples of Microkernel-Based Operating Systems:
MINIX
QNX
L4 microkernel
GNU Hurd
Differences Between the Monolithic Kernel and Microkernel
Parameter
Monolithic Kernel
Microkernel
System Services
All services, including device drivers, run in kernel space.
Only essential services, such as scheduling and interprocess communication, run in kernel space. Device drivers run in user space.
Coupling
Functions are tightly coupled and share a common memory space.
Functions are loosely coupled and communicate via message passing, incurring some overhead.
System Calls
System calls are fast, but errors in one component can crash the entire system.
System calls are slower due to message passing, but errors in one component do not necessarily crash the entire system.
Security
Less secure because a bug or vulnerability in one component can affect the entire system.
More secure because if one component is compromised, the damage is contained to that component.
Hybrid architecture is a combined approach of both microkernel and monolithic kernel architectures. It has a design like the monolithic kernel. It is fast, like the monolithic kernel. While it inherits the modularity and stability of microkernel architecture.
Advantages of Hybrid Architecture
Flexibility: It is flexible to design a hybrid architecture.
Better performance: Hybrid architecture provides better performance as it has the features of both monolithic and microkernel architecture.
Improved security: The hybrid architecture improves system security by isolating critical services.
Greater hardware support: The hybrid architecture can provide greater hardware support than a pure microkernel architecture.
Disadvantages of Hybrid Architecture
Complexity: Including both monolithic and microkernel architecture increases complexity.
Higher cost: The hybrid architecture can be more expensive to develop than a pure microkernel architecture due to the need for more complex inter-process communication mechanisms.
Examples of Hybrid-Based Operating Systems
Windows NT
macOS
IBM AIX
Solaris
Layered Architecture
The Layered Structure of the Operating System is a way of organizing the different components of an OS into separate layers. Each layer is responsible for specific functions and interacts with the layer above and below it. The bottom layer is the hardware layer, followed by the kernel layer, system call interface, and shell layer. This structure helps in modularizing the OS and allows for easier maintenance, development, and debugging.
Advantages of Layered Architecture
Modularity: This architecture promotes modularity because each layer only does its assigned duties.
Easy debugging: It is relatively simple to debug because the layers are discrete. If a mistake happens in the CPU scheduling layer, the developer can only debug that layer, as opposed to a Monolithic system where all services are present at the same time.
Easy update: A change made to one layer will have no effect on the other layers.
No direct access to hardware: The hardware layer is the design's innermost layer. So, unlike the Simple system, where the user has direct access to the hardware, a user can use hardware services but not directly modify or access it.
Abstraction: Every layer is focused on its own set of tasks. As a result, the other layers' functions and implementations are abstract.
Disadvantages of Layered Architecture
Complex and careful implementation: Because a layer can use the services of the levels below it, the layers must be carefully arranged. The memory management layer, for example, is used by the backup storage layer. As a result, it must be placed behind the memory management layer. As a result, significant modularity leads to complicated implementation.
Slower in execution: When a layer wishes to communicate with another layer, it sends a request that must travel through the layers between the two layers to be fulfilled. As a result, unlike the Monolithic system, which is faster, it increases response time. As an output, increasing the number of layers may result in an inefficient design.
Examples of Layered-Based Operating Systems:
UNIX
THEOS
VMS
Virtual Machine Architecture
The virtual machine architecture is a type of operating system architecture that runs multiple operating systems on a single physical machine. This approach provides flexibility and allows for efficient use of hardware resources, but it can also introduce overhead and complexity.
Advantages of Virtual Machine Architecture
Efficient Resource Utilization: Virtual machine architecture allows multiple operating systems to run concurrently on a single physical machine, improving hardware resource utilization.
Enhanced Security: This architecture provides greater security because every virtual machine is isolated from each other.
Easy Recovery: As this architecture uses virtual machines, recovery of the system is easy.
Disadvantages of Virtual Machine Architecture
Overhead: Virtual machine architecture introduces overhead due to the need for additional software layers, such as the hypervisor.
Workload: Depending on the workload, one virtual machine can be affected by other running virtual machines.
Complex Design: Virtual machine architecture can be complex to design and maintain due to the need for multiple layers of software. This can increase development time and maintenance costs.
Examples of Virtual Machine-Based Operating Systems
An operating system architecture refers to the fundamental structure and design principles of an operating system. It describes how the system manages hardware, memory, processes, and communication. It also manages the interaction between software and hardware components.
What is the role of the kernel in a layered architecture?
In a layered architecture, the kernel provides a core set of services, such as memory management and process scheduling, to the layer above it.
What are the different types of Kernel?
There are basically five types of Kernels: Monolithic Kernel, MicroKernel, Hybrid Kernel, Nano Kernel, Exo Kernel.
Which type of Kernel is used by Android?
Android Operating System, widely used in smartphones, is based on the Linux Kernel, which uses a monolithic type of Kernel. The Linux kernel provides the necessary low-level hardware abstraction layer and device drivers for Android to run on a wide variety of hardware platforms.
Is LINUX monolithic or layered?
Linux and other UNIX systems are considered monolithic kernels. It is because all the functionalities are compiled into one big chunk of code. In a monolithic kernel, all operating system services, such as device drivers, file system management, and process management, run in the same address space as the kernel.
What is operating system architecture in Linux?
The architecture of the Linux operating system consists of the Kernel, system library, system, hardware layer, and shell utility. The kernel of Linux is monolithic, and the hardware layer includes peripheral devices like CPU, RAM, HDD, etc.
What is the architecture of the DOS operating system?
DOS, or Disk Operating System, follows a simple architecture consisting of a kernel, command interpreter (COMMAND.COM), and various utility programs. It interacts directly with hardware, lacking the multitasking and memory protection features of modern operating systems.
Conclusion
In this article, we discussed the architecture of operating systems and its different types of it. We discussed all these types of operating systems' advantages and disadvantages and example operating systems.
Refer to our guided paths on Coding Ninjas Studio to learn more about DSA, Competitive Programming, JavaScript, System Design, etc. You can also consider our Operating System Course to give your career an edge over others.