Unit 2: Operating system structure
1.1 Introduction
1.2 Layered System
1.3 Kernel
1.4 Types of kernel(Monolithic/Macro kernel and Micro/Exo kernel)
1.5 Client server model
1.6 Virtual machines
1.7 Shell
1. Shell:
A shell is a program that provides the traditional text only user interface for Linux and other Unix operating
system. It provides an easy connection between the user and kernel. The shell accepts user commands, interpret
them and execute. The command interpreter is called the shell which makes easy to use many features provided by
operating system. Its primary function is to read commands typed into a console or terminal window and then
execute it. It is an outer layer of the OS. A shell is an interface between the user and the internal part of the
operating system.
A user is in shell (i.e interacting with the shell) as soon as the user has logged into the system. A shell is the
most fundamental way that user can interact with the system and the shell hides the detail of the underlying system
from the user.
Example:
Bourne Shell
Bash shell
Korn Shell
C shell
2. Kernel:
The kernel is the main component of most computer operating systems. It is a bridge between applications and
the actual data processing done at the hardware level. The kernel's responsibilities include managing the system's
resources (the communication between hardware and software components). Usually as a basic component of an
operating system, a kernel can provide the lowest-level abstraction layer for the resources (especially processors
and I/O devices) that application software must control to perform its function. It typically makes these facilities
available to application processes through inter-process communication mechanisms and system calls. Operating
system tasks are done differently by different kernels, depending on their design and implementation. While
monolithic kernels execute all the operating system code in the same address space to increase the performance of
the system, microkernels run most of the operating system services in user space as servers, aiming to improve
maintainability and modularity of the operating system. A range of possibilities exists between these two extremes.
3. Operating System Structure:
The structure of an operating system is dictated by the model employed in building them. An operating system
model is a broad framework that unifies the many features and services the operating system provides and the tasks
it performs. Based on the structures, operating systems are of following types:
Monolithic System
Layered System
Virtual Machine
Exokernels or Microkernal
Client-Server Model
[Link] System
The operating system is written as a collection of procedures, each of which can call other procedure
whenever it needs. When this technique is used, each procedure in the system has a well-defined interface in terms
of parameters and results, and each procedure is free to call any other procedure. To construct the actual object
Lecture notes compiled by Mr. Madan Raj Pandey Page 1
Unit 2: Operating system structure
program of OS by using this approach, first compile all individual procedures and then bind into a single object file
using the system linker.
Similar to the other operating systems, applications in monolithic OS are separated from the operating
system itself. That is, the operating system code runs in a privileged processor mode (referred to as kernel mode),
with access to system data and to the hardware; applications run in a non-privileged processor mode (called the user
mode), with a limited set of interfaces available and with limited access to system data.
The service provided by the OS is requested by putting the parameters and then executing a TRAP
instruction. This instruction switches the machine from user mode to kernel mode and transfer control to the OS.
The OS then fetch the parameters and determine which system call is to be carried out. In this model for each
system call there is one service procedure that takes care of it. Example Systems: CP/M and MS-DOS.
Fig: Simple structuring model for monolithic system
The monolithic operating system structure with separate user and kernel processor mode is shown in Figure.
Lecture notes compiled by Mr. Madan Raj Pandey Page 2
Unit 2: Operating system structure
[Link] Operating System
The layered approach partition the OS into its functional component by breaking the OS into the number of
layers (level), each built on the top of lower layers. This system supports six layers:
Layer Functions
5 Operator
4 User program
3 I/O management and buffering
2 Process communication
1 Memory management
0 CPU scheduling and multiprogramming of CPU
Fig: OS layer
Layer 0 deals with allocation of the processor, switching between processes when interrupts occurred or timers
expired. It provides the basis for multiprogramming of CPU.
Layer 1 deal with the memory management. It allocates space for process in main memory.
Layer 2 handles communication between each process and the operator console.
Layer 3 takes care of managing I/O devices and buffering the information streams to and from them.
Layer 4 stores and handle user program.
Layer 5 stores the system operator procedure.
Example Systems: VAX/VMS, Multics, UNIX, Os/2, earlier version of Windows NT.
The main advantage of the layered approach is modularity. Modularity means developing the programs using
small units or sub programs called modules. Modularity helps in debugging and verification of the system easily. A
particular layer use operation and service only from its lower layer. Layering also makes it easier to enhance the
operating system; one entire layer can be replaced without affecting other parts of the system.
The main disadvantage of this architecture is that it requires an appropriate definition of the various layers and
a careful planning of the proper placement of the layer.
[Link] Machines:
Virtual machine approach provides an interface that is identical to the underlying bare hardware. Virtual
machine is an illusion of a real machine. Each process is provided with a (virtual) copy of the underlying computer.
The resources of the physical computer are shared to create the virtual machine. CPU scheduling can be used to
share the CPU and to create the appearance that users have their own processors. Although the virtual machine
concept is useful, it is difficult to implement. Much effort is required to provide an exact duplicate of the underlying
machine.
Lecture notes compiled by Mr. Madan Raj Pandey Page 3
Unit 2: Operating system structure
The best example of virtual machine architecture is IBM 370 computer. In this system each user can choose
a different operating system. Actually, virtual machine can run several operating systems at once, each of them
on its virtual machine. Its multiprogramming shares the resource of a single machine in different manner.
[Link]-Server or Microkernel
A trend in modern operating system is to move maximum code into the higher level and remove as
much as possible from operating system, minimizing the work of the kernel. The basic approach is to
implement most of the operating system functions in user processes. To request a service, such as request
to read a particular file, user sends a request to the server process, server checks the parameter and finds
whether it is valid or not. After that server does the work and send back the answer to client server model.
It works on request- response basis. The figure below shows client server architecture.
In this model, the main task of the kernel is to handle all the communication between the client and
the server by dividing the operating system into several processes, each of which implements a single set of
services. For example, I/O servers, memory server, process server, threads interface system. Each server runs in
user mode, provides services to the requested client. The client, which can be either another operating system
component or application program, requests a service by sending a message to the server. An OS kernel (or
microkernel) running in kernel mode delivers the message to the appropriate server; the server performs the
operation; and microkernel delivers the results to the client in another message.
The advantage of the client-server model is it’s adaptability to user in distributed system.
Lecture notes compiled by Mr. Madan Raj Pandey Page 4