3.basic hardware elements.pdf

41
8/19/2019 3.basic hardware elements.pdf http://slidepdf.com/reader/full/3basic-hardware-elementspdf 1/41 OPERATING SYSTEM OVERVIEW

Transcript of 3.basic hardware elements.pdf

Page 1: 3.basic hardware elements.pdf

8/19/2019 3.basic hardware elements.pdf

http://slidepdf.com/reader/full/3basic-hardware-elementspdf 1/41

OPERATING SYSTEMOVERVIEW

Page 2: 3.basic hardware elements.pdf

8/19/2019 3.basic hardware elements.pdf

http://slidepdf.com/reader/full/3basic-hardware-elementspdf 2/41

Contents

 Basic hardware elements

Page 3: 3.basic hardware elements.pdf

8/19/2019 3.basic hardware elements.pdf

http://slidepdf.com/reader/full/3basic-hardware-elementspdf 3/41

!Most I/O devices

are much slower thanthe processor

Interrupts

!Interrupt request signal

!Active waiting cycle(polling)

Page 4: 3.basic hardware elements.pdf

8/19/2019 3.basic hardware elements.pdf

http://slidepdf.com/reader/full/3basic-hardware-elementspdf 4/41

! An interrupt cycle isadded to the instruction

cycle (fecth and execute).! The processor checks tosee if an interrupt hasoccured (interrupt signal)

Interrupt mechanism

Page 5: 3.basic hardware elements.pdf

8/19/2019 3.basic hardware elements.pdf

http://slidepdf.com/reader/full/3basic-hardware-elementspdf 5/41

! interrupt handler

! interrupt vector

Interrupt mechanism

Page 6: 3.basic hardware elements.pdf

8/19/2019 3.basic hardware elements.pdf

http://slidepdf.com/reader/full/3basic-hardware-elementspdf 6/41

! CPU saves PS and PC(push) into the control

stack

! CPU loads into PC andPS the corresponding

values from theinterrupt vector

Interrupt processing

Page 7: 3.basic hardware elements.pdf

8/19/2019 3.basic hardware elements.pdf

http://slidepdf.com/reader/full/3basic-hardware-elementspdf 7/41

!iret

!interrupt handler

execution

Interrupt processing

Page 8: 3.basic hardware elements.pdf

8/19/2019 3.basic hardware elements.pdf

http://slidepdf.com/reader/full/3basic-hardware-elementspdf 8/41

Interrupt enable/disablebit (PS register)

!Hardware priority

!STI (Set Interrupt)CLI (Clear Interrupt)

Interrupt mechanism

Page 9: 3.basic hardware elements.pdf

8/19/2019 3.basic hardware elements.pdf

http://slidepdf.com/reader/full/3basic-hardware-elementspdf 9/41

main

ain

memory

emory

i+1 PS inth

1OO

OO

149

15O

iret

1OOO

12OO

12O1

main

ain

memory

emory

inth

nth

progrog

interrupt

nterrupt

1

2

3

interrupt

nterrupt

vector

ector

Interrupt processing

Page 10: 3.basic hardware elements.pdf

8/19/2019 3.basic hardware elements.pdf

http://slidepdf.com/reader/full/3basic-hardware-elementspdf 10/41

PS prog

12O1

3824

PS

PC

SP

stack

main

memory

3824

39OO

CPU completes execution

of the current instruction

Interrupt processing

Page 11: 3.basic hardware elements.pdf

8/19/2019 3.basic hardware elements.pdf

http://slidepdf.com/reader/full/3basic-hardware-elementspdf 11/41

interrupt signal has beenaccepted

PS inth

1OO

3822

PS

PC

SP

stack

main

ain

memory

emory

3824

39OO

12O1

PS prog

3823

3822

Interrupt processing

Page 12: 3.basic hardware elements.pdf

8/19/2019 3.basic hardware elements.pdf

http://slidepdf.com/reader/full/3basic-hardware-elementspdf 12/41

PS inth

151

3822

PS

PC

SP

stack

main memory

ain memory

3824

39OO

12O1

PS prog

3823

3822

iret execution

Interrupt processing

Page 13: 3.basic hardware elements.pdf

8/19/2019 3.basic hardware elements.pdf

http://slidepdf.com/reader/full/3basic-hardware-elementspdf 13/41

stack

main

memory

3824

39OO

PS prog

12O1

3824

PS

PC

SP

 

iret completed

Interrupt processing

Page 14: 3.basic hardware elements.pdf

8/19/2019 3.basic hardware elements.pdf

http://slidepdf.com/reader/full/3basic-hardware-elementspdf 14/41

Page 15: 3.basic hardware elements.pdf

8/19/2019 3.basic hardware elements.pdf

http://slidepdf.com/reader/full/3basic-hardware-elementspdf 15/41

!Process Management

O.S. COMPONENTS

!Main-Memory Management

!Secondary-MemoryManagement

Page 16: 3.basic hardware elements.pdf

8/19/2019 3.basic hardware elements.pdf

http://slidepdf.com/reader/full/3basic-hardware-elementspdf 16/41

!File Management

!I/O-System Management

O.S. COMPONENTS

Page 17: 3.basic hardware elements.pdf

8/19/2019 3.basic hardware elements.pdf

http://slidepdf.com/reader/full/3basic-hardware-elementspdf 17/41

! Creating and deletingprocesses

! Suspending and resumingprocesses

! Provide mechanisms

for process interaction

Process management

Page 18: 3.basic hardware elements.pdf

8/19/2019 3.basic hardware elements.pdf

http://slidepdf.com/reader/full/3basic-hardware-elementspdf 18/41

Keeping track of which

parts of memoryare currently being usedand by whom

Main memory management

Page 19: 3.basic hardware elements.pdf

8/19/2019 3.basic hardware elements.pdf

http://slidepdf.com/reader/full/3basic-hardware-elementspdf 19/41

Deciding which processes

are to be loaded whenmemory becomes available

Main memory management

Page 20: 3.basic hardware elements.pdf

8/19/2019 3.basic hardware elements.pdf

http://slidepdf.com/reader/full/3basic-hardware-elementspdf 20/41

Allocating and

deallocating memoryspace as needed

Main memory management

Page 21: 3.basic hardware elements.pdf

8/19/2019 3.basic hardware elements.pdf

http://slidepdf.com/reader/full/3basic-hardware-elementspdf 21/41

Secondary memorymanagement

! Free space management! Storage allocation

! Disk scheduling

Page 22: 3.basic hardware elements.pdf

8/19/2019 3.basic hardware elements.pdf

http://slidepdf.com/reader/full/3basic-hardware-elementspdf 22/41

I/O SYSTEM MANAGEMENT

The I/O subsystemconsists of

! A memory-managementcomponent that includesbuffering and spooling

Page 23: 3.basic hardware elements.pdf

8/19/2019 3.basic hardware elements.pdf

http://slidepdf.com/reader/full/3basic-hardware-elementspdf 23/41

! A general device driverinterface

! Drivers for specific

hardware devices

I/O SYSTEM MANAGEMENT

The I/O subsystemconsists of

Page 24: 3.basic hardware elements.pdf

8/19/2019 3.basic hardware elements.pdf

http://slidepdf.com/reader/full/3basic-hardware-elementspdf 24/41

File management

! Creating and deleting

files and directories! Supporting primitives

for manipulating fileand directory

Page 25: 3.basic hardware elements.pdf

8/19/2019 3.basic hardware elements.pdf

http://slidepdf.com/reader/full/3basic-hardware-elementspdf 25/41

! Mapping files

onto storage! Backing up files

on stable storage media

File management

Page 26: 3.basic hardware elements.pdf

8/19/2019 3.basic hardware elements.pdf

http://slidepdf.com/reader/full/3basic-hardware-elementspdf 26/41

Protection systems

! Mechanism for

controlling the accessof processes to systemresources

Page 27: 3.basic hardware elements.pdf

8/19/2019 3.basic hardware elements.pdf

http://slidepdf.com/reader/full/3basic-hardware-elementspdf 27/41

! The mechanism must

provide means forspecifying the controlsto be imposed and meansfor enforcement

Protection systems

Page 28: 3.basic hardware elements.pdf

8/19/2019 3.basic hardware elements.pdf

http://slidepdf.com/reader/full/3basic-hardware-elementspdf 28/41

! The interface betweenusers and O.S.

! A program that readsand interpretes controlstatements

Comand-Interpreter System

Page 29: 3.basic hardware elements.pdf

8/19/2019 3.basic hardware elements.pdf

http://slidepdf.com/reader/full/3basic-hardware-elementspdf 29/41

! Its main function: to get

next command statementand execute it (shell)

Comand-Interpreter System

Page 30: 3.basic hardware elements.pdf

8/19/2019 3.basic hardware elements.pdf

http://slidepdf.com/reader/full/3basic-hardware-elementspdf 30/41

System calls

Contents

Page 31: 3.basic hardware elements.pdf

8/19/2019 3.basic hardware elements.pdf

http://slidepdf.com/reader/full/3basic-hardware-elementspdf 31/41

Processes communicate

with the O.S. and requestservices to it by makingsystem calls

System Calls

Page 32: 3.basic hardware elements.pdf

8/19/2019 3.basic hardware elements.pdf

http://slidepdf.com/reader/full/3basic-hardware-elementspdf 32/41

System calls provide

the interface between anyprocess and O.S.

System Calls

Page 33: 3.basic hardware elements.pdf

8/19/2019 3.basic hardware elements.pdf

http://slidepdf.com/reader/full/3basic-hardware-elementspdf 33/41

!Process control

Examples of System Call

!Communications

!Information management

!Device

manipulation

!File manipulation

Page 34: 3.basic hardware elements.pdf

8/19/2019 3.basic hardware elements.pdf

http://slidepdf.com/reader/full/3basic-hardware-elementspdf 34/41

Corresponding to

each system call

there is a library procedure

Page 35: 3.basic hardware elements.pdf

8/19/2019 3.basic hardware elements.pdf

http://slidepdf.com/reader/full/3basic-hardware-elementspdf 35/41

count= read file, buffer,

nbytes)

count returns the number of bytes

actually read

C program

Example:xample: readead system callystem call

Page 36: 3.basic hardware elements.pdf

8/19/2019 3.basic hardware elements.pdf

http://slidepdf.com/reader/full/3basic-hardware-elementspdf 36/41

Library read

ibrary read

procedurerocedure

operating

perating

systemystem

system call

READ

INT

NT

return

eturn

from INT

rom INT

register x

x call

parameters

load x

system call

READ

2

3

1

Page 37: 3.basic hardware elements.pdf

8/19/2019 3.basic hardware elements.pdf

http://slidepdf.com/reader/full/3basic-hardware-elementspdf 37/41

" Puts the parameters of the

system call in machine

registers

The library procedure

he library procedure

" The control is returned to

the caller by returning the

status code as a result

" Issues a INT  instruction to

start the O.S.

Page 38: 3.basic hardware elements.pdf

8/19/2019 3.basic hardware elements.pdf

http://slidepdf.com/reader/full/3basic-hardware-elementspdf 38/41

" directly via registers

" in a memory block whose

address is passed as a

parameter in a registry

" into the stack push, pop)

Methods to pass parameters to

operating system

Page 39: 3.basic hardware elements.pdf

8/19/2019 3.basic hardware elements.pdf

http://slidepdf.com/reader/full/3basic-hardware-elementspdf 39/41

hardware

 CPU, memory, disks, terminals, …)

UNIX O.S.

 process management, memory

management, file system, I/O, ...)

standard library

 open, close, read, write, ..)

utility programs

 shell, compiler, …)

users

user

mode

kernel

mode

user

int.

library

interface

system

call

interf.

Page 40: 3.basic hardware elements.pdf

8/19/2019 3.basic hardware elements.pdf

http://slidepdf.com/reader/full/3basic-hardware-elementspdf 40/41

Dual mode of operations

user mode

" Hardware control does not

allow the execution of

privileged  instructions

" Used for normal execution of

user programs

Page 41: 3.basic hardware elements.pdf

8/19/2019 3.basic hardware elements.pdf

http://slidepdf.com/reader/full/3basic-hardware-elementspdf 41/41

"" Used for the execution of

sed for the execution of

O.S. functions as required

.S. functions as required

by system calls

y system calls

supervisor mode kernel mode)

"" All instructions can be

ll instructions can be

executedxecuted

Dual mode of operations