operating system overview. contents basic hardware elements

41
OPERATING SYSTEM OVERVIEW

Upload: allen-chapman

Post on 28-Dec-2015

221 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements

OPERATING SYSTEM

OVERVIEW

Page 2: OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements

ContentsContents

Basic hardware elements

Page 3: OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements

Most I/O devices

are much slower than

the processor

InterruptsInterrupts

Interrupt request signal

Active waiting cycle

(polling)

Page 4: OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements

An interrupt cycle is added to the

instruction cycle (fecth and execute).

The processor checks to

see if an interrupt has

occured (interrupt signal)

Interrupt mechanismInterrupt mechanism

Page 5: OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements

interrupt handler

interrupt vector

Interrupt mechanismInterrupt mechanism

Page 6: OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements

CPU saves PS and PC (push) into the

control stack

CPU saves PS and PC (push) into the

control stack

CPU loads into PC and

PS the corresponding values from the

interrupt vector

CPU loads into PC and

PS the corresponding values from the

interrupt vector

Interrupt processingInterrupt processing

Page 7: OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements

iretiret

interrupt handler

execution

interrupt handler

execution

Interrupt processingInterrupt processing

Page 8: OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements

Interrupt enable/disable bit (PS register)Interrupt enable/disable bit (PS register)

Hardware priority

Hardware priority

STI (Set Interrupt) CLI (Clear

Interrupt)

STI (Set Interrupt) CLI (Clear

Interrupt)

Interrupt mechanismInterrupt mechanism

Page 9: OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements

main memorymain memory

i+1i+1 PS inth

1OOii1OO1OO

149149

15O15O iretiret

1OOO1OOO

12OO12OO

12O112O1

main memorymain memory

inthinth

progproginterruptinterrupt

11

22

33

interrupt vectorinterrupt vector

Interrupt processing

Page 10: OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements

PS prog

12O1

3824

PSPS

PCPC

SPSP

stack

main memory

38243824

39OO39OO

CPU completes execution

of the current instruction

CPU completes execution

of the current instruction

Interrupt processing

Page 11: OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements

interrupt signal has been acceptedinterrupt signal has been accepted

PS inth

1OO

3822

PSPS

PCPC

SPSP

stack

main memorymain memory

38243824

39OO39OO

12O1

PS prog

38233823

38223822

Interrupt processing

Page 12: OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements

PS inth

151

3822

PSPS

PCPC

SPSP

stack

main memorymain memory

38243824

39OO39OO

12O1

PS prog

38233823

38223822

iret executioniret execution

Interrupt processing

Page 13: OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements

stack

main memorymain memory

38243824

39OO39OO

PS prog

12O1

3824

PSPS

PCPC

SPSP

iret completed iret completed

Interrupt processing

Page 14: OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements

O.S.Components

ContentsContents

Page 15: OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements

Process Management

O.S. COMPONENTS

Main-Memory Management

Secondary-Memory

Management

Page 16: OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements

File Management

I/O-System Management

O.S. COMPONENTS

Page 17: OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements

Creating and deleting processes

Suspending and resuming processes

Provide mechanisms

for process interaction

Process management

Page 18: OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements

Keeping track of which

parts of memory

are currently being used

and by whom

Main memory management

Page 19: OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements

Deciding which processes are to be loaded

when memory becomes available

Main memory management

Page 20: OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements

Allocating and deallocating memory

space as needed

Main memory management

Page 21: OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements

Secondary memory

management

Free space management

Storage allocation

Disk scheduling

Page 22: OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements

I/O SYSTEM MANAGEMENT

The I/O subsystem

consists of

A memory-management component that

includes buffering and spooling

Page 23: OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements

A general device driver interface

Drivers for specific hardware devices

A general device driver interface

Drivers for specific hardware devices

I/O SYSTEM MANAGEMENT

The I/O subsystem

consists of

I/O SYSTEM MANAGEMENT

The I/O subsystem

consists of

Page 24: OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements

File management

Creating and deleting

files and directories

Supporting primitives

for manipulating file

and directory

Page 25: OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements

Mapping files

onto storage

Backing up files

on stable storage media

File management

Page 26: OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements

Protection systemsProtection systems

Mechanism for

controlling the access

of processes to system resources

Page 27: OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements

The mechanism must

provide means for specifying the

controls

to be imposed and means for enforcement

Protection systems

Page 28: OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements

The interface between users and O.S.

A program that reads

and interpretes control statements

The interface between users and O.S.

A program that reads

and interpretes control statements

Comand-Interpreter System

Page 29: OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements

Its main function: to get next command

statement

and execute it (shell)

Its main function: to get next command

statement

and execute it (shell)

Comand-Interpreter System

Page 30: OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements

System calls

ContentsContents

Page 31: OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements

Processes communicate

with the O.S. and request services to it by

making system calls

System Calls

Page 32: OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements

System calls provide

the interface between any process and O.S.

System Calls

Page 33: OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements

Process control

Examples of System CallExamples of System Call

Communications

Information management

Device manipulation

File manipulation

Page 34: OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements

Corresponding to

each system call

there is a library procedure

Corresponding to

each system call

there is a library procedure

Page 35: OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements

count= read (file, buffer, nbytes)

count returns the number of bytes actually read

C programC program

Example: read system callExample: read system call

Page 36: OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements

Library read

procedure

operating system

system call READ

INT

return from INT

register xregister x

x call parameters

load x

system call READ 2

3

1

Page 37: OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements

Puts the parameters of the system call in machine

registers

Puts the parameters of the system call in machine

registers

The library procedureThe library procedure

The control is returned to the caller by

returning the status code as a result

The control is returned to the caller by

returning the status code as a result

Issues a INT instruction to start the O.S.

Issues a INT instruction to start the O.S.

Page 38: OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements

directly via registers

in a memory block whose address is passed as a

parameter in a registry

into the stack (push, pop)

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 systemMethods to pass parameters to operating system

Page 39: OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements

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: OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements

Dual mode of operationsDual mode of operations

user modeuser mode

Hardware control does not allow the execution of

privileged instructions

Hardware control does not allow the execution of

privileged instructions

Used for normal execution of user programs

Used for normal execution of user programs

Page 41: OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements

Used for the execution of O.S. functions as

required by system calls

Used for the execution of O.S. functions as

required by system calls

supervisor mode (kernel mode)supervisor mode (kernel mode)

All instructions can be executed

All instructions can be executed

Dual mode of operationsDual mode of operations