Operation of an O.S
Structure of an operating system,
Operating systems with monolithic structure
Layered design of an operating system
Virtual machine operating systems
Kernel based operating systems
Size: 4.81 MB
Language: en
Added: Oct 10, 2020
Slides: 48 pages
Slide Content
Prepared by Prof. Anand H. D., Dept. of ECE, Dr. AIT, Bengaluru-56
OPERATING SYSTEM
Mr. Anand H. D.
1
Operating System: Structure of the Operating System
Department of Electronics & Communication Engineering
Dr. Ambedkar Institute of Technology
Bengaluru-56
Prepared by Prof. Anand H. D., Dept. of ECE, Dr. AIT, Bengaluru-56 2
Operating System: Structure of the Operating System
Operation of an O.S Structure of an operating system Operating systems with monolithic structure
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Topics to be covered:
Operation of an O.S
Structure of an operating system,
Operating systems with monolithic structure
Layered design of an operating system
Virtual machine operating systems
Kernel based operating systems
Operation of an O.S Structure of an operating system Operating systems with monolithic structure
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Prepared by Prof. Anand H. D., Dept. of ECE, Dr. AIT, Bengaluru-56 3
Operating System: Structure of the Operating System
Operation of an OS
When a computer is switched on,
the boot procedure analyzes its
configuration— CPU type,
memory size, I/O devices, and
details of other hardware
connected to the computer. It
then loads a part of the OS in
memory, initializes its data
structures with this information,
and hands over control of the
computer system to it.
Figure is a schematic diagram of
OS operation
Figure: Overview of OS operation
Operation of an O.S Structure of an operating system Operating systems with monolithic structure
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Prepared by Prof. Anand H. D., Dept. of ECE, Dr. AIT, Bengaluru-56 4
Operating System: Structure of the Operating System
Operation of an OS
An event like I/O completion or end of a time slice causes an interrupt. When a
process makes a system call, e.g., to request resources or start an I/O Operation, it too
leads to an interrupt called a software interrupt.
The interrupt action switches the CPU to an interrupt servicing routine. The interrupt
servicing routine performs a context save action to save information about the
interrupted program and activates an event handler, which takes appropriate actions
to handle the event.
The scheduler then selects a process and switches the CPU to it. CPU switching occurs
twice during the processing of an event—first to the kernel to perform event handling and
then to the process selected by the scheduler.
The functions of an OS are thus implemented by event handlers when they are
activated by interrupt servicing routines. Following Table summarizes these functions,
which primarily concern management of processes and resources, and prevention
of interference with them.
Operation of an O.S Structure of an operating system Operating systems with monolithic structure
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Prepared by Prof. Anand H. D., Dept. of ECE, Dr. AIT, Bengaluru-56 5
Operating System: Structure of the Operating System
Operation of an OS
Memory management
File management
Initiation and termination of processes, scheduling
Function Description
Table: Functions of an OS
Process management
Allocation and deallocation of memory, swapping, virtual
memory management
I/O interrupt servicing, initiation of I/O operations,
optimization of I/O device performance
Preventing interference with processes and resources
Creation, storage and access of files
Sending and receiving of data over the network
I/O management
Security and protection
Network management
Prepared by Prof. Anand H. D., Dept. of ECE, Dr. AIT, Bengaluru-56 6
Operating System: Structure of the Operating System
In determining how an operating system is to perform one of its functions, the OS designer
needs to think at two distinct levels:
• Policy: A policy is the guiding principle under which the operating system will perform
the function.
• Mechanism: A mechanism is a specific action needed to implement a policy.
A policy is implemented as a decision-making module that decides which mechanism
modules to call under what conditions.
Policies and Mechanisms
A policy decides what should be done, while a mechanism determines how something
should be done and actually does it.
A mechanism is implemented as a module that performs a specific action.
Operation of an O.S Structure of an operating system Operating systems with monolithic structure
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Operation of an OS Structure of an operating system
Prepared by Prof. Anand H. D., Dept. of ECE, Dr. AIT, Bengaluru-56 7
Operating System: Structure of the Operating System
Example: to identify policies and mechanisms in round-robin scheduling.
The priority-based scheduling policy, which is used in multiprogramming systems would
also require a mechanism for maintaining information about ready processes; however, it
would be different from the mechanism used in round-robin scheduling because it would
organize information according to process priority. The dispatching mechanism, however,
would be common to all scheduling policies.
In scheduling, we would consider the round-robin technique to be a policy.
The following mechanisms would be needed to implement the round-robin scheduling
policy: Maintain a queue of ready processes
Switch the CPU to execution of the selected process (this action is called
dispatching)
Apart from mechanisms for implementing specific process or resource management
policies, the OS also has mechanisms for performing housekeeping actions. The context
save action is implemented as mechanism.
Operation of an O.S Structure of an operating system Operating systems with monolithic structure
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Operation of an OS Structure of an operating system
Prepared by Prof. Anand H. D., Dept. of ECE, Dr. AIT, Bengaluru-56 8
Operating System: Structure of the Operating System
Portability and Extensibility of Operating Systems
Porting is the act of adapting software for use in a new computer system. Portability
refers to the ease with which a software program can be ported—it is inversely proportional
to the porting effort.
The design and implementation of operating systems involves huge financial investments.
To protect these investments, an operating system design should have a lifetime of more
than a decade. Since several changes will take place in computer architecture, I/O device
technology, and application environments during his time, it should be possible to adapt an
OS to these changes. Two features are important in this context—portability and
extensibility.
Extensibility refers to the ease with which new functionalities can be added to a software
system. Porting of an OS implies changing parts of its code that are architecture
dependent so that the OS can work with new hardware.
Operation of an O.S Structure of an operating system Operating systems with monolithic structure
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Operation of an OS Structure of an operating system
Prepared by Prof. Anand H. D., Dept. of ECE, Dr. AIT, Bengaluru-56 9
Operating System: Structure of the Operating System
Some examples of architecture-dependent data and instructions in an OS are:
• An interrupt vector contains information that should be loaded in various fields of the
PSW to switch the CPU to an interrupt servicing routine. This information is architecture
specific.
• Information concerning memory protection and information to be provided to the memory
management unit (MMU) is architecture-specific.
• I/O instructions used to perform an I/O operation are architecture-specific.
The architecture-dependent part of an operating system’s code is typically associated with
mechanisms rather than with policies.
An OS would have high portability if its architecture-dependent code is small in size, and
its complete code is structured such that the porting effort is determined by the size of
the architecture dependent code, rather than by the size of its complete code.
Hence the issue of OS portability is addressed by separating the architecture-dependent
and architecture-independent parts of an OS and providing well-defined interfaces
between the two parts.
Operation of an O.S Structure of an operating system Operating systems with monolithic structure
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Operation of an OS Structure of an operating system
Prepared by Prof. Anand H. D., Dept. of ECE, Dr. AIT, Bengaluru-56 10
Operating System: Structure of the Operating System
Later operating systems solved this problem by adding a functionality to the boot
procedure.
It would check for hardware that was not present when the OS was last booted, and either
prompt the user to select appropriate software to handle the new hardware, typically a set
of routines called a device driver that handled the new device, or itself select such
software.
The new software was then loaded and integrated with the kernel so that it would be
invoked and used appropriately.
Extensibility of an OS is needed for two purposes:
•for incorporating new hardware in a computer system—typically new I/O devices or
network adapters and
•for providing new functionalities in response to new user expectations.
Early operating systems did not provide either kind of extensibility. Hence even addition of
a new I/O device required modifications to the OS.
Operation of an O.S Structure of an operating system Operating systems with monolithic structure
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Operation of an OS Structure of an operating system
Prepared by Prof. Anand H. D., Dept. of ECE, Dr. AIT, Bengaluru-56 11
Operating System: Structure of the Operating System
Modern operating systems go a step further by providing a plug-and-play capability,
whereby new hardware can be added even while an OS is in operation.
The OS handles the interrupt caused by addition of new hardware, selects the appropriate
software, and integrates it with the kernel.
Lack of extensibility leads to difficulties in adapting an OS to new user expectations.
Several examples of such difficulties can be found in the history of operating systems.
In 1980s and 1990s, PC users desired a new feature for setting up several sessions with an
operating system at the same time. Several wellknown operating systems of that time, e.g.,
MS-DOS, had difficulties providing it because they lacked sufficient extensibility.
A similar difficulty was experienced by the Unix operating system while supporting
multiprocessor computer systems.
Operation of an O.S Structure of an operating system Operating systems with monolithic structure
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Operation of an OS Structure of an operating system
Operation of an O.S Structure of an operating system Operating systems with monolithic structure
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Prepared by Prof. Anand H. D., Dept. of ECE, Dr. AIT, Bengaluru-56 12
Operating System: Structure of the Operating System
Operation of an OS Structure of an operating system Operating systems with monolithic structure
An OS is a complex software that has a large number of functionalities and may contain
millions of instructions.
It is designed to consist of a set of software modules, where each module has a well-defined
interface that must be used to access any of its functions or data.
Such a design has the property that a module cannot “see” inner details of functioning of
other modules. This property simplifies design, coding and testing of an OS.
Early operating systems had a monolithic structure, whereby the OS formed a single
software layer between the user and the bare machine, i.e., the computer system’s
hardware (see Figure).
Figure: Monolithic OS.
Operation of an O.S Structure of an operating system Operating systems with monolithic structure
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Prepared by Prof. Anand H. D., Dept. of ECE, Dr. AIT, Bengaluru-56 13
Operating System: Structure of the Operating System
Operation of an OS Structure of an operating system Operating systems with monolithic structure
The user interface was provided by a command interpreter. The command interpreter
organized creation of user processes. Both the command interpreter and user processes
invoked OS functionalities and services through system calls.
Two kinds of problems with the monolithic structure were realized over a period of time.
The sole OS layer had an interface with the bare machine. Hence architecture-dependent
code was spread throughout the OS, and so there was poor portability.
It also made testing and debugging difficult, leading to high costs of maintenance and
enhancement.
These problems led to the search for alternative ways to structure an OS. In the following
sections we discuss three methods of structuring an OS that have been implemented as
solutions to these problems.
• Layered structure
• Kernel-based structure
• Microkernel-based OS structure
Operation of an O.S Structure of an operating system Operating systems with monolithic structure
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Prepared by Prof. Anand H. D., Dept. of ECE, Dr. AIT, Bengaluru-56 14
Operating System: Structure of the Operating System
Operation of an OS Structure of an operating system Operating systems with monolithic structure
• Microkernel-based OS structure:
The microkernel provides a minimal set of facilities and services for implementing an OS.
Its use provides portability. It also provides extensibility because changes can be made to
the OS without requiring changes in the microkernel.
• Layered structure:
The layered structure attacks the complexity and cost of developing and maintaining an
OS by structuring it into a number of layers.
The THE multiprogramming system of the 1960s is a well-known example of a layered
OS.
• Kernel-based structure:
The kernel-based structure confines architecture dependence to a small section of the OS
code that constitutes the kernel, so that portability is increased.
The Unix OS has a kernel-based structure.
Operation of an O.S Structure of an operating system Operating systems with monolithic structure
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Prepared by Prof. Anand H. D., Dept. of ECE, Dr. AIT, Bengaluru-56 15
Operating System: Structure of the Operating System
Layered design of an operating system
Operation of an OS Structure of an operating system Operating systems with monolithic structure
The semantic gap can be illustrated as follows:
• A machine instruction implements a machine level primitive operation like arithmetic or
logical manipulation of operands.
• An OS module may contain an algorithm, say, that uses OS-level primitive operations like
saving the context of a process and initiating an I/O operation. These operations are more
complex than the machine-level primitive operations.
This difference leads to a large semantic gap, which has to be bridged through programming.
The monolithic OS structure suffered from the problem that all OS components had to be
able to work with the bare machine. This feature increased the cost and effort in developing
an OS because of the large semantic gap between the operating system and the bare
machine.
Semantic Gap: The mismatch between the nature of operations needed in the application
and the nature of operations provided in the machine.
Operation of an O.S Structure of an operating system Operating systems with monolithic structure
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Prepared by Prof. Anand H. D., Dept. of ECE, Dr. AIT, Bengaluru-56 16
Operating System: Structure of the Operating System
Layered design of an operating system
Operation of an OS Structure of an operating system Operating systems with monolithic structure
Each operation desired by the OS now becomes a sequence of instructions, possibly a
routine (see Figure).
It leads to high programming costs. The semantic gap between an OS and the machine
on which it operates can be reduced by
either using a more capable machine
—a machine that provides instructions to perform some (or all) operations that operating
systems have to perform
—or by simulating a more capable machine in the software.
Figure: Semantic gap
Operation of an O.S Structure of an operating system Operating systems with monolithic structure
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Prepared by Prof. Anand H. D., Dept. of ECE, Dr. AIT, Bengaluru-56 17
Operating System: Structure of the Operating System
Layered design of an operating system
Operation of an OS Structure of an operating system Operating systems with monolithic structure
The former approach is expensive. In the latter approach, however, the simulator, which is
a program, executes on the bare machine and mimics a more powerful machine that has
many features desired by the OS. This new “machine” is called an extended machine, and
its simulator is called the extended machine software.
Now the OS interfaces with the extended machine rather than with the bare machine; the
extended machine software forms a layer between the OS and the bare machine.
The basic discipline in designing a layered OS is that the routines of one layer must use only
the facilities of the layer directly below it—that is, no layer in the structure can be bypassed.
Further, access to routines of a lower layer must take place strictly through the interface
between layers. Thus, a routine situated in one layer does not “know” addresses of data
structures or instructions in the lower layer—it only knows how to invoke a routine of the
lower layer. This property, which we will call information hiding, prevents misuse or
corruption of one layer’s data by routines situated in other layers of the OS.
Operation of an O.S Structure of an operating system Operating systems with monolithic structure
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Prepared by Prof. Anand H. D., Dept. of ECE, Dr. AIT, Bengaluru-56 18
Operating System: Structure of the Operating System
Layered design of an operating system
Operation of an OS Structure of an operating system Operating systems with monolithic structure
During debugging, localization of errors becomes easy since the cause of an error in a layer,
e.g., an incorrect value in its data element, must lie within that layer itself.
Information hiding also implies that an OS layer may be modified without affecting other
layers. These features simplify testing and debugging of an OS.
Figure : Layered OS design.
Operation of an O.S Structure of an operating system Operating systems with monolithic structure
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Prepared by Prof. Anand H. D., Dept. of ECE, Dr. AIT, Bengaluru-56 19
Operating System: Structure of the Operating System
Layered design of an operating system
Operation of an OS Structure of an operating system Operating systems with monolithic structure
We say that the lower layer provides an abstraction that is the extended machine. We call
the operating system layer the top layer of the OS.
Figure illustrates a two-layered OS. The extended machine provides operations like context
save, dispatching, swapping, and I/O initiation.
The operating system layer is located on top of the extended machine layer. This
arrangement considerably simplifies the coding and testing of OS modules by separating the
algorithm of a function from the implementation of its primitive operations. It is now easier
to test, debug, and modify an OS module than in a monolithic OS.
The layered structures of operating systems have been evolved in various ways—using
different abstractions and a different number of layers.
Operation of an O.S Structure of an operating system Operating systems with monolithic structure
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Prepared by Prof. Anand H. D., Dept. of ECE, Dr. AIT, Bengaluru-56 20
Operating System: Structure of the Operating System
Layered design of an operating system
Operation of an OS Structure of an operating system Operating systems with monolithic structure
The second problem concerns difficulties in developing a layered design.
• Since a layer can access only the immediately lower layer, all features and facilities
needed by it must be available in lower layers.
• This requirement poses a problem in the ordering of layers that require each other’s
services.
• For example, a designer may wish to put process handling functions in one layer and
memory management in the next higher layer. However, memory allocation is required as a
part of process creation.
The layered approach to OS design suffers from three problems.
The operation of a system may be slowed down by the layered structure.
• Recall that each layer can interact only with adjoining layers. It implies that a request for
OS service made by a user process must move down from the highest numbered layer to
the lowest numbered layer before the required action is performed by the bare machine.
• This feature leads to high overhead.
Operation of an O.S Structure of an operating system Operating systems with monolithic structure
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Prepared by Prof. Anand H. D., Dept. of ECE, Dr. AIT, Bengaluru-56 21
Operating System: Structure of the Operating System
Layered design of an operating system
Operation of an OS Structure of an operating system Operating systems with monolithic structure
• To overcome this difficulty, process handling can be split into two layers. One layer would
perform process management functions like context save, switching, scheduling, and
process synchronization.
• This layer would continue to be lower than the memory management layer. The other layer
would perform process creation. It would be located above the memory management layer.
The third problem concerns stratification of OS functionalities. Stratification occurs because
each functionality has to be divided into parts that fit into different layers of a layered OS.
These parts must use interfaces between the various layers to communicate with one
another.
• For example, consider a certain functionality F of the OS that consists of two modules,
Fl1 and Fl2, belonging to layers l1 and l2 respectively. If layer l2 can be entered only
through an interrupt, Fl1 must cause an interrupt to communicate with Fl2. This fact can
lead to a complex design and a loss of execution efficiency.
Operation of an O.S Structure of an operating system Operating systems with monolithic structure
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Prepared by Prof. Anand H. D., Dept. of ECE, Dr. AIT, Bengaluru-56 22
Operating System: Structure of the Operating System
Layered design of an operating system
Operation of an OS Structure of an operating system Operating systems with monolithic structure
• It may be noted that the design of a multilayered OS does not focus on separating
architecture-dependent parts of OS code; for example, four out of the five layers of the THE
multiprogramming system described in Table contain architecture-dependent parts. Thus, a
layered structure does not guarantee high portability.
• Stratification also leads to poor extensibility because addition of a new functionality
requires new code to be added in many layers of the OS, which, in turn, may require
changes in the layer interfaces.
Table : Layers in the THE Multiprogramming System
Operation of an O.S Structure of an operating system Operating systems with monolithic structure
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Prepared by Prof. Anand H. D., Dept. of ECE, Dr. AIT, Bengaluru-56 23
Operating System: Structure of the Operating System
Layered design of an operating system Virtual machine operating systems
We call each of these operating systems a guest OS and call the virtual machine OS the host
OS. The computer used by the VM OS is called the host machine
Operation of an OS Structure of an operating system Operating systems with monolithic structure
Different classes of users need different kinds of user service. Hence running a single OS on
a computer system can disappoint many users.
• Operating the computer under different OSs during different periods is not a satisfactory
solution because it would make accessible services offered under only one of the operating
systems at any time.
• This problem is solved by using a virtual machine operating system (VM OS) to
control the computer system.
The VM OS creates several virtual machines.
• Each virtual machine is allocated to one user, who can use any OS of his own choice on
the virtual machine and run his programs under this OS.
• This way users of the computer system can use different operating systems at the same
time.
Operation of an O.S Structure of an operating system Operating systems with monolithic structure
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Prepared by Prof. Anand H. D., Dept. of ECE, Dr. AIT, Bengaluru-56 24
Operating System: Structure of the Operating System
Layered design of an operating system Virtual machine operating systems
A virtual machine is a virtual resource.
Let us consider a virtual machine that has the same architecture as the host machine; i.e.,
it has a virtual CPU capable of executing the same instructions, and similar memory and
I/O devices.
Operation of an OS Structure of an operating system Operating systems with monolithic structure
It may, however, differ from the host machine in terms of some elements of its configuration
like memory size and I/O devices.
Because of the identical architectures of the virtual and host machines, no semantic gap
exists between them, so operation of a virtual machine does not introduce any performance
loss (contrast this with the use of the extended machine layer);
software intervention is also not needed to run a guest OS on a virtual machine. The VM OS
achieves concurrent operation of guest operating systems through an action that resembles
process scheduling—it selects a virtual machine and arranges to let the guest OS running
on it execute its instructions on the CPU. The guest OS in operation enjoys complete control
over the host machine’s environment, including interrupt servicing.
Operation of an O.S Structure of an operating system Operating systems with monolithic structure
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Prepared by Prof. Anand H. D., Dept. of ECE, Dr. AIT, Bengaluru-56 25
Operating System: Structure of the Operating System
Layered design of an operating system Virtual machine operating systems
The VM OS can arrange to get control when an interrupt occurs, find the guest OS whose
domain the interrupt belongs to, and “schedule” that guest OS to handle it. However, this
arrangement incurs high overhead because of two context switch operations—the first
context switch passes control to the VM OS, and the second passes control to the
correct guest OS. Hence the VM OS may use an arrangement in which the guest OS in
operation would be invoked directly by interrupts arising in its own domain.
Operation of an OS Structure of an operating system Operating systems with monolithic structure
The absence of a software layer between the host machine and guest OS ensures efficient
use of the host machine.
A guest OS remains in control of the host machine until the VM OS decides to switch to
another virtual machine, which typically happens in response to an interrupt. The VM OS
can employ the timer to implement time-slicing and round-robin scheduling of guest OSs.
A somewhat complex arrangement is needed to handle interrupts that arise when a guest
OS is in operation. Some of the interrupts would arise in its own domain, e.g., an I/O
interrupt from a device included in its own virtual machine, while others would arise in
the domains of other guest OSs.
Operation of an O.S Structure of an operating system Operating systems with monolithic structure
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Prepared by Prof. Anand H. D., Dept. of ECE, Dr. AIT, Bengaluru-56 26
Operating System: Structure of the Operating System
Layered design of an operating system Virtual machine operating systems
It is implemented as follows:
• While passing control to a guest operating system, the VM OS replaces its own interrupt
vectors by those defined in the guest OS. This action ensures that an interrupt would switch
the CPU to an interrupt servicing routine of the guest OS.
Operation of an OS Structure of an operating system Operating systems with monolithic structure
If the guest OS finds that the interrupt did not occur in its own domain, it passes control to
the VM OS by making a special system call “invoke VM OS.”
The VM OS now arranges to pass the interrupt to the appropriate guest OS.
• When a large number of virtual machines exists, interrupt processing can cause
excessive shuffling between virtual machines, hence the VM OS may not immediately
activate the guest OS in whose domain an interrupt occurred
• It may simply note occurrence of interrupts that occurred in the domain of a guest OS
and provide this information to the guest OS the next time it is “scheduled.”
Operation of an O.S Structure of an operating system Operating systems with monolithic structure
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Prepared by Prof. Anand H. D., Dept. of ECE, Dr. AIT, Bengaluru-56 27
Operating System: Structure of the Operating System
Layered design of an operating system Virtual machine operating systems
Figure shows three of the guest OSs supported by VM/370.
Operation of an OS Structure of an operating system Operating systems with monolithic structure
The Conversational Monitor System(CMS) is a single-user
operating system, while the OS/370 and DOS/370 are
multiprogramming operating systems.
A user process is unaware of the presence of the
VM/370—it sees only the guest OS that it uses. To
prevent interference between the guest OSs, the CPU is
put in the user mode while executing a guest OS.
Initiation of I/O operations, which involves use of
privileged instructions, is handled as follows:
• When the kernel of a guest OS executes an I/O instruction, it appears as an attempt to
execute a privileged instruction while the CPU is in the user mode, so it causes a program
interrupt.
• The interrupt is directed to the VM/370 rather than to the guest OS. The VM/370 now
initiates the I/O operation by executing the I/O instruction that had caused the interrupt.
Figure: Virtual machine
operating system VM/370.
Operation of an O.S Structure of an operating system Operating systems with monolithic structure
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Prepared by Prof. Anand H. D., Dept. of ECE, Dr. AIT, Bengaluru-56 28
Operating System: Structure of the Operating System
Layered design of an operating system Virtual machine operating systems
Operation of an OS Structure of an operating system Operating systems with monolithic structure
The Intel 80x86 family of computers has a feature that provides a way out of this difficulty.
The 80x86 computers support four execution modes of the CPU. Hence the host OS can run
with the CPU in the kernel mode, a guest OS can execute processes running under it with the
CPU in the user mode but can itself run with the CPU in one of the intermediate modes.
Distinction between kernel and user modes of the CPU causes some difficulties in the use of
a VM OS. The VM OS must protect itself from guest OSs, so it must run guest OSs with the
CPU in the user mode.
• However, this way both a guest OS and user processes under it run in the user mode,
which makes the guest OS vulnerable to corruption by a user process.
Virtualization is the process of mapping the interfaces and resources of a virtual machine
into the interfaces and resources of the host machine.
• Full virtualization would imply that the host machine and a virtual machine have identical
capabilities, hence an OS can operate identically while running on a bare machine and on a
virtual machine supported by a VM OS.
• However, full virtualization may weaken security.
Operation of an O.S Structure of an operating system Operating systems with monolithic structure
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Prepared by Prof. Anand H. D., Dept. of ECE, Dr. AIT, Bengaluru-56 29
Operating System: Structure of the Operating System
Layered design of an operating system Virtual machine operating systems
Operation of an OS Structure of an operating system Operating systems with monolithic structure
Modern virtual machine environments employ the technique of paravirtualization to
overcome the problems faced in full virtualization. Paravirtualization replaces a
nonvirtualizable instruction, i.e., an instruction that cannot be made available in a VM, by
easily virtualized instructions.
In Example, we saw how VM/370 lets a guest OS execute a privileged instruction, but its
execution causes an interrupt and VM/370 itself executes the instruction on behalf of the
guest OS.
• This arrangement is insecure because VM/370 cannot determine whether use of the
privileged instruction is legitimate—it would be legitimate if a guest OS used it, but illegitimate
if a user process used it.
For example, the security issue in VM/370 could be resolved through paravirtualization as
follows: The privileged instructions would not be included in a virtual machine. Instead, the
virtual machine would provide a special instruction for use by a guest OS that wished to
execute a privileged instruction.
Operation of an O.S Structure of an operating system Operating systems with monolithic structure
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Prepared by Prof. Anand H. D., Dept. of ECE, Dr. AIT, Bengaluru-56 30
Operating System: Structure of the Operating System
Layered design of an operating system Virtual machine operating systems
Operation of an OS Structure of an operating system Operating systems with monolithic structure
The special instruction would cause a software interrupt and pass information about the
privileged instruction the guest OS wished to execute to the VM OS, and the VM OS would
execute the privileged instruction on behalf of the guest OS.
• The host OS, guest OS, and user processes would use different execution modes of the
CPU so that the host OS would know whether the special instruction in the virtual machine
was used by a guest OS or by a user process—the latter usage would be considered illegal.
Paravirtualization has also been used to enhance performance of a host OS.
• The kernel of an guest OS typically puts the CPU into an idle loop when none of the user
processes in the OS wishes to use the CPU.
• However, CPU time of the host machine would be wasted when a guest OS enters into an
idle loop.
• Hence paravirtualization could be employed to provide a special instruction in the virtual
machine to notify this condition to the host OS, so that the host OS could take away the CPU
from the guest OS for a specified period of time.
Operation of an O.S Structure of an operating system Operating systems with monolithic structure
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Prepared by Prof. Anand H. D., Dept. of ECE, Dr. AIT, Bengaluru-56 31
Operating System: Structure of the Operating System
Layered design of an operating system Virtual machine operating systems
Operation of an OS Structure of an operating system Operating systems with monolithic structure
• To provide disaster management capabilities by transferring a virtual machine from a server
that has to shut down because of an emergency to another server available on the network.
• To use an existing server for a new application that requires use of a different operating
system. This is called workload consolidation; it reduces the hardware and operational cost
of computing by reducing the number of servers needed in an organization.
Virtual machines are employed for diverse purposes:
• To provide security and reliability for applications that use the same host and the same
OS. This benefit arises from the fact that virtual machines of different applications cannot
access each other’s resources.
• To test a modified OS (or a new version of application code) on a server concurrently with
production runs of that OS.
Operation of an O.S Structure of an operating system Operating systems with monolithic structure
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Prepared by Prof. Anand H. D., Dept. of ECE, Dr. AIT, Bengaluru-56 32
Operating System: Structure of the Operating System
Layered design of an operating system Virtual machine operating systems
Operation of an OS Structure of an operating system Operating systems with monolithic structure
A VM OS is large, complex and expensive. To make the benefits of virtual machines
available widely at a lower cost, virtual machines are also used without a VM OS.
Two such arrangements are described in the following:
1. Virtual Machine Monitors (VMMs):
• A VMM, also called a hypervisor, is a software layer that operates on top of a host OS. It
virtualizes the resources of the host computer and supports concurrent operation of many
virtual machines.
• When a guest OS is run in each virtual machine provided by a VMM, the host OS and
the VMM together provide a capability that is equivalent of a VM OS.
• VMware and XEN are two VMMs that aim at implementing hundreds of guest OSs on a
host computer while ensuring that a guest OS suffers only a marginal performance
degradation when compared to its implementation on a bare machine.
Operation of an O.S Structure of an operating system Operating systems with monolithic structure
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Prepared by Prof. Anand H. D., Dept. of ECE, Dr. AIT, Bengaluru-56 33
Operating System: Structure of the Operating System
Layered design of an operating system Virtual machine operating systems
Operation of an OS Structure of an operating system Operating systems with monolithic structure
2. Programming Language Virtual Machines:
• Programming languages have used virtual machines to obtain some of the benefits
discussed earlier. In the 1970s, the Pascal programming language employed a virtual machine
to provide portability.
• This feature facilitated widespread use of Pascal in the 1970s. However, use of the VM
incurred a substantial performance penalty due to the semantic gap between P-code
instructions and instructions in the host computer.
• A compiler converted a Pascal program into a sequence of P-code instructions, and these
could be executed on any computer that had a P-code interpreter. The virtual machine
had a small number of instructions, so the interpreter was compact and easily portable.
• The virtual machine had instructions called P-code instructions that were well suited to
execution of Pascal programs. It was implemented in the software in the form of an
interpreter for P-code instructions.
Operation of an O.S Structure of an operating system Operating systems with monolithic structure
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Prepared by Prof. Anand H. D., Dept. of ECE, Dr. AIT, Bengaluru-56 34
Layered design of an operating system Virtual machine operating systems
Operation of an OS Structure of an operating system Operating systems with monolithic structure
• The Java programming language employs a virtual machine to provide security and
reliability. A Java program consists of objects, whose structure and behavior is specified in
classes.
• The performance penalty implicit in use of the virtual machine can be offset by
implementing the JVM in the hardware.
• The application would be aborted if a class file fails any of these checks. If several Java
applications run on the same host, each of them would execute in its own virtual machine,
hence their operation cannot cause mutual interference.
• The loader fetches the bytecode form of the class, either from a library or from the Internet,
and verifies that the class conforms to the security and reliability standards—that it has a
valid digital signature, and does not use features such as pointer arithmetic.
• Each class is compiled into a bytecode form, where the bytecode is a sequence of
instructions for the Java virtual machine (JVM). During execution of an application coded in
Java, the class loader is activated whenever an object of a new class is encountered.
Operation of an O.S Structure of an operating system Operating systems with monolithic structure
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Prepared by Prof. Anand H. D., Dept. of ECE, Dr. AIT, Bengaluru-56 35
Operating System: Structure of the Operating System
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Figure is an abstract view of a kernel-based OS.
The kernel is the core of the OS; it provides a set of functions and services to support
various OS functionalities.
The rest of the OS is organized as a set of nonkernel routines, which implement operations
on processes and resources that are of interest to users, and a user interface.
Operation of an OS Structure of an operating system Operating systems with monolithic structure
The kernel gets control when an interrupt such as a
timer interrupt or an I/O completion interrupt notifies
occurrence of an event to it, or when the software-
interrupt instruction is executed to make a system
call.
• When the interrupt occurs, an interrupt servicing
routine performs the context save function and
invokes an appropriate event handler, which is a
nonkernel routine of the OS. Figure : Structure of a kernel-based OS.
Operation of an O.S Structure of an operating system Operating systems with monolithic structure
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Prepared by Prof. Anand H. D., Dept. of ECE, Dr. AIT, Bengaluru-56 36
Operating System: Structure of the Operating System
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Operation of an OS Structure of an operating system Operating systems with monolithic structure
A system call may be made by the user interface to implement a user command, by a
process to invoke a service in the kernel, or by a nonkernel routine to invoke a function of
the kernel.
• For example, when a user issues a command to execute the program stored in some file,
say file alpha, the user interface makes a system call, and the interrupt servicing routine
invokes a nonkernel routine to set up execution of the program.
• The nonkernel routine would make system calls to allocate memory for the program’s
execution, open file alpha, and load its contents into the allocated memory area, followed by
another system call to initiate operation of the process that represents execution of the
program.
• If a process wishes to create a child process to execute the program in file alpha, it, too,
would make a system call and identical actions would follow.
The historical motivations for the kernel-based OS structure were portability of the OS and
convenience in the design and coding of nonkernel routines.
Operation of an O.S Structure of an operating system Operating systems with monolithic structure
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Prepared by Prof. Anand H. D., Dept. of ECE, Dr. AIT, Bengaluru-56 37
Operating System: Structure of the Operating System
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Operation of an OS Structure of an operating system Operating systems with monolithic structure
Portability of the OS is achieved by putting architecture-dependent parts of OS code—which
typically consist of mechanisms—in the kernel and keeping architecture independent parts
of code outside it, so that the porting effort is limited only to porting of the kernel.
The kernel is typically monolithic to ensure efficiency; the nonkernel part of an OS may be
monolithic, or it may be further structured into layers.
Table contains a sample list of functions and services offered by the kernel to support various
OS functionalities.
Table: Typical Functions and Services Offered by the Kernel
Operation of an O.S Structure of an operating system Operating systems with monolithic structure
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Prepared by Prof. Anand H. D., Dept. of ECE, Dr. AIT, Bengaluru-56 38
Operating System: Structure of the Operating System
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Operation of an OS Structure of an operating system Operating systems with monolithic structure
These functions and services provide a set of abstractions to the nonkernel routines; their
use simplifies design and coding of nonkernel routines by reducing the semantic gap faced by
them.
For example, the I/O functions of Table collectively implement the abstraction of virtual
devices.
A process is another abstraction provided by the kernel.
A kernel-based design may suffer from stratification analogous to the layered OS design
because the code to implement an OS command may contain an architecture-dependent
part, which is typically a mechanism that would be included in the kernel, and an
architecture-independent part, which is typically the implementation of a policy that would
be kept outside the kernel.
These parts would have to communicate with one another through system calls, which
would add to OS overhead because of interrupt servicing actions.
Operation of an O.S Structure of an operating system Operating systems with monolithic structure
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Prepared by Prof. Anand H. D., Dept. of ECE, Dr. AIT, Bengaluru-56 39
Operating System: Structure of the Operating System
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Operation of an OS Structure of an operating system Operating systems with monolithic structure
Consider the command to initiate execution of the program in a file named alpha.
• As discussed earlier, the nonkernel routine that implements the command
would make four system calls to allocate memory, open file alpha, load the program
contained in it into memory, and initiate its execution, which would incur considerable
overhead.
• Some operating system designs reduce OS overhead by including the architecture
independent part of a function’s code also in the kernel.
Thus, the nonkernel routine that initiated execution of a program would become a part of
the kernel.
• Other such examples are process scheduling policies, I/O scheduling policies of device
drivers, and memory management policies. These inclusions reduce OS overhead; however,
they also reduce portability of the OS.
• Kernel-based operating systems have poor extensibility because addition of a new
functionality to the OS may require changes in the functions and services offered by the
kernel.
Operation of an O.S Structure of an operating system Operating systems with monolithic structure
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Prepared by Prof. Anand H. D., Dept. of ECE, Dr. AIT, Bengaluru-56 40
Operating System: Structure of the Operating System
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Operation of an OS Structure of an operating system Operating systems with monolithic structure
The structure of kernel-based operating systems evolved to offset some of its drawbacks.
Two steps in this evolution were dynamically loadable kernel modules and
user-level device drivers.
Evolution of Kernel-Based Structure of Operating Systems
To provide dynamically loadable kernel modules, the kernel is designed as a set of
modules that interact among themselves through well-specified interfaces.
• A base kernel consisting of a core set of modules is loaded when the system is booted.
• Other modules, which conform to interfaces of the base kernel, are loaded when their
functionalities are needed, and are removed from memory when they are no longer needed.
• Use of loadable modules conserves memory during OS operation because only required
modules of the kernel are in memory at any time.
• It also provides extensibility, as kernel modules can be modified separately and new
modules can be added to the kernel easily.
Operation of an O.S Structure of an operating system Operating systems with monolithic structure
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Prepared by Prof. Anand H. D., Dept. of ECE, Dr. AIT, Bengaluru-56 41
Operating System: Structure of the Operating System
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Operation of an OS Structure of an operating system Operating systems with monolithic structure
• Use of loadable kernel modules has a few drawbacks too.
• Loading and removal of modules fragments memory, so the kernel has to perform memory
management actions to reduce its memory requirement. A buggy module can also crash a
system.
• Loadable kernel modules are used to implement device drivers for new I/O devices,
network adapters, or new file systems, which are simply device drivers in many operating
systems; and to add new system calls to the kernel.
• The Linux and Solaris systems have incorporated support for dynamically loadable kernel
modules
Operation of an O.S Structure of an operating system Operating systems with monolithic structure
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Prepared by Prof. Anand H. D., Dept. of ECE, Dr. AIT, Bengaluru-56 42
Operating System: Structure of the Operating System
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Operation of an OS Structure of an operating system Operating systems with monolithic structure
Dynamic loading of device drivers enhances both these aspects; however, it is not adequate
because a device driver would operate with the privileges of the kernel, so a buggy device
driver could disrupt operation of the OS and cause frequent boot-ups.
A device driver handles a specific class of I/O devices.
Device drivers constitute the most dynamically changing part of an OS as a result of rapid
changes in the I/O device interfaces, hence the ease with which they could be tested and
added to an OS would determine the reliability and extensibility of the OS.
Enabling a device driver to operate in the user mode would overcome this difficulty. Such a
device driver is called a user-level device driver.
User-level device drivers provide ease of development, debugging, and deployment and
robustness, since both the code of the kernel and its operation are unaffected by presence
of the user-level driver.
Operation of an O.S Structure of an operating system Operating systems with monolithic structure
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Prepared by Prof. Anand H. D., Dept. of ECE, Dr. AIT, Bengaluru-56 43
Operating System: Structure of the Operating System
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Operation of an OS Structure of an operating system Operating systems with monolithic structure
However, they pose performance problems.
Early user-level drivers were found to cause a drop in the I/O throughput or an increase
in the CPU time consumed by I/O operations.
Both of these resulted from the large number of system calls needed to implement an I/O
operation, e.g., the device driver had to make system calls to set up and dismantle the
DMA for the I/O operation, to wake up the user process waiting for the I/O operation to
complete, and to return control to the kernel at the end of its operation.
Later hardware and software developments have overcome the performance problems
through a variety of means.
The setting up and dismantling actions have been simplified by presence of the IOMMU
unit, and system calls have been speeded up through fast system call support.
Operation of an O.S Structure of an operating system Operating systems with monolithic structure
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Prepared by Prof. Anand H. D., Dept. of ECE, Dr. AIT, Bengaluru-56 44
Operating System: Structure of the Operating System
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Operation of an OS Structure of an operating system Operating systems with monolithic structure
MICROKERNEL-BASED OPERATING SYSTEMS
Putting all architecture-dependent code of the OS into the kernel provides good
portability. However, in practice, kernels also include some architecture independent
code. This feature leads to several problems.
It leads to a large kernel size, which detracts from the goal of portability. It may also
necessitate kernel modification to incorporate new features, which causes low
extensibility.
A large kernel supports a large number of system calls. Some of these calls may be used
rarely, and so their implementations across different versions of the kernel may not be
tested thoroughly. This compromises reliability of the OS
The microkernel was developed in the early 1990s to overcome the problems
concerning portability, extensibility, and reliability of kernels.
A microkernel is an essential core of OS code, thus it contains only a subset of the
mechanisms typically included in a kernel and supports only a small number of system
calls, which are heavily tested and used.
Operation of an O.S Structure of an operating system Operating systems with monolithic structure
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Prepared by Prof. Anand H. D., Dept. of ECE, Dr. AIT, Bengaluru-56 45
Operating System: Structure of the Operating System
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Operation of an OS Structure of an operating system Operating systems with monolithic structure
This feature enhances portability and reliability of the microkernel. Less essential parts
of OS code are outside the microkernel and use its services, hence these parts could be
modified without affecting the kernel; in principle, these modifications could be made
without having to reboot the OS!
The services provided in a microkernel are not biased toward any specific features or
policies in an OS, so new functionalities and features could be added to the OS to suit
specific operating environments.
Figure illustrates the structure of a
microkernel-based OS.
The microkernel includes mechanisms
for process scheduling and memory
management, etc., but does not
include a scheduler or memory
handler.
Operation of an O.S Structure of an operating system Operating systems with monolithic structure
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Prepared by Prof. Anand H. D., Dept. of ECE, Dr. AIT, Bengaluru-56 46
Operating System: Structure of the Operating System
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Operation of an OS Structure of an operating system Operating systems with monolithic structure
These functions are implemented as servers, which are simply processes that never
terminate.
The servers and user processes operate on top of the microkernel, which merely
performs interrupt handling and provides communication between the servers and user
processes.
The small size and extensibility of microkernels are valuable properties for the
embedded systems environment, because operating systems need to be both small and
fine-tuned to the requirements of an embedded application.
Extensibility of microkernels also conjures the vision of using the same microkernel for
a wide spectrum of computer systems, from palm-held systems to large parallel and
distributed systems. This vision has been realized to some extent.
The Mach microkernel has been used to implement several different versions of Unix.
The distributed operating system Amoeba uses an identical microkernel on all
computers in a distributed system ranging from workstations to large multiprocessors.
Operation of an O.S Structure of an operating system Operating systems with monolithic structure
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Prepared by Prof. Anand H. D., Dept. of ECE, Dr. AIT, Bengaluru-56 47
Operating System: Structure of the Operating System
Layered design of an operating system Virtual machine operating systems Kernel based operating systems
Operation of an OS Structure of an operating system Operating systems with monolithic structure
Reference
1.D.M.Dhamdhare, “Operating Systems”,
Second Edition, TMH, 2008
48
Prof. Anand H. D.
M. Tech. (PhD.)
Assistant Professor,
Department of Electronics & Communication Engineering
Dr. Ambedkar Institute of Technology, Bengaluru -56
Email: [email protected]
Phone: 9844518832