Layered Structure of Operating System

Learn via video courses
Topics Covered

Overview

A system can be made modular in many ways and one of the methods is the layered approach in which the operating system is broken into several layers. Generally, the structure of an operating system depends on how the various common components are interconnected with each other and how it is combined with the kernel. The layered structure of an operating system is the improvised approach of the early monolithic systems.

What is a Layered Structure of Operating Systems?

As we know, there are many processes that a task undergoes before executing in a system. These processes are performed by different parts of a system may be software, hardware, etc.

All these sections of processes are termed layers and this concept of arranging different tasks into various layers is called the Layered Structure of Operating System. The bottom-most layer (layer 0)is the hardware and the top layer is the user interface.

There are many things such as memory, software, microprocessors, etc that combine to form a proper system. The construction and debugging of the layered structure are easy and simple. Each of the layers relies on a layer that is below it.

The construction of layers is made in such a way that each of the layers uses the function only of its lower layer levels. In this approach, the job execution starts to execute from the lowest layer and moves towards the topmost layer. If there is any technical fault in any layer or if any layer does not work, then there will be an error only due to that particular layer.

Given below is an illustration that shows how the layered structure of an operating system is done.

Layered structure of operating systems

  • As we can see there are different `layers of components of a system.
  • This layering helps the user to modify or update the inner workings and we can also increase the modularity of a task.
  • The inner workings can be updated as long as the external interface is not disturbed by the user.
  • The main positive point of this structure is its construction and debugging are simple and easy. But we can get difficulty describing each of these layers.
  • But there are also some negative points of this structure. We need to modify that data and pass it on to each layer, which ultimately leads to overhead in the system. An example of this type of operating system structure is UNIX.

Why Layering is Important in Operating Systems?

Layering in Operating System provides some significant features to the operating system. All the layers of an operating system are defined separately and each of them interacts with the other as per the requirement.

Layering is easy to create and its maintenance is also simple as there is a specified layer for a particular type of task. If we do modification in one layer then it does not affect the other layers. These are limited to a particular layer only.

The interaction of a particular layer is only done with two layers that are one layer above it and a second layer below it. It is a must as it allows one to retain control over workflow or operating system. This is the rule of the architecture of the layered operating system.

Architecture of Layered Structure

The layered structure of the operating system is a successor to the early monolithic operating system. In it, the whole working of an operating system is split into various simpler layers and all of these layers handle some specific type of task (functionality) to be performed for executing a job. There are certain rules that we must need to consider while designing a layered structure of an operating system. These are as follows:

  • The outermost layer should be the user interface layer.
  • The innermost layer should be the Hardware layer.
  • Suppose there are n layers, then a particular layer has permission to access the layers that is below it but it can not access the layers that are above it. Layer n-1 will be able to access layer n-2 to layer 0 but it will be unable be access the `nth layer.
  • Layer 0 handles the basic multiprocessing of the CPU. Layer 0 also manages the allocation of processes, interruptions that occur during the process, if the timer expires, or switching between the processes.

Suppose the software or user interface layer wants to interact with the hardware layer then it starts to make contact with its nearby layers and it will travel through all the layers until it reaches the hardware layer. So, the implementation and designing of these layers should be in such a way that a particular layer will only be provided with service by the layer that is below it.

Advantages of Layered Structure

  • Modularity- There is a limitation to every layer as each layer will do its task only that it is designed for.
  • Easy debugging- Since the tasks are specific for every layer, it is easy to debug.
  • Easy update- Since all the layers are limited to themselves only, updating is easy as it does not affect any other layers near it.
  • No direct access to hardware- If we want to access the hardware directly, it is not possible in the layers structure design. The process needs to travel through each layer one by one before reaching the hardware layer
  • Abstraction- Each layer of the layered structure has its function so here we can see abstraction.

Disadvantages of Layered Structure

  • Complex and careful implementation- In this structure, a particular layer can access the service of a layer that is below it, so the placement and arrangement of the layers should be done precisely so that a task can execute in a good flow throughout the layers.

  • Slower execution- In this structure, we can not access a layer directly that is away from a particular layer. There is a request generated that allows the process to travel from one layer to another layer. So, the execution takes time in this structure. The response time increased here which is not seen in earlier monolithic systems.

Different Layers of Operating Systems

There are six layers in the layered structure of an operating system. Below is an illustration that will help us to understand the layered structure of an operating system in a better way.  Different Layers of Operating Systems

Hardware:

This layer is the bottom-most layer of the operating system. This layer is responsible for the interaction between system hardware and external devices such as keyboards, mouse, scanners, printers, etc.

CPU Scheduling

This layer is responsible for the process scheduling of the CPU. When we request a process to the system, this layer of the operating system manages all the requests and put them into a queue. The processes are put into a job queue which then goes to the disk and the processes get executed one by one. This layer manages all the functionality of managing and allocating these requests to the disk.

Memory Management

This layer of an operating system is responsible for the management of memory and processes from disk to primary memory and secondary memory. This layer is the third layer of the operating system. All the memory management processes related to ROM and RAM are managed by this layer of the operating system. RAM is a kind of memory where a process is allocated for a short time. In it, the process enters and exits from the main memory of the system.

Process Management

This layer handles work like managing processes. For example, a processor will tackle a particular processor, managing the wait schedule of different processes. The various disk scheduling algorithm that is used for process schedule like FCFS (first come, first served), SJF (shortest job first), priority scheduling, round-robin scheduling, etc is done in this layer.

I/O Buffer

All the input or output that we provide to a system using external devices are stored in a buffer that stores the data temporarily. This buffer of the input/output device is handled by the I/O Buffer layer of an operating system. Suppose we are giving some input from the keyboard. The input that we provide via keyboard will be stored in the keyboard buffer for a short period. The buffer helps the system to maintain a decent timing speed of the processor because the input/output devices have generally slow speeds. So, using a buffer makes fast processing of input/output.

User Programs

This layer is the top layer of the operating system. All the applications and user interfaces are at this layer. Suppose we are using a browser for googling. The user-level interface that we can see through our eyes is handled by the User program layer of the operating system.

FAQs

There are some most asked questions that we frequently came across. Given below are some of the most asked questions and their answer.

Q. Describe the Objective of a Layered Operating System.

A. The layered operating system is designed in such a way that various layers handle some particular type of work so that process execution becomes easy and efficient.

Q. Why is a Layered Operating System Important?

A. In a layered structure, all the layers have their specific functionality and advantages. Also adding, updating, and creating a system in a layer is easy. All the layers are independent of performance and any change in one layer does not affect the other layers.

Q. Where is a Layered Operating System Used?

A. The Layered structure operaStructureem is the improvised version of earlier monolithic and simple structures like UNIX and MS-DOS. A layered structure is used in a Windows operating system named Windows New Technology (NT).

Q. What is the Significant Advantage of the Layered Procedure to System Design in OS?

A. The top layer is a user interface and the bottom-most layer is hardware. One of the significant advantages of layering is building and debugging at each layer is easy.

Q. What is the Primary Difficulty of Layered Operating Systems?

A. One of the primary difficulties of a layered operating system is that careful planning is necessary because each layer can get services from its lower layer only. So, the arrangement should be done carefully.

Conclusion

  • Layered structure of an operating system is the improvised version of early monolithic systems.
  • In this type of design, there are several layers that are specifically designed for a certain task.
  • All the layers are interconnected but they work independently.
  • The bottom-most layer is the hardware part and the topmost layer is the user interface.
  • Using a layered approach, updating and debugging at each layer is easy and they do not affect any other layer.
  • There are various layers of an operating system such as Hardware, CPU Scheduling, Memory Management, Process Management, I/O Buffer, and User Programs that together form a complete operating system.