You are on page 1of 43

OS.

2: Introduction
OS.2: Introduction
1.2
Silberschatz, Galvin and Gagne 2005
Operating Sste! "rinciples
OS.2: Introduction
OS.2: Introduction
Objectives:

To provide a grand tour of the major


operating systems components

To provide coverage of basic computer


system organization
1.#
Silberschatz, Galvin and Gagne 2005
Operating Sste! "rinciples
OS.2: Introduction
OS.2: Introduction
A. Operating System
B. Computer System Organization
C. Operating System Structure
D. Operating System Operations
. !rocess "anagement
#. "emory "anagement
$. Storage "anagement
%. !rotection and Security
1.$
Silberschatz, Galvin and Gagne 2005
Operating Sste! "rinciples
%.
%.
Operating Sste!
Operating Sste!

A soft&are that manages system


resources to provide services that a''o&
app'ications to e(ecute proper'y.

Operating system goa's:

(ecute user programs and ma)e


so'ving user prob'ems easier.

"a)e the computer system convenient


to use.

*se the computer hard&are in an


efficient manner.
1.5
Silberschatz, Galvin and Gagne 2005
Operating Sste! "rinciples
Operating Sste! &e'inition:
Operating Sste! &e'inition:

OS is a resource allocator

"anages a'' resources

Decides bet&een conf'icting re+uests


for efficient and fair resource use

OS is a control progra!

Contro's e(ecution of programs to


prevent errors and improper use of the
computer
1.(
Silberschatz, Galvin and Gagne 2005
Operating Sste! "rinciples

,o universa''y accepted definition

-verything a vendor ships &hen you


order an operating system. is good
appro(imation

But varies &i'd'y

The )ernel is the core of OS running at a''


times on the computer. verything e'se is
either a system program or an app'ication
program
1.*
Silberschatz, Galvin and Gagne 2005
Operating Sste! "rinciples
+o!ponents o' a +o!puter Sste!:
+o!ponents o' a +o!puter Sste!:

Components:
/.%ard&are 0 provides basic computing
resources

C!*1 memory1 23O devices


4.Operating system

Contro's and coordinates use of


hard&are among various app'ications
and users
1.,
Silberschatz, Galvin and Gagne 2005
Operating Sste! "rinciples
5. App'ication programs 0 define the &ays in
&hich the system resources are used to
so've the computing prob'ems of the users

6ord processors1 compi'ers1 &eb


bro&sers1 database systems1 video
games
7. *sers

!eop'e1 machines1 other computers


1.-
Silberschatz, Galvin and Gagne 2005
Operating Sste! "rinciples
.our +o!ponents o' a +o!puter Sste!
.our +o!ponents o' a +o!puter Sste!
1.10
Silberschatz, Galvin and Gagne 2005
Operating Sste! "rinciples
/.
/.
+o!puter Sste! Organization
+o!puter Sste! Organization
1.11
Silberschatz, Galvin and Gagne 2005
Operating Sste! "rinciples
+o!puter0Sste! Operation:
+o!puter0Sste! Operation:

One or more C!*s1 device contro''ers


connect through common bus providing
access to shared memory

23O devices and the C!* can e(ecute


concurrent'y competing for memory cyc'es

ach device contro''er is in charge of a


particu'ar device type.

ach device contro''er has a 'oca' buffer.


1.12
Silberschatz, Galvin and Gagne 2005
Operating Sste! "rinciples

C!* moves data from3to main memory


to3from 'oca' buffers

23O is from the device to 'oca' buffer of


contro''er.

Device contro''er informs C!* that it has


finished its operation by causing an
interrupt.
1.1#
Silberschatz, Galvin and Gagne 2005
Operating Sste! "rinciples
+o!!on .unctions o' Interrupts:
+o!!on .unctions o' Interrupts:
/. 2nterrupt transfers contro' to the interrupt
service routine genera''y1 through the
interrupt vector1 &hich contains the
addresses of a'' the service routines.
4. 2nterrupt architecture saves the address of
the interrupted instruction.
5. 2ncoming interrupts are disabled &hi'e
another interrupt is being processed to
prevent a lost interrupt.
1.1$
Silberschatz, Galvin and Gagne 2005
Operating Sste! "rinciples

A trap is a soft&are8generated interrupt


caused either by an error or a user re+uest.

An operating system is interrupt driven.


1.15
Silberschatz, Galvin and Gagne 2005
Operating Sste! "rinciples
Interrupt 1i!eline
Interrupt 1i!eline
1.1(
Silberschatz, Galvin and Gagne 2005
Operating Sste! "rinciples
+o!puter Startup:
+o!puter Startup:
/. Bootstrap program 9stored in :O" or
!:O"; is 'oaded at po&er8up or reboot
and initia'izes the system.
4. Bootstrap 'oads the )erne' from boot sector
to :A".
5. <erne' e(ecutes the first process init9 ; and
&aits for an event to occur signa'ed by an
interrupt.
1.1*
Silberschatz, Galvin and Gagne 2005
Operating Sste! "rinciples
/. OS has a device driver for each device
contro''er. The device driver 'oads the
device contro''er registers.
4. Device contro''er reads the registers.
5. Device contro''er transfer data from device
to 'oca' buffer.
7. Device contro''er sends interrupt to device
driver.
=. Device driver returns contro' to the OS
I2O Operations:
I2O Operations:
1.1,
Silberschatz, Galvin and Gagne 2005
Operating Sste! "rinciples
&irect 3e!or %ccess Structure:
&irect 3e!or %ccess Structure:

*sed for high8speed 23O devices ab'e to


transmit information at c'ose to memory
speeds.

Device contro''er transfers b'oc)s of data


from buffer storage direct'y to main
memory &ithout C!* intervention.

On'y an interrupt is generated per b'oc)1


rather than one interrupt per byte.
1.1-
Silberschatz, Galvin and Gagne 2005
Operating Sste! "rinciples
Storage Structure:
Storage Structure:

"ain memory 0 on'y 'arge storage media


that the C!* can access direct'y.

Secondary storage 0 e(tension of main


memory that provides 'arge nonvo'ati'e
storage capacity.
1.20
Silberschatz, Galvin and Gagne 2005
Operating Sste! "rinciples

"agnetic dis)s 0 rigid meta' or g'ass


p'atters covered &ith magnetic recording
materia'

Dis) surface is 'ogica''y divided into


trac)s1 &hich are subdivided into sectors.

The dis) contro''er determines the 'ogica'


interaction bet&een the device and the
computer.
1.21
Silberschatz, Galvin and Gagne 2005
Operating Sste! "rinciples
Storage 4ierarch:
Storage 4ierarch:

Storage systems organized in hierarchy.

Speed

Cost

>o'ati'ity

Caching 0 copying information into faster


storage system? main memory can be
vie&ed as a 'ast cache for secondary
storage.
1.22
Silberschatz, Galvin and Gagne 2005
Operating Sste! "rinciples
Storage0&evice 4ierarch
Storage0&evice 4ierarch
1.2#
Silberschatz, Galvin and Gagne 2005
Operating Sste! "rinciples
+.
+.
Operating Sste! Structure
Operating Sste! Structure

3ultiprogra!!ing needed for efficiency

Sing'e user cannot )eep C!* and 23O


devices busy at a'' times

"u'tiprogramming organizes jobs 9code


and data; so C!* a'&ays has one to
e(ecute

A subset of tota' jobs in system is )ept in


memory

One job se'ected and run via 5ob


scheduling

6hen it has to &ait 9for 23O for e(amp'e;1


OS s&itches to another job
1.2$
Silberschatz, Galvin and Gagne 2005
Operating Sste! "rinciples
3e!or 6aout 'or 3ultiprogra!!ed Sste!
3e!or 6aout 'or 3ultiprogra!!ed Sste!
1.25
Silberschatz, Galvin and Gagne 2005
Operating Sste! "rinciples

1i!esharing 7!ultitas)ing8 is 'ogica'


e(tension in &hich C!* s&itches jobs so
fre+uent'y that users can interact &ith each job
&hi'e it is running1 creating interactive
computing

9esponse ti!e shou'd be @ / second

ach user has at 'east one program


e(ecuting in memory 9 process 8

2f severa' jobs ready to run at the same time


9 +": scheduling 8

2f processes donAt fit in memory1 s;apping


moves them in and out to run

<irtual !e!or a''o&s e(ecution of


processes that are not comp'ete'y in the
memory
1.2(
Silberschatz, Galvin and Gagne 2005
Operating Sste! "rinciples
&.
&.
Operating0Sste! Operations
Operating0Sste! Operations

2nterrupt driven by hard&are

Soft&are error or re+uest creates


e=ception or trap

Division by zero1 re+uest for operating


system service

Other process prob'ems inc'ude infinite


'oop1 processes modifying each other or
the operating system
1.2*
Silberschatz, Galvin and Gagne 2005
Operating Sste! "rinciples

&ual0!ode operation a''o&s OS to protect


itse'f and other system components

:ser !ode and )ernel !ode

3ode bit provided by hard&are

!rovides abi'ity to distinguish &hen


system is running user code or )erne'
code

Some instructions designated as


privileged1 on'y e(ecutab'e in )erne'
mode

System ca'' changes mode to )erne'1


return from ca'' resets it to user
1.2,
Silberschatz, Galvin and Gagne 2005
Operating Sste! "rinciples
1ransition 'ro! :ser to >ernel 3ode:
1ransition 'ro! :ser to >ernel 3ode:
1.2-
Silberschatz, Galvin and Gagne 2005
Operating Sste! "rinciples
?.
?.
"rocess 3anage!ent
"rocess 3anage!ent

A process is a program in e(ecution. 2t is a


unit of &or) &ithin the system. !rogram is
a passive entity1 process is an active
entity.

!rocess needs resources to accomp'ish its


tas)

C!*1 memory1 23O1 fi'es

2nitia'ization data

!rocess termination re+uires rec'aim of


any reusab'e resources
1.#0
Silberschatz, Galvin and Gagne 2005
Operating Sste! "rinciples

Sing'e8threaded process has one progra!


counter specifying 'ocation of ne(t
instruction to e(ecute

!rocess e(ecutes instructions


se+uentia''y1 one at a time1 unti'
comp'etion

"u'ti8threaded process has one program


counter per thread

Typica''y system has many processes1


some user1 some operating system running
concurrent'y on one or more C!*s

Concurrency by mu'tip'e(ing the C!*s


among the processes 3 threads
1.#1
Silberschatz, Galvin and Gagne 2005
Operating Sste! "rinciples
"rocess 3anage!ent %ctivities:
"rocess 3anage!ent %ctivities:
The operating system is responsib'e for the
fo''o&ing activities in connection &ith
process management:

Creating and de'eting both user and system


processes

Suspending and resuming processes

!roviding mechanisms for process


synchronization

!roviding mechanisms for process


communication

!roviding mechanisms for dead'oc)


hand'ing
1.#2
Silberschatz, Galvin and Gagne 2005
Operating Sste! "rinciples
..
..
3e!or 3anage!ent
3e!or 3anage!ent

A'' data in memory before and after


processing

A'' instructions in memory in order to


e(ecute

"emory management determines &hat is


in memory &hen

Optimizing C!* uti'ization and computer


response to users
1.##
Silberschatz, Galvin and Gagne 2005
Operating Sste! "rinciples

"emory management activities

<eeping trac) of &hich parts of memory


are current'y being used and by &hom

Deciding &hich processes 9or parts


thereof; and data to move into and out
of memory

A''ocating and dea''ocating memory


space as needed
1.#$
Silberschatz, Galvin and Gagne 2005
Operating Sste! "rinciples
G.
G.
Storage 3anage!ent
Storage 3anage!ent

OS provides uniform1 'ogica' vie& of


information storage

Abstracts physica' properties to 'ogica'


storage unit 8 'ile

ach medium is contro''ed by device 9i.e.1


dis) drive1 tape drive;

>arying properties inc'ude access


speed1 capacity1 data8transfer rate1
access method 9se+uentia' or random;
1.#5
Silberschatz, Galvin and Gagne 2005
Operating Sste! "rinciples

.ile0Sste! !anage!ent:

#i'es usua''y organized into directories

Access contro' on most systems to


determine &ho can access &hat

OS activities inc'ude

Creating and de'eting fi'es and


directories

!rimitives to manipu'ate fi'es and dirs

"apping fi'es onto secondary storage

Bac)up fi'es onto stab'e 9non8vo'ati'e;


storage media
1.#(
Silberschatz, Galvin and Gagne 2005
Operating Sste! "rinciples
3ass0Storage 3anage!ent:
3ass0Storage 3anage!ent:

*sua''y dis)s used to store data that does


not fit in main memory or data that must be
)ept for a -'ong. period of time.

!roper management is of centra'


importance

ntire speed of computer operation hinges


on dis) subsystem and its a'gorithms
1.#*
Silberschatz, Galvin and Gagne 2005
Operating Sste! "rinciples

OS activities

#ree8space management

Storage a''ocation

Dis) schedu'ing

Some storage need not be fast

Tertiary storage inc'udes optica' storage1


magnetic tape

Sti'' must be managed

>aries bet&een 6O:" 9&rite8once1


read8many8times; and :6 9read8&rite;
1.#,
Silberschatz, Galvin and Gagne 2005
Operating Sste! "rinciples
+aching:
+aching:

2mportant princip'e1 performed at many


'eve's in a computer 9in hard&are1
operating system1 soft&are;

2nformation in use is copied from s'o&er to


faster storage temporari'y

#aster storage 9cache; chec)ed first to


determine if information is there

2f it is1 information is used direct'y from


the cache 9fast;

2f not1 data is copied to cache and used


there
1.#-
Silberschatz, Galvin and Gagne 2005
Operating Sste! "rinciples

Cache sma''er than storage being cached

Cache management important design


prob'em

Cache size and rep'acement po'icy


1.$0
Silberschatz, Galvin and Gagne 2005
Operating Sste! "rinciples
"er'or!ance o' <arious 6evels o' Storage
"er'or!ance o' <arious 6evels o' Storage

"ovement bet&een 'eve's of storage


hierarchy can be e(p'icit or imp'icit
1.$1
Silberschatz, Galvin and Gagne 2005
Operating Sste! "rinciples
I2O Subsste!:
I2O Subsste!:

One purpose of OS is to hide pecu'iarities


of hard&are devices from the user

23O subsystem responsib'e for

"emory management of 23O inc'uding


buffering 9storing data temporari'y &hi'e
it is being transferred;1 caching 9storing
parts of data in faster storage for
performance;1 spooling 9the over'apping
of output of one job &ith input of other
jobs;

$enera' device8driver interface

Drivers for specific hard&are devices


1.$2
Silberschatz, Galvin and Gagne 2005
Operating Sste! "rinciples
4. "rotection and Securit
4. "rotection and Securit

"rotection 0 any mechanism for


contro''ing access of processes or users to
resources defined by the OS

Securit 0 defense of the system against


interna' and e(terna' attac)s

%uge range1 inc'uding denia'8of8service1


&orms1 viruses1 identity theft1 theft of
service
1.$#
Silberschatz, Galvin and Gagne 2005
Operating Sste! "rinciples

Systems genera''y first distinguish among


users1 to determine &ho can do &hat

*ser identities 9user I&s1 security 2Ds;


inc'ude name and associated number1
one per user

*ser 2D then associated &ith a'' fi'es1


processes of that user to determine
access contro'

$roup identifier 9group I&; a''o&s set of


users to be defined and contro's
managed1 then a'so associated &ith each
process1 fi'e

"rivilege escalation a''o&s user to


change to effective 2D &ith more rights

You might also like