Sunteți pe pagina 1din 37

Operating Systems

10EC65

Unit 2

Structure of
Operating Systems

Reference Book:
Operating Systems - A Concept based Approach
D. M. Dhamdhare, TMH, 3rd Edition, 2010
Shrishail Bhat, AITM Bhatkal
Introduction

The main concerns of an OS are management of user


computations and resources to achieve effective utilization of a
computer system.

Shrishail Bhat, AITM Bhatkal


Operation of an OS

When a computer is switched on, boot procedure


analyzes its configurationCPU type, memory size, I/O devices, and
details of other hardware
Loads part of OS in memory, initializes data structures, and hands it
control of computer system
During operation of the computer, interrupts caused by:
An event: I/O completion; end of a time slice
System call made by a process (software interrupt)
Interrupt servicing routine:
Performs context save
Activates event handler
Scheduler selects a process for servicing
Shrishail Bhat, AITM Bhatkal
Operation of an OS (continued)

Shrishail Bhat, AITM Bhatkal


Operation of an OS (continued)

The operation of an OS is interrupt-driven


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
The event handler takes appropriate actions to handle the event
The scheduler then selects a process and switches the CPU to it
Shrishail Bhat, AITM Bhatkal
Operation of an OS (continued)

Shrishail Bhat, AITM Bhatkal


User and OS Programs in
memory
The memory is divided into
two areas the system area
and the user area
Some active user processes
are situated in the memory
while some other user
processes may have been
swapped out of the
memory.

Shrishail Bhat, AITM Bhatkal


Structure of an Operating System

Policies and Mechanisms


Portability and Extensibility of Operating Systems

Shrishail Bhat, AITM Bhatkal


Policies and Mechanisms

In determining how OS will perform a function, designer needs to


think at two distinct levels:
Policy: Principle under which OS performs function
Decides what should be done
Mechanism: Action needed to implement a policy
Determines how to do it and actually does it
Example:
Round-robin scheduling is a policy
Mechanisms: maintain queue of ready processes and dispatch a process

Shrishail Bhat, AITM Bhatkal


Portability and Extensibility of Operating Systems

Porting: adapting software for use in a new computer system


Portability: ease with which a software program can be ported
Inversely proportional to the porting effort
Porting an OS: changing parts of its code that are architecture-
dependent to work with new hardware
Examples of architecture-dependent data and instructions in an OS:
Interrupt vector, memory protection information, I/O instructions, etc.

Shrishail Bhat, AITM Bhatkal


Portability and Extensibility of Operating Systems (continued)

Extensibility: ease with which new functionalities can be added


to a software system
Extensibility of an OS is needed for two purposes:
Incorporating new HW in a computer system
Typically new I/O devices or network adapters
Providing new features for new user expectations
Early OSs did not provide either kind of extensibility
Modern OSs facilitate addition of a device driver
They also provide a plug-and-play capability

Shrishail Bhat, AITM Bhatkal


Operating Systems with Monolithic Structure

Early OSs had a monolithic structure


OS formed a single software layer between the user and the bare
machine (hardware)

Shrishail Bhat, AITM Bhatkal


Operating Systems with Monolithic Structure (continued)

The OS formed a software layer between the user and the


bare machine
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

Shrishail Bhat, AITM Bhatkal


Operating Systems with Monolithic Structure (continued)

Problems with the monolithic structure:


Single OS layer had an interface with bare machine
Architecture-dependent code spread throughout OS
Poor portability
Made testing and debugging difficult
High costs of maintenance and enhancement

Alternative ways to structure an OS:


Layered structure
Kernel-based structure
Microkernel-based OS structure

Shrishail Bhat, AITM Bhatkal


Layered Design of Operating Systems

Semantic gap is reduced by:


Using a more capable machine
Simulating an extended machine in a lower layer
Shrishail Bhat, AITM Bhatkal
Layered Design of Operating Systems (continued)

The simulator is a program which 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
OS interfaces with the extended machine rather than bare machine
This results in a two-layered structure of the OS
Advantage OS functions deal with a hypothetical extended
machine whose machine instructions can perform many operations
required in an OS
Shrishail Bhat, AITM Bhatkal
Layered Design of Operating Systems (continued)

The OS layer is located on top


of the extended machine layer
The extended machine provides
operations like context save,
dispatching, swapping and I/O
initiation.

This simplifies the coding and testing of OS modules by separating


the algorithm of a function from the implementation of its
primitive operations
Shrishail Bhat, AITM Bhatkal
Layered Design of Operating Systems (continued)

An OS can have many layers


The lowest layer is the extended machine layer
Routines of one layer use only the facilities of the layer directly
below it
Through its interfaces only
No layer is bypassed
The layered structure provides good modularity
Information hiding

Shrishail Bhat, AITM Bhatkal


Example: Structure of the THE Multiprogramming System

Shrishail Bhat, AITM Bhatkal


Layered Design of Operating Systems (continued)

Problems:
System operation slowed down by layered structure
Difficulties in developing a layered design
Problem: ordering of layers that require each others services
Often solved by splitting a layer into two and putting other layers between the two
halves
Stratification of OS functionalities
Complex design
Loss of execution efficiency
Poor extensibility

Shrishail Bhat, AITM Bhatkal


Virtual Machine Operating Systems

Different classes of users need different kinds of user service


Virtual machine operating system (VM OS) creates several
virtual machines
A virtual machine (VM) is a virtual resource
Each VM is allocated to one user, who can use any OS
Guest OSs run on each VM
VM OS (host OS) runs in the real machine
schedules between guest OSs
Distinction between privileged and user modes of CPU causes
some difficulties in use of a VM OS
Shrishail Bhat, AITM Bhatkal
Virtual Machine Operating Systems (continued)

A virtual machine is a virtual resource


It has same architecture as the computer used by the VM OS,
which we call host machine
Due to identical architecture, there is no semantic gap
VM OS achieves concurrent operation of guest OSs through an
action similar to scheduling
It selects a VM and arranges to let the guest OS running its
instructions on the CPU
The VM OS may use round robin scheduling with time slicing
Shrishail Bhat, AITM Bhatkal
Example: Structure of VM/370

Shrishail Bhat, AITM Bhatkal


Virtual Machine Operating Systems (continued)

Virtualization: mapping interfaces and resources of a VM into


interfaces and resources of host machine
Full virtualization may weaken security
Paravirtualization replaces a nonvirtualizable instruction by easily
virtualized instructions
Code of a guest OS is modified to avoid use of nonvirtualizable instructions,
done by:
Porting guest OS to operate under VM OS
Or, using dynamic binary translation for kernel of a guest OS

Shrishail Bhat, AITM Bhatkal


Virtual Machine Operating Systems (continued)

VMs are employed for diverse purposes:


To use an existing server for a new application that requires use of a
different
Workload consolidation - it reduces the hardware and operational cost of
computing by reducing the number of servers needed in an organization
To provide security and reliability for applications that use the same
host and the same OS
To test a modified OS on a server concurrently with production runs
of that OS
To provide disaster management capabilities
A VM is transferred from a server that has to shutdown to another server
available on the network
Shrishail Bhat, AITM Bhatkal
Virtual Machine Operating Systems (continued)

VMs are also used without a VM OS:


Virtual Machine Monitor (VMM)
Also called a hypervisor
E.g., VMware and XEN
Programming Language Virtual Machines
Pascal in the 70s
Substantial performance penalty
Java
Java virtual machine (JVM) for security and reliability
Performance penalty can be offset by implementing JVM in hardware

Shrishail Bhat, AITM Bhatkal


Kernel-Based Operating Systems

The kernel is the core of an OS provides a set of


functions and services to support various OS
functionalities
The operation of the kernel is interrupt-driven
The architecture dependent parts of OS are put
in the kernel and architecture independent parts
are kept outside to achieve portability
Kernel-based OSs have poor extensibility

Shrishail Bhat, AITM Bhatkal


Kernel-Based Operating Systems (continued)

Shrishail Bhat, AITM Bhatkal


Evolution of Kernel-Based Structure of Operating Systems

Dynamically loadable kernel modules


Kernel designed as set of modules
Modules interact through interfaces
Base kernel loaded when system is booted
Other modules loaded when needed
Advantages
Conserves memory
Provides extensibility
Used to implement device drivers and new system calls

Shrishail Bhat, AITM Bhatkal


Evolution of Kernel-Based Structure of Operating Systems (continued)

A device driver handles a specific class of I/O devices.


Device drivers constitute the most dynamically changing part of an
OS, hence the ease with which they could be tested and added to
an OS would determine the reliability and extensibility of the OS
Dynamic loading of device drivers enhances both these aspects
User-level device drivers
Ease of development, debugging, deployment and robustness
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
Performance is improved through HW and SW means
Shrishail Bhat, AITM Bhatkal
Microkernel-Based Operating Systems

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
Contains only a subset of the mechanisms typically included in a
kernel
Supports only a small number of system calls, which are heavily
tested and used
Less essential code exists outside the kernel
Can be modified without affecting the kernel
modifications can be made without having to reboot the OS
Shrishail Bhat, AITM Bhatkal
Microkernel-Based Operating Systems (continued)

Microkernel does not include scheduler and memory handler


They execute as servers, which are simply processes that never
terminate

Shrishail Bhat, AITM Bhatkal


Microkernel-Based Operating Systems (continued)

Considerable variation exists in the services included in a


microkernel
OSs using first-generation microkernels suffered up to 50%
degradation in throughput
L4 microkernel is second-generation
Made IPC more efficient by eliminating validity/rights checking by default,
and by tuning microkernel to HW
Only 5% degradation
Exokernel merely provides efficient multiplexing of hardware
resources
Distributed resource management
Extremely fast
Shrishail Bhat, AITM Bhatkal
Microkernel-Based Operating Systems (continued)

Advantages
Small size and extensibility
Extensibility ensures that the same microkernel can be used for a wide
spectrum of computer systems, from palm-held to large parallel and
distributed systems
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
Problems
Some functionalities of kernel are split between the microkernel and an OS
implemented using the microkernel
Communication between two parts can cause communication problems
Shrishail Bhat, AITM Bhatkal
Configuring and Installing the Kernel

In 1960s and 1970s


System generation An elaborate procedure used to obtain a
kernel well-suited to the system configuration
OS Distribution A set of magnetic tapes that contained the system
generation tool and other OS code
The specifications of the computer system formed the input to the
system generation tool
The tool generated a kernel version whose data structures
contained the specifications of the system
The generated kernel was loaded on the disk.
Other parts of the OS were then copied to form a usable version of the OS
Shrishail Bhat, AITM Bhatkal
Configuring and Installing the Kernel (continued)

Today distributions are carried on CDs or accessed over the


network
A distribution contains
A kernel containing a minimal set of facilities
Modules of OS
A kernel configuration utility for adapting a kernel to the configuration
of the computer system

Shrishail Bhat, AITM Bhatkal


Configuring and Installing the Kernel (continued)

Dynamic configuration of kernel


Implemented by integrating a new module and the supervisor
through dynamic linking when the module is used for the first
time
This permits the new module to access key modules and data
structures of the kernel

Shrishail Bhat, AITM Bhatkal

S-ar putea să vă placă și