Chapter 1 Introduction

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 68

Chapter One

Introduction to Operating Systems

1
Objective
At the end of this session students will be able to:
Understand the basic functions, concepts and principles of operating systems.

Computer system structure

Identify the different OS types: Mainframe (Servers), Desktop Systems, Real-time

systems, Multiprocessor Systems (Shared memory multiprocessor, Clusters and


Distributed Systems), Handheld Systems and others

Understand the operating system services and concepts

Understand system calls and their types

Explain about operating system structures and operations

Identify the different computing environments

Understand about OS generations

2
Introduction
 Without its software, a computer is basically a useless lump of metal.

 With its software, a computer can store, process, and retrieve information; play

music and videos; send e-mail, search the Internet; and engage in many other
valuable activities to earn its keep.
 Computer software can be divided roughly into two kinds:

1. System software:- which manages the operation of the computer itself.

2. Application programs:-which performs the actual work the user wants.

 The most important system program is the operating system (OS), whose job is to

control all the computer's resources and provide a base upon which the application
programs can be written.
 The OS controls and coordinates the use of the hardware among the various system

programs and application programs for a various users.


3
What is an Operating System?
 A program that acts as an intermediary between a user of a computer and the

computer hardware.
 Is a program that controls the execution of application programs.

 It controls and coordinates use of hardware among various applications and users.

 It simply provides an environment with which other programs can do useful work.

 OS performs basic tasks such as recognizing input from the keyboard, keeping track

of files and directories on the disk, sending output to the display screen and
controlling peripheral devices.
 Operating system goals:

 Execute user programs and make solving user problems easier.

 Make the computer system convenient to use.

 Use the computer hardware in an efficient manner.


4
Contd.
 It’s a resource allocator
 Decides between conflicting requests for efficient and fair resource use
 Manages resources such as:
Time management:- CPU and disk transfer scheduling
Space management:- main and secondary storage allocation
Synchronization and deadlock handling:- IPC, critical section, coordination
Accounting and status information:- resource usage tracking
 It’s a control program
 Controls the execution of programs to prevent errors and improper use of the computer
 User Environment:- OS layer transforms bare hardware machine into higher
level abstractions
Execution environment:- process management, file manipulation, interrupt
handling, I/O operations, language.
Error detection and handling
Protection and security
Fault tolerance and failure recovery
5
Contd.
The OS must support the following tasks:
1. Providing the facility to create and modify program and data using an editor.

2. Access to the compiler for translating the user program from high-level language to
machine language.

3. Providing a loader program to move the compiled program code to the computer’s
memory for execution.

4. Providing routines that handle the details of I/O programming.

 Operating system is the first layer of software loaded in to the computer working memory.
 It is a program that acts as an interface between the user, the computer software and
the hardware resources.
 It provides a software platform on top of which other program can run

 “The one program running at all times on the computer” is the kernel. Everything

else is either a system program (ships with the operating system) or an application program.
6
Operating System Functions
I. Managing Hardware :- OS interacts with hardware using drivers or BIOS.
II. Providing a user interface: the OS provides a GUI(graphical user interface) so that users will
be able to interact with the system easily.
III. Managing files: it OS manages and controls the files and folders created.
IV. Running & managing applications: The OS installs and runs all other PC software
 Applications rely on the OS for support operations
 Applications are typically tailored to a single OS
V. Security Management
VI. Coordination of communication on the network

on and
the
r dw al l
are
mp tio re epen ers

ha o
on ns late d
d Us

t
tio 1-1

ts and
ns
ap ure
OS plica

co plica o
en
t
Fig

ap
7
OS Components
 All OSs have similar core components, as highlighted in Fig. 1.2:
1. Shell
2. Kernel (core)

 The shell exposes functions to users and applications

 Piece of software that provides an interface for users using either command-

line or graphical interface


 Acts as an interface between the user and the kernel.

 Normally reside on disks and are loaded into memory when needed.

 The kernel (nucleus) interacts with hardware devices

 Allocates time & memory to programs and handles the file store &

communication in response to system calls


 Reside in memory all the time and is the hub of the OS
8
Contd.

Figure 1-2 Inside an operating system, different components perform


various functions

9
Common tasks performed by OS

1. Maintain a list of authorized users.

2. Maintain a list of all resources in the system.

3. Maintain current status of all users currently using the system (They are

called active users of the system).

4. Maintain current status of all programs being executed by active users and

ensure that they receive adequate attention of the CPU.

5. Maintain current status of all resources in the system and allocate resources

to programs when requested.

6. Handle the requests made by users and their programs.

10
Computer System Components
 Hardware:- provides basic computing

resources (CPU, memory, I/O devices).

 Operating system:- controls and


coordinates the use of the hardware
among the various application programs
for the various users.

 Applications programs:- define the


ways in which the system resources are
used to solve the computing problems of
the users (compilers, database systems,
video games, business programs).
programs

 Users (people, machines, other


computers). Figure 1-3 Abstract View of System Components
11
Resource Allocation & Related Functions of OS
 The resource allocation function performs binding of one or more resources with a

requesting program.
 It also deallocates resources from a program and allocates them to other programs.

 There are two popular strategies for resource allocation:

A. Partitioning of resource:- the OS decides a priori what resources should be

allocated to user programs.


 This approach is called static allocation because the allocation is made
before the execution of the program begins.
 It is simple to implement but it suffers from a lack of flexibility.
 In this approach, there is a resource wastage because allocation is made on
the basis of perceived need of a program rather than its actual needs.

12
Contd.
B. Pool-Based Approach:- the OS maintains a common pool of resources and

allocates from this pool whenever a program requests a resources.


 This approach is called dynamic allocation because the allocation takes
place during execution of a program.
 Dynamic allocation can lead to better utilization of resources because
resources are not wasted.
 In the partition resource allocation approach, the OS considers the number of
resources and the number of programs in the system and decides how to many
resources of each kind would be allocated to a program.

 But in case of pool-based approach, OS consults the resource table (a table


which contains the name and address of a resource unit ad its present status,
i.e. whether it is free or allocated to some program) when a program makes a request
for a resource, allocates the resource if it is free.
13
Contd.
 Resources can be shared by a set of programs in two ways:

 Sequential sharing:- a resource is allocated for exclusive use by a


program. When the resource is deallocated, it is marked as free in
the resource table so that it will be allocated to another program.
 Concurrent sharing:- two or more programs can concurrently use
the same resource.
Data file like bus time tables are concurrently shared resources.
But other resources are shared sequentially.

14
Resource Preemption.
 The OS can deallocate a resource when the program to which it is

allocated either terminates or makes an explicit request for


deallocation.
 Alternatively, it can deallocate a resource by force. This actions is

called resource preemption.


System resources may be preempted by an OS to enforce fairness in their
use by programs, or to realize certain system-level goals.
A preempted program can not execute unless the preempted resource unit,
or some resource unit of the same resource class, is allocated to it.

 The CPU can be shared only in sequential manner where as the

memory can be shared in both sequential as well as pool-based

15
manner.
Hardware Resources
 Processor: execute instructions

 Memory: store programs and data

 Input/output (I/O)controllers: transfer to and from devices

 Disk devices: long-term storage

 Other devices: conversion between internal and external data

representations

16
Resource Management Functions

 Transforming physical resources to logical resources

 Making the resources easier to use

 Multiplexing one physical resource to several logical resources

 Creating multiple, logical copies of resources

 Scheduling physical and logical resources

 Deciding who gets to use the resources

17
Types of multiplexing
1. Time multiplexing
time-sharing

scheduling a serially-

reusable resource
among several users
2. Space multiplexing
space-sharing

dividing a multiple-

use resource up
among several users

18
Time-multiplexing I/O devices

19
Examples of where you will find OSs
1. Servers (Mainframe Computers):- specialized for processing
large volumes of requests for a given service.
Generally has a large number of necessary resources.
web server, file server, print server, time-sharing systems for
interactive use, database management systems.
Reduce setup time by batching similar jobs
Automatic job sequencing – automatically transfers control from
one job to another. First rudimentary operating system.
 Resident monitor
 Initial control in monitor
 Control transfers to job
 When job completes control transfers pack to monitor

20
Contd.
2. Desktops:- specialized for single-user (or limited number of users).
Generally has a GUI that is integral to system software
Designed to minimize response time to user requests
User convenience and responsiveness.
Can adopt technology developed for larger operating system’ often
individuals have sole use of computer and do not need advanced
CPU utilization of protection features.
May run several different types of operating systems (Windows,
MacOS, UNIX, Linux), which will be implemented in Lab 1 &2.
&2

21
Contd.
3. Embedded Systems:- specialized for managing a limited number of
resources such as power, memory, I/O speed.
 Examples of Embedded Systems: PDAs, cell phones, smart cards,
automobiles.
 Issues:
 Limited memory
 Slow processors
 Small display screens.

4. Clustered (Message-passing multicomputer)Systems:- are interconnected


by a high-speed interconnection fabric.
 Each processor has its own local memory and they communicate using the
interconnect.
 May share secondary storage.
 Loosely coupled.

22
Contd.
 Clustering can be:
 Asymmetric clustering: one server runs the application while other
servers standby.
 Symmetric clustering: all N hosts are running the application.

5. Real-time Systems:- Specialized systems that must meet stringent


performance and behavior requirements.
The goal is to bound worst-case behavior
Medical devices, avionic systems, multi-media players, routers.
Were originally used to control autonomous systems such as
satellites, robots and communication systems.
RTOS is one that must react to inputs and responds to them
quickly.
23
Contd.
Often used as a control device in a dedicated application such as controlling

scientific experiments, medical imaging systems, industrial control systems, and

some display systems.

Well-defined fixed-time constraints.

Real-Time systems may be either hard or soft real-time.

1. Hard real-time:- Secondary storage limited or absent, data stored in short term

memory, or read-only memory (ROM)

 Conflicts with time-sharing systems, not supported by general-purpose operating systems.

2. Soft real-time:- Limited utility in industrial control of robotics

 Useful in applications (multimedia, virtual reality) requiring advanced operating-

system features.

24
Contd.
6. Distributed Systems:- Distribute the computation among several physical processors.
Distributed OS runs on and controls the resources of multiple machines.

DOS owns the whole network and makes it look like a virtual uniprocessor or may be virtual

multiprocessor.
Loosely coupled system – each processor has its own local memory, processors communicate

with one another through various communications lines, such as high-speed buses or
telephone lines.
lines
Advantages of distributed systems.

 Resources Sharing

 Computation speed up – load sharing

 Reliability

 Communications

25
Contd.
 Requires networking infrastructure.

 Local area networks (LAN) or Wide area networks (WAN)

 Each node is separate, standalone computer and the message


delay times over a WAN can reach 100’s of msecs.
 May be either client-server or peer-to-peer systems.

General Structure of Client-Server


26
Contd.
7. Parallel Systems:- Multiprocessor Systems (MPS) with more than on
CPU in close communication.
Tightly coupled system – processors share memory and a clock;

communication usually takes place through the shared memory.


Advantages of parallel system:

 Increased throughput

 Economical

 Increased reliability

 graceful degradation

 fail-soft systems

27
Contd.

MP may be either Symmetric or Asymmetric multiprocessing .


A.Symmetric multiprocessing (SMP)

Each processor runs and identical copy of the operating system.


Many processes can run at once without performance deterioration.
Most modern operating systems support SMP

B.Asymmetric multiprocessing

Each processor is assigned a specific task; master processor


schedules and allocated work to slave processors.
More common in extremely large systems
28
Contd.

8. Multi-programmed Batch System:- Several jobs are kept in main


memory at the same time, and the CPU is multiplexed among them.
It assumes a single processor that is being shared

It increases CPU utilization by organizing jobs so that the CPU always

has one to execute.

29
OS Features Needed for Multiprogramming
 I/O routine supplied by the system.

 Memory management – the system must allocate the memory to several jobs.

 CPU scheduling – the system must choose among several jobs ready to run.

 Allocation of devices.

30 Symmetric Multiprocessing Architecture


Contd.
9. Time-Sharing Systems–Interactive Computing:- Time-sharing systems supports
interactive users. It is also called multitasking and it is a logical extension of
multiprogramming.
The CPU is multiplexed among several jobs that are kept in memory and on disk

(the CPU is allocated to a job only if the job is in memory).


Time-sharing systems uses CPU scheduling and multiprogramming to provide an

economical interactive system of two or more users.


Here each user is given a time-slice for executing his job in round robin fashion.

Job continues until the time-slice ends.


On-line communication between the user and the system is provided; when the

operating system finishes the execution of one command, it seeks the next “control
statement” from the user’s keyboard.
On-line system must be available for users to access data and code.

31
Operating-System Operations
 Modern OS are Interrupt-driven by hardware.

If there are no processes to execute, no I/0 devices to service, and no users to whom
to respond, an operating system will sit quietly waiting for something to happen.
Events are almost always signaled by the occurrence of an interrupt or a trap
 A trap (or an Exception) is a software-generated interrupt caused either by an error(for

division by zero or invalid memory access) or by a specific request from a user program
that an operating-system service be performed.
Other process problems include infinite loop, processes modifying each other or the
operating system.
 The interrupt-driven nature of an operating system defines that system's general

structure
 A properly designed operating system must ensure that an incorrect (or malicious)

program cannot cause other program to execute incorrectly

32
Dual-Mode Operation
 In order to ensure the proper execution of the operating system, we must be able to

distinguish between the execution of operating-system code and user-defined code.


 The approach taken by most computer systems is to provide hardware support that

allows us to differentiate among various modes of execution.


 Two separate modes of operations are there namely:
1. User Mode
2. Kernel (supervisor or system or Privileged)mode

 A bit, called the mode bit is added to the hardware of the computer to indicate the

current mode: kernel (0) or user (1).


 With the mode bit it is possible to distinguish between a task that is executed on

behalf of the operating system and one that is executed on behalf of the user.
 System call changes mode to kernel, return from call resets it to user

33
Transition from User to Kernel Mode
 When the computer system is executing on behalf of a user application, the system

is in user mode. However, when a user application requests a service from the
operating system (via a system call), it must transition from user mode to kernel
mode to fulfill the request.

 At system boot time, the hardware starts in kernel mode.


 The OS is then loaded and starts user applications in user mode.
 Whenever a trap or interrupt occurs, the hardware switches from user mode to kernel mode.
 Thus, whenever the operating system gains control of the computer, it is in kernel mode.

34
 The system always switches to user mode before passing control to a user program.
Contd.
 The dual mode of operation provides us with the means for protecting the OS from errant
users-and errant users from one another by designing some of the machine instructions as
privileged instructions.
 The hardware allowed privileged instructions to be executed only in kernel mode.
 If an attempt is made to execute a privileged instruction in user mode, the hardware does not execute the
instruction but rather treats it as illegal and traps it to the operating system.

 The instruction to switch to kernel mode, I/0 control timer management and interrupt
management are examples of privileged instructions.

35
Contd.
 We must ensure that the OS maintains a control over the CPU. i.e. we can not allow a user
program to get stuck in an infinite loop or to fail to call system services and never return
control to the OS.
 To accomplish this goal we must use a timer that can be set to interrupt the computer after
specific period.
How it works?
 The OS sets the counter
 Every time the clock ticks, the counter is decremented
 When the counter reaches zero generate an interrupt
 Set up before scheduling process to regain control or terminate program that exceeds
allotted time.

36
Process Management
 A process is a program in execution. It is a unit of work within the system.

 Program is a passive entity, process is an active entity.

 Process needs resources to accomplish its task

CPU, memory, I/O, files

Initialization data

 Process termination requires reclaim of any reusable resources

 Single-threaded process has one program counter specifying location of next instruction to execute

Process executes instructions sequentially, one at a time, until completion

 Multi-threaded process has one program counter per thread

 Typically system has many processes, some user, some operating system running concurrently

on one or more CPUs.

Concurrency by multiplexing the CPUs among the processes / threads

37
Process Management Activities

 The operating system is responsible for the following activities in

connection with process management:

 Creating and deleting both user and system processes

 Suspending and resuming processes

 Providing mechanisms for process synchronization

 Providing mechanisms for process communication

 Providing mechanisms for deadlock handling

38
Memory Management
 All data in memory before and after processing

 All instructions need to be in memory in order to execute

 Memory management determines what is in memory when

 Optimizing CPU utilization and computer response to users

 Memory management activities

 Keeping track of which parts of memory are currently being used and by whom

 Deciding which processes (or parts thereof) and data to move into and out of

memory.

 Allocating and deallocating memory space as needed

39
Storage Management
 OS provides uniform, logical view of information storage

Abstracts physical properties to logical storage unit - file

Each medium is controlled by device (i.e., disk drive, tape drive)

Varying properties include access speed, capacity, data-transfer rate, access method
(sequential or random)

 File-System management

Files usually organized into directories

Access control on most systems to determine who can access what

 OS activities include

Creating and deleting files and directories

Primitives to manipulate files and directories

Mapping files onto secondary storage

Backup files onto stable (non-volatile) storage media


40
Mass-Storage Management
 Usually disks used to store data that does not fit in main memory or data that must be

kept for a “long” period of time.

 Proper management is of central importance

 Entire speed of computer operation hinges on disk subsystem and its algorithms

 OS activities

Free-space management

Storage allocation

Disk scheduling

 Some storage need not be fast

Tertiary storage includes optical storage, magnetic tape

Still must be managed

Varies between WORM (write-once, read-many-times) and RW (read-write)


41
I/O Subsystems

 One purpose of OS is to hide peculiarities of hardware devices from the user

 I/O subsystem responsible for

Memory management of I/O including buffering (storing data temporarily while

it is being transferred), caching (storing parts of data in faster storage for

performance), spooling (the overlapping of output of one job with input of other

jobs)

General device-driver interface

Drivers for specific hardware devices

42
Protection and Security

 Protection – any mechanism for controlling access of processes or users to resources defined

by the OS.

 Security – defence of the system against internal and external attacks

 Huge range, including denial-of-service, worms, viruses, identity theft, theft of service

 Systems generally first distinguish among users, to determine who can do what

 User identities (user IDs, security IDs) include name and associated number, one per user

 User ID then associated with all files, processes of that user to determine access control

 Group identifier (group ID) allows set of users to be defined and controls managed, then

also associated with each process, file

 Privilege escalation allows user to change to effective ID with more rights

43
Operating System Services
1. User Interface:- Almost all operating systems have a User Interface.
 This interface can take several forms:- Command Line Interface (CLI). Batch Interface, in
which commands and directives to control those commands are entered into files,
and those files are executed, and Graphical User Interface (GUI)

2. Program execution:- OS loads a program into memory and executes the it.

3. I/O Operations:- since user programs cannot execute I/O operations directly, the
operating system must provide some means to perform I/O.

4. File-system manipulation:- program needs to read, write, create, and delete files.

The OS gives the permission to the program for operations on file.

5. Communications- exchange of information between processes executing either on the


same computer or on different systems tied together by a network. Implemented via
shared memory or message passing.

6. Error detection:- ensure correct computing by detecting errors in the CPU and
44 memory hardware, in I/O devices, or in user programs.
System Calls
 System calls provide the interface between a running program(Process) and the operating system
kernel.
A system call instruction is an instruction that generates an interrupt that causes the OS to gain
control of the processor.
A system call is used whenever a program needs to access a restricted source. Ex. A file on hard
disk, any hardware device.
Most operations interacting with the system require permissions not available to a user level
process, or any form of communication with other processes requires the use of system calls.
Generally available as assembly-language instructions.
Languages defined to replace assembly language for systems programming allow system calls to be
made directly (e.g., C, C++).
 Three general methods are used to pass parameters between a running program and the
operating system.
1. Pass parameters in registers.
2. Store the parameters in a table in memory, and the table address is passed as a parameter in a
register.
3. Push (store) the parameters onto the stack by the program, and pop off the stack by operating
system
45
Contd.
 A System Call is the main way a user program interacts with the Operating System.

 A system call is how a program requests a service from an OS's kernel. This may

include hardware related services (e.g. accessing the hard disk), creating and executing
new processes, and communicating with integral kernel services (like scheduling).
System calls provide an essential interface between a process and the operating system.

46
System Call Types
 A system call is made using the system call machine language instruction.

 System calls can be roughly grouped into five major categories:

1. Process Management 3. File management


• Load a. create file, delete file

• Execute b. open, close


c. read, write, reposition
• Create process
d. get/set file attributes
• Terminate process
5. I/O Device Management
• Get/set process attributes
i. request device, release device
• Wait for time, wait for event, wait for signal
ii. read, write, reposition
• Allocate, free Memory
iii. get/set device attributes
2. Inter-Process Communication
iv. logically attach or detach
I. create, delete communication connection devices
II. send, receive messages 6. Information Maintenance
III. transfer status information a. get/set time or date
IV. attach or detach remote devices b. get/set system data
c. get/set process, file, or device
attributes
47
Operating System Structure

 Modern operating systems are complex and consists of different components.

 These components of modern systems are interconnected and melded to the kernel.

 five different OS structures have been tried so far.

 The five designs are:

a. monolithic systems

b. layered systems

c. virtual machines and

d. Microkernel’s

e. Modules

48
I. Monolithic Systems
 By far the most common organization, this approach might well be subtitled "The Big Mess."

 There is no well defined structure. That is, there is no structure.

 The operating system is written as a collection of procedures, each of which can call any of the

other ones whenever it needs to.

 When this technique is used, each procedure in the system has a well-defined interface in terms

of parameters and results, and each one is free to call any other one, if the latter provides some

useful computation that the former needs.

 In this approach, software is characterized by the fact that different parts of the software know

each other’s internal details and freely use this knowledge in their functioning (no data

hiding).

 Different functionalities and services of monolithically structured OS know and directly use

addresses of each other’s data.


49
Contd.

 The following are draw backs of monolithically structured OS:

 Each OS component is machine dependent, that is, each component has to

interface with the computer hardware (bare machine).

• This made OS development difficult, time consuming and expensive.

 A change made in one monolithic software component can affect its other

components. This is due to the reason that different components of the monolithic

software share each other’s data.

 Testing and debugging is difficult.

 MS-DOS is an example of such OSs.

50
MS-DOS Layer Structure

51
II. Layered Approach(Design)
 Were developed in which functions are organized hierarchically and interaction only takes

place between adjacent layers.


 The operating system is divided into a number of layers (levels), each built on top of lower

layers.
 The bottom layer (layer 0), is the hardware; the highest (layer N) is the user interface.

 With modularity, layers are selected such that each uses functions (operations) and services of

only lower-level layers.


 In layered approach, most or all of the layers execute in kernel mode.

 The basic discipline in layered OS design is that the routines of one layer use only the
facilities of the layer directly below it, that is, no layer in the structure can be bypassed.
 The OS is designed to organize the operating system as a hierarchy of layers, each one

constructed upon the one below it.


 The first system constructed in this way was the THE system built at the Technische

Hogeschool Eindhoven in the Netherlands by E. W. Dijkstra and his students.


52
Contd.
Layer Function
5 The operator
4 User programs
3 Input/output management
2 Operator-process communication
1 Memory and drum management
0 Processor allocation and
multiprogramming
 Layer 0 dealt with allocation of the processor, switching between processes when interrupts
occurred or timers expired. In other words, layer 0 provided the basic multiprogramming of the
CPU.
 Layer 1 performs the memory management. It allocates the computer’s memory to satisfy the
memory requirements of programs and uses the drum (512 word) when it runs out of memory.
 Layer 2 handled communication between each process and the operator console by allocating a
virtual console to each process.
 Layer 3 took care of managing the I/O devices and buffering the information streams to and
from them.
53
Contd.
 Layer 4 was where the user programs were found. They did not have to worry about process,
memory, console, or I/O management.
 The system operator process was located in layer 5.
 The layered approach suffers from two problems:
1. The operation of a system be slowed down by the layered structure.
2. The second problem concerns difficulties in developing a layered design.

ite yer
re
ctu
ch La
Ar S
O
54
III. Virtual Machines
 A virtual machine takes the layered approach to its logical conclusion.

 It treats hardware and the operating system kernel as though they were all hardware.

 A virtual machine provides an interface identical to the underlying bare hardware.

 The operating system creates the illusion of multiple processes, each executing on its own

processor with its own (virtual) memory.

 The resources of the physical computer are shared to create the virtual machines.

 CPU scheduling can create the appearance that users have their own processor.

 Spooling and a file system can provide virtual card readers and virtual line printers.

 A normal user time-sharing terminal serves as the virtual machine operator’s console.

 The heart of the system, known as the virtual machine monitor, runs on the bare

hardware and does the multiprogramming, providing not one, but several virtual
machines to the next layer up.
55
Contd.
 However, unlike all other operating systems, these virtual machines are not extended
machines, with files and other nice features.
 Instead, they are exact copies of the bare hardware, including kernel/user mode, I/O,
interrupts, and everything else the real machine has.
 Because each virtual machine is identical to the true hardware, each one can run any
operating system that will run directly on the bare hardware.
 Different virtual machines can, and frequently do, run different operating systems.

 Several virtual machine implementations are marketed commercially.

 VMware and Microsoft's Virtual PC are marketed for such installations. Such systems are
also useful in education. For instance, students working on Windows can work Linux OS
as using VMware host with no risk of damaging other software installed on the same PC.
 Another are a where virtual machines are used, but in a somewhat different way, is for
running Java programs (Using JVM).
 The Java compiler produces code for JVM, which then typically is executed by a
software JVM interpreter.
56
System Models

Non-virtual Machine Virtual Machine

57
Advantages/Disadvantages of Virtual Machines

 The virtual-machine concept provides complete protection of system


resources since each virtual machine is isolated from all other virtual
machines.
• This isolation, however, permits no direct sharing of resources.
 A virtual-machine system is a perfect vehicle for operating-systems
research and development.
• System development is done on the virtual machine, instead of on a
physical machine and so does not disrupt normal system operation.
 The virtual machine concept is difficult to implement due to the effort
required to provide an exact duplicate to the underlying machine.
(Disadvantage)

58
IV. Microkernel System Structure
 Microkernel is a small OS core that provides the foundation for modular
extensions.
 The main function of microkernel is to provide a communication facility
between the client program and the various services that are also running
in user space.
 At the bottom layer, running in kernel mode, is a program called the
Microkernel.
 Its job is to allocate resources to virtual machines and then check
attempts to use them to make sure no machine is trying to use somebody
else's resources.
 Each user-level virtual machine can run its own operating system, except
that each one is restricted to using only the resources it has asked for and
been allocated.
59
Contd.
 The microkernel need only keep track of which virtual machine has been
assigned which resource.
 The microkernel architecture assigns only a few essential functions to the
kernel, including address space, inter-process communication and basic
scheduling.
 The microkernel is designed to support execution of OS code which
exists outside it.
 This feature permits new features and facilities to be added to the OS to
suit specific operating environments.
Benefits:
I. easier to extend a microkernel
II. easier to port the operating system to new architectures
III.more reliable (less code is running in kernel mode)
IV.more secure
60
System Design Goals

 User goals:- operating system should be convenient to use, easy to


learn, reliable, safe, and fast.
 System goals:- operating system should be easy to design, implement,
and maintain, as well as flexible, reliable, error-free, and efficient.

Mechanisms and Policies


 Mechanisms:- determine how to do something.
 policies decide what will be done.
 The separation of policy from mechanism is a very important principle;
 It allows maximum flexibility if policy decisions are to be changed
later.

61
System Implementation

 Traditionally written in assembly language, operating systems


can now be written in higher-level languages.
 Code written in a high-level language:

can be written faster.


is more compact.
is easier to understand and debug.
 An operating system is far easier to port (move to some other
hardware) if it is written in a high-level language.

62
System Generation (SYSGEN)

 Operating systems are designed to run on any of a class of


machines; the system must be configured for each specific
computer site.
 SYSGEN program obtains information concerning the specific
configuration of the hardware system.
 Booting:- starting a computer by loading the kernel.

 Bootstrap program:- code stored in ROM that is able to locate the


kernel, load it into memory, and start its execution.

63
Computing Environments

 Traditional computer
Blurring over time
Office environment
PCs connected to a network, terminals attached to
mainframe or minicomputers providing batch and
timesharing
Now portals allowing networked and remote systems
access to same resources
Home networks
Used to be single system, then modems
Now firewalled, networked

64
Contd.
 Client-Server Computing
 Dumb terminals supplanted by smart PCs
 Many systems now servers, responding to requests generated
by clients
 Compute-server provides an interface to client to request
services (i.e. database)
 File-server provides interface for clients to store and retrieve
files

65
Peer-to-Peer Computing
 Another model of distributed system

 P2P does not distinguish clients and servers

Instead all nodes are considered peers

May each act as client, server or both

Node must join P2P network

Registers its service with central lookup service on network, or

Broadcast request for service and respond to requests for service

via discovery protocol


Examples include Napster and Gnutella

66
Web-Based Computing

 Web has become ubiquitous

 PCs most prevalent devices

 More devices becoming networked to allow web access

 New category of devices to manage web traffic among similar

servers: load balancers

 Use of operating systems like Windows 95, client-side, have evolved

into Linux and Windows XP, which can be clients and servers

67
Do we need an OS?

 Not always

Some programs run “stand-alone”

 But they are very useful

Reusable functions

Easier to use than the bare hardware

68

You might also like