0% found this document useful (0 votes)
4 views

# Operating System (CH 1)

This document provides an introduction to operating systems (OS), defining their role as system software that manages hardware resources and facilitates user applications. It outlines the objectives of an OS, including convenience, efficiency, and adaptability, and describes the structure of a computer system, which consists of hardware, OS, application programs, and users. The document also discusses various OS functions, types of computer systems, and the importance of resource management and scheduling in multiprogramming environments.

Uploaded by

fikadu.meu.edu
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

# Operating System (CH 1)

This document provides an introduction to operating systems (OS), defining their role as system software that manages hardware resources and facilitates user applications. It outlines the objectives of an OS, including convenience, efficiency, and adaptability, and describes the structure of a computer system, which consists of hardware, OS, application programs, and users. The document also discusses various OS functions, types of computer systems, and the importance of resource management and scheduling in multiprogramming environments.

Uploaded by

fikadu.meu.edu
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 71

Chapter One

Introduction to OPERATING SYSTEM


and
Its structures

Operating Systems
Introduction
 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.
 It simply provides an environment with which other programs
can do useful work.
1-2
Definition and Objectives of an Operating
System
Definition: Os is a System program that
 controls execution of programs to prevent errors and
improper use of the computer.
 acts as an interface between the hardware and its users.
Objectives:
 Convenience – Top Down View – Virtual
Machine
Extending the real hardware and acting as a Virtual Machine
Hiding the truth about the hardware from the user
Providing the user a convenient interface which is easier to
program
 Efficiency – Bottom Up View – Resource
Manager
Providing an orderly and controlled allocation of resources
Improving resource utilization
1-3 Manages all resources
Contd.
 Ability to Evolve
 Adaptability to new changes

Hardware upgrades/New types of hardware


Need of new services
 Easy fixes of latent errors Operating Systems and Computer

Architecture are historically tied because architectural changes


affect both
structure of Operating Systems
performance of Operating Systems
 Operating system goals can be summarized as:

I. Execute user programs and make solving user problems


easier.
II. Make the computer system convenient to use.
1-4 III. Use the computer hardware in an efficient manner.
Computer System Structure
 Computer system can be divided into four components

 Hardware – provides basic computing resources

 CPU, memory, I/O devices

 Operating system

 Controls and coordinates use of hardware among various applications

and users

 Application programs – define the ways in which the

system resources are used to solve the computing problems


of the users
 Word processors, compilers, web browsers, database systems, video

games

 Users
1-5  People, machines, other computers
Four Components of a Computer
System

1-6
Contd.
 A computer system can be viewed as a system consisting of

hardware, software and data.


 Os provides the means for proper use of these resources

 An Os is like a government, which does not perform any

useful function by itself. But it simply provides an


environment so that other programs can perform useful
work.
 Operating system role’s
 Two views

a. User view
 The user view of a computer system depends on the types

of interfaces being used.


1. One PC-one user:- a single user monopolizes all the
1-7 resources that a single PC has. Objective-maximizes work.
Contd.
2. Users at terminals:-a user sits at a terminal connected to a
main frame or a minicomputer. Other users can have access
to this same mainframe. Users also may exchange
information.
objective:-maximizes resource-sharing(the OS must assure
that no individual user consumes more than its fair share)
3. Users at workstations connected to networks of other
workstations
 Users have individual resources at their disposal but also
share resources such as networks and servers-file,
printers ,etc. so an OS designed for such purpose must
compromise b/n individual usability & resource utilization.
4. Handheld computers:-most are standalone & for individual
use. They might be wired/less/. OS designed for these
1-8 systems maximizes individual usability but performance per
amount of power must be an issue.
Contd.
b. System view:-from the computers point of view
 The OS is most intimately involved program with the hardware

1. The OS is a resource manager. Since it manages CPU time,


memory space, storage space ,I/O devices and so on which are
used by the computer system in solving problem. OS manages
d/t requests that may conflict with each other and assigns
them the available resources fairly.
o The OS can deallocate a resource when the program to

which it is allocated either terminates or makes an explicit


request for deallocation.
o Alternatively, it can deallocate a resource by force. This

actions is called resource preemption.


o System resources may be preempted by an OS to enforce

fairness in their use by programs, or to realize certain system-


1-9
level goals.
Contd.
o A preempted program can not execute unless the
preempted resource unit, or some resource unit of the same
resource class, is allocated to it.
 Resources can be shared by a set of programs in two

ways:
o 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.
o Concurrent sharing:- two or more programs can
concurrently use the same resource.
o The CPU can be shared only in sequential manner where as the

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


1-10
manner.
Contd.
2. OS controls program. It manages the execution of user
programs to prevent errors and improper use of the
computer. It is especially concerned with the operation
and control of I/O devices.
 The fundamental goal of a computer system is to execute

user programs and make solving user problems easier.


For this purpose computer hardware was constructed. But
bare hardware is not used for this purpose. This leads to
the development of application programs.
 Application programs have certain common operations,

such as controlling I/O devices.


 The common functions of controlling and allocating
resources are brought together into a piece of software
1-11
called OS.
Operating System Definition
 OS is a resource allocator
Manages all resources

Decides between conflicting requests for efficient and fair

resource use
 OS control programs
Controls execution of programs to prevent errors and

improper use of the computer


 “The one program running at all times on the

computer” is the kernel.

1-12
Operating System Functions
Can be summarized into two broad functions:
1. Resource Management
 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
2. User Environment monitoring:- 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
1-13
 Fault tolerance and failure recovery
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.

2. Desktops:- specialized for single-user (or limited


number of users).
o Generally has a GUI that is integral to system software

o designed to minimize response time to user requests

o May run several different types of operating systems (Windows,

MacOS, UNIX, Linux).

3. Embedded Systems:- specialized for managing a limited


number of resources such as power, memory, I/O speed.
1-14
 PDAs, cell phones, smart cards, automobiles.
Computer Startup
 bootstrap program is loaded at power-up or reboot

 Typically stored in ROM or EPROM, generally known as

firmware
 Initializes all aspects of system

 Loads operating system kernel and starts execution

Computer System Organization


Computer-system operation

 One or more CPUs, device controllers connect through

common bus providing access to shared memory


 Concurrent execution of CPUs and devices competing

1-17 for memory cycles


 Computer-System Operation
 I/O devices and the CPU can execute concurrently.
 Each device controller is in charge of a particular device type.
 Each device controller has a local buffer.
 CPU moves data from/to main memory to/from local buffers
 I/O is from the device to local buffer of controller.
 Device controller informs CPU that it has finished its operation
by causing an interrupt.
1-18
Storage Structure
Main memory:- the only large storage media that

the CPU can access directly.


Secondary storage:- extension of main memory

that provides large nonvolatile storage capacity.


Magnetic disks:- rigid metal or glass platters

covered with magnetic recording material


 Disk surface is logically divided into tracks, which are
subdivided into sectors.
 The disk controller determines the logical interaction
between the device and the computer.
1-19
Storage-Device Hierarchy

1-20
Caching
Important principle, performed at many levels in a

computer (in hardware, operating system, software)


Information in use copied from slower to faster

storage temporarily
Faster storage (cache) checked first to determine if

information is there
 If it is, information used directly from the cache (fast)

 If not, data copied to cache and used there

Cache smaller than storage being cached

 Cache management important design problem

1-21  Cache size and replacement policy


Performance of Various Levels of
Storage

Movement between levels of storage hierarchy


can be explicit or implicit

1-22
Computer system structure
A computer system can be categorized into a number

of ways based on the number of general purpose


processors used.

1. single processor systems


 most systems belongs to this category
 ranges from PDAs to main frames
 have one main CPU capable of executing a general
purpose instruction set, including instructions from user
process.
 The use of a special purpose processor does not change
1-23 a single-processor system into multiprocessor.
Contd.
2. Multiprocessor system
 also called parallel systems or tightly coupled systems
 have 2 or more general purpose processors in close
communications, sharing the computer bus and
sometimes the clock, memory and peripherals.
 Has three main advantages
a. Increased throughput
b. Economy of scale
c. Increased reliability
i. increased throughput.
 Increasing number of processors =>more work done in
less time.
 The speedup ratio of N-processors is not N. Rather it is
less than N(cause- the overhead incurred in keeping all
1-24 parts working together plus contention for shared
resources)
Contd.
ii. Economy of scale- multiprocessor systems cost less than
equivalent multiple single processor systems, because they
can share peripherals, mass storage, and power supplies .
 If several programs operates on the same set of data, it is

cheaper to store those data on one disk and to have all the
processors share them than to have many computers with
local disks and many copies of the data.
iii. Increased Reliability.
 Functions being distributed properly among several
processors, failure of one processor will not halt the system,
only slow it down.
 If 10 processors are there and if one fails, then each of the

remaining 9 processors can pickup a share of the work of the


1-25failed processor.==>the entire system runs only 10% slower,
rather than failing altogether.
Contd.
 The ability to continue providing proportional service to

the level of surviving hardware is called graceful


degradation.(Exc. Compare it with fault tolerant).
 Multiprocessors are two types
o Asymmetric multiprocessors
o Symmetric multiprocessors

A.Asymmetric multiprocessors
 Each processor is assigned a specific task. A master

processor controls the system; the other processors


either look to the master for instruction or have
predefined tasks.
 Defines a master-slave relationships

 The master processor schedules and allocates work to


1-26
the slave processors.
Contd.
B. Symmetric multiprocessors(SMP)
 Each processor performs all tasks within the operating
system.
 SMP-means all processors are peers
 benefit-many processes can run simultaneously.

clustered Systems
 is a type of multi-CPU system
 Have multiple CPUs to accomplish computational
work(like multiprocessor systems)
 They are composed of two or more individual systems
coupled together(difference with multiprocessors)
 They share storages and are closely liked via a LAN or
faster interconnect such as InfiniBand.
 Provide high availability service(service will continue
1-27 even if one or more systems in the cluster fail)
structure(cont)
 Clustering can be
a. asymmetric mode
─ One machine is in hot-stand-by mode, while
the other is running the application.
─ The HSM host machine does nothing but
actively monitors the server. If server fails,
the HSM become the active server.
b. Symmetric mode
─ Two or more hosts are running applications,
and are monitoring each other.
─ More efficient as it uses all of the available
hardware.

1-28
Operating System Structure
Multiprogramming needed for efficiency
Single user cannot keep CPU and I/O devices busy
at all times
Multiprogramming organizes jobs (code and data)
so CPU always has one to execute
A subset of total jobs in system is kept in memory
One job selected and run via job scheduling
When it has to wait (for I/O for example), OS
switches to another job.
Timesharing (multitasking) is logical
extension in which CPU switches jobs so
frequently that users can interact with each job
while it is running, creating interactive
computing
Response time should be < 1 second

1-29
OPERATING SYSTEM STRUCTURE(CONT)

Each user has at least one program executing


in memory process
If several jobs ready to run at the same time 
CPU scheduling
If processes don’t fit in memory, swapping
moves them in and out to run
Virtual memory allows execution of
processes not completely in memory
VM enables users to run programs that are
larger than actual physical memory

1-30
Memory Layout for Multiprogrammed System

Processor
switches
from one
process
to an
other
when
ever an
I/O event
Figure :-4 processes
or Timer are loaded to memory
interrupt in Multiprogramming
occurs systems
1-31
Operating System Components
All OSs have similar core components
 Shell(User level)
 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
1-32
Operating-System Operations
Modern OS are interrupt driven.
Software error or request creates exception
or trap
Division by zero or invalid memory access.
Other process problems include infinite loop,
processes modifying each other or the
operating system
Dual-mode operation allows OS to protect
itself and other system components
User mode and kernel mode
Mode bit provided by hardware
Provides ability to distinguish when system is
running user code or kernel code
Some instructions designated as privileged, only
executable in kernel mode
System call changes mode to kernel, return from
1-33 call resets it to user
 During a transition from User to Kernel Mode an infinite
loop may occur.
 To prevent infinite loop / process hogging resources a
Timer is used.how?
o Set interrupt after specific period
o Operating system decrements counter
o When counter zero generate an interrupt
o Set up before scheduling process to regain control or
terminate program that exceeds allotted time
 A computer system executing tasks on behalf of a user
applications, the system is in user mode.
 When a user application requests service from an OS(via
system call) it is in kernel mode.
 At system boot time, the hardware starts in kernel mode. Then
the OS is loaded and starts execution of user applications in a
user mode.
 System call provide the means for a user program to ask the
OS to perform tasks reserved for the OS on the user’s
1-34 programs behalf.
Operating system services

 User interface:-command line or GUI


 Program execution:-
 I/O operations
 File System Manipulations
 Communication
 Error detection
 Resource allocation
 Accounting
 Protection and Security

1-35
Operating System Services
 Below are some of the main services of the operating system that
provides helpful functions to the user.
User interface - Almost all operating systems have a
user interface (UI)
 Varies between Command-Line (CLI), Graphics User Interface (GUI),
Batch
Program execution - The system must be able to
load a program into memory and to run that program,
end execution, either normally or abnormally
(indicating error)
I/O operations - A running program may require I/O,
which may involve a file or an I/O device.

File-system manipulation - programs need to read


and write files and directories, create and delete them,
search them, list file Information, permission
management.
1-36
Operating System Services (Cont.)
 Communications – Processes may exchange
information, on the same computer or between
computers over a network
Communications may be via shared memory or
through message passing (packets moved by the OS)
 Error detection – OS needs to be constantly aware of
possible errors
An error may occur in the CPU and memory hardware,
in I/O devices, in user program
For each type of error, OS should take the appropriate
action to ensure correct and consistent computing
Debugging facilities can greatly enhance the user’s
and programmer’s abilities to efficiently use the
system
 Resource allocation - When multiple users or
multiple jobs running concurrently, resources must
be allocated Fairley to each of them
1-37
Operating System Services (Cont.)
Many types of resources - Some (such as CPU cycles,
Main memory, and file storage) may have special
allocation code, others (such as I/O devices) may
have general request and release code.
Accounting - To keep track of which users use how
much and what kinds of computer resources
Protection and security - The owners of
information stored in a multiuser or networked
computer system may want to control use of that
information, concurrent processes should not
interfere with each other
Protection involves ensuring that all access to system
resources is controlled
Security of the system from outsiders requires user
authentication, extends to defending external I/O
devices from invalid access attempts
If a system is to be protected and secure, precautions
must be instituted throughout it. A chain is only as
1-38 strong as its weakest link.
User Operating System Interface - CLI

CLI allows direct command entry


Sometimes implemented in kernel, sometimes by
systems program
Sometimes multiple flavors implemented – shells
Two approaches
Primarily fetches a command from user
and executes it
commands are just names of programs
oIn the latter, adding new features doesn’t
require shell modification

1-39
User Operating System Interface - GUI

 User-friendly desktop metaphor interface


 Usually mouse, keyboard, and monitor
 Icons represent files, programs, actions, etc
 Various mouse buttons over objects in the
interface cause various actions (provide
information, options, execute function, open
directory (known as a folder)
 Invented at Xerox PARC
 Many systems now include both CLI and GUI
interfaces
 Microsoft Windows is GUI with CLI “command”
shell
 Apple Mac OS X as “Aqua” GUI interface with UNIX
kernel underneath and shells available
 Solaris is CLI with optional GUI interfaces (Java
1-40 Desktop, KDE)
System Calls
 are ready-made functions comprises of frequently
used code(such as device controlling codes-which
may waste programmers time if programmers
write them)

 Provide an interface to allow user-level processes


to request services of the operating system.

 Typically written in a high-level language (C or C+


+), but some are written in assembly and machine
languages.

 The next slide shows the sequence of system calls


used in copying data from one file to another file.

1-41
Example of System Calls
 System call sequence to copy the contents of one file to another file.

 even simple programs make heavy use of the operating


system. But most programmers do not see this level of detail.

1-42
Example of Standard API
 Consider the ReadFile() function in the
 Win32 API—a function for reading from a file

 A description of the parameters passed to ReadFile()


 HANDLE file—the file to be read
 LPVOID buffer—a buffer where the data will be read into
and written from
 DWORD bytesToRead—the number of bytes to be read
into the buffer
 LPDWORD bytesRead—the number of bytes read during
the last read
 LPOVERLAPPED ovl—indicates if overlapped I/O is being
used
1-44
System Call Implementation
Typically, a number associated with each
system call
System-call interface maintains a table indexed
according to these numbers
The system call interface invokes intended
system call in OS kernel and returns status of
the system call and any return values
The caller need know nothing about how the
system call is implemented
Just needs to obey API and understand what OS will
do as a result call
Most details of OS interface hidden from programmer
by API
Managed by run-time support library (set of
functions built into libraries included with compiler)
1-45
API – System Call – OS
Relationship

1-46
Standard C Library Example
C program invoking printf() library call,
which calls write() system call

1-47
 Example:-to make clear how a systems call works, consider
a read system call with signature as follows.
- read(fd,&buffer,nbytes);
 A call from a C program might look like this;
- count=read(fd,&buffer,nbytes);
 System calls are performed in a number of steps: - to see
the steps consider the read system call discussed above.

1-48
System Call Parameter Passing
 Often, more information is required than simply
identity of desired system call
 Exact type and amount of information vary
according to OS and call
 Three general methods are used to pass parameters
between a running program and the operating system.
 Simplest: pass the parameters in registers
 In some cases, may be more parameters than
registers
 Parameters stored in a block, or table, in memory,
and address of block passed as a parameter in a
register
This approach taken by Linux and Solaris
 Parameters placed on stack:- parameters are
pushed onto the stack by the program and popped
off the stack by the operating system
 Block and stack methods do not limit the number or
1-49 length of parameters being passed
Parameter Passing via Table

1-50
Types of System Calls

1-51
System Programs(cont)

System programs provide a convenient


environment for program development and
execution. The can be divided into:
File manipulation
Status information
File modification
Programming language support
Program loading and execution
Communications
Application programs
Most users’ view of the operation system is
defined by system programs, not the actual
system calls
1-52
SYSTEM PROGRAMS(CONT)

 Provide a convenient environment for program


development and execution
 Some of them are simply user interfaces to system
calls; others are considerably more complex
 File management - Create, delete, copy,
rename, print, dump, list, and generally
manipulate files and directories
 Status information
 Some ask the system for info - date, time, amount of
available memory, disk space, number of users
 Others provide detailed performance, logging, and

debugging information
 Typically, these programs format and print the output to

the terminal or other output devices


 Some systems implement a registry - used to store and

1-53 retrieve configuration information


System Programs (cont’d)
 File modification
 Text editors to create and modify files
 Special commands to search contents of files
or perform transformations of the text
 Programming-language support -
Compilers, assemblers, debuggers and
interpreters sometimes provided
 Program loading and execution-
Absolute loaders, relocatable loaders,
linkage editors, and overlay-loaders,
debugging systems for higher-level and
machine language
 Communications - Provide the mechanism
for creating virtual connections among
processes, users, and computer systems
 Allow users to send messages to one
another’s screens, browse web pages, send
electronic-mail messages, log in remotely,
1-54 transfer files from one machine to another
Operating System Design and
Implementation

Design and Implementation of OS not “solvable”,


but some approaches have proven successful
Internal structure of different Operating Systems
can vary widely
Start by defining goals and specifications
Affected by choice of hardware, type of system
User goals and System 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
1-55
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.
1-56
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.

1-57
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
d.Microkernel’s and
e. modules
1-58
I. Monolithic Systems
 written to provide the most functionality in the least space
Not divided into modules
 It is a simple 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
1-59 data hiding).
MONOLITHIC SYSTEMS(CONT)

 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.
1-60
Simple Structure MONOLITHIC SYSTEMS(CONT)

MS-DOS LAYER STRUCTURE


1-61
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.
1-62
LAYERED APPROACH(CONT

 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

LAYERED OPERATING
the Netherlands by E. W. Dijkstra and his students.

SYSTEM
1-63
LAYERED APPROACH(CONT)
 The layered approach suffers from two problems:

1. The operation of a system be slowed down by the layered


structure. Each layer adds a system call overhead.
2. The second problem concerns difficulties in developing a
layered design.

UNIX
 UNIX – limited by hardware functionality, the
original Unix operating system had limited
structuring. The Unix OS consists of two
separable parts
 Systems programs
 The kernel
Consists of everything below the system-call interface
and above the physical hardware
Provides the file system, CPU scheduling, memory
management, and other operating-system functions; a
large number of functions for one level
1-64
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
1-65
virtual machine operator’s console.
Virtual Machines(cont)

 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.
 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.
1-66
System Models VIRTUAL MACHINES(CONT)

Non-virtual Machine Virtual Machine

1-67
Strengths/weakness 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. (weakness)
1-68
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.
1-69
.
MICROKERNEL SYSTEM STRUCTURE (CONT)

 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
 Detriments:
 Performance overhead of user space to kernel space
communication
1-70
V. MODULES SYSTEM STRUCTURE
Most modern operating systems implement
kernel modules
Uses object-oriented approach
Each core component is separate
Each talks to the others over known interfaces
Each is loadable as needed within the kernel
Overall, similar to layers but with more
flexible
Solaris Modular
Approach

1-71
Practice Exercises
 What are the three main purposes of an operating
system?
 State the main advantage of multiprogramming?
 What are the main differences between operating
systems for mainframe computers and personal
computers?
 In a multiprogramming and time-sharing environment,
several users share the system simultaneously. This
situation can result in various security problems.
a. What are two such problems?
b. Can we ensure the same degree of security in a time-
shared machine as we have in a dedicated machine?
Explain your answer.
 What are the differences between a trap and an
interrupt? What is the use of each function?
 Give two reasons why caches are useful. What problems
do they solve? What problems do they cause? If a cache
can be made as large as the device for which it is
caching (for
instance, a cache as large as a disk), why not make it
1-72
that large and eliminate the device?
PRACTICE EXERCISES(CONT)

What are the five major activities of an


operating system in regard to process
management?
States the functions of the OS in relation to
resource management.
Describe the three major activities of an
operating system in regard to memory
management
What is the purpose of the command
interpreter? Why is it usually separate from the
kernel?
What is the purpose of system calls? Using
system calls, write a program in either C or C+
+ that reads data from one file and copies it to
1-73 another file.
END OF CHAPTER ONE

OPERATING SYSTEM
AND ITS STRUCTURES

1-74

You might also like