3.basic hardware elements

41
OPERATING SYSTEM OVERVIEW

Transcript of 3.basic hardware elements

Page 1: 3.basic hardware elements

OPERATING SYSTEMOVERVIEW

Page 2: 3.basic hardware elements

Contents

Basic hardware elements

Page 3: 3.basic hardware elements

Most I/O devicesare much slower thanthe processor

Interrupts

Interrupt request signal

Active waiting cycle (polling)

Page 4: 3.basic hardware elements

An interrupt cycle isadded to the instructioncycle (fecth and execute).

The processor checks tosee if an interrupt hasoccured (interrupt signal)

Interrupt mechanism

Page 5: 3.basic hardware elements

interrupt handler

interrupt vector

Interrupt mechanism

Page 6: 3.basic hardware elements

CPU saves PS and PC(push) into the controlstack

CPU loads into PC andPS the correspondingvalues from theinterrupt vector

Interrupt processing

Page 7: 3.basic hardware elements

iret

interrupt handler execution

Interrupt processing

Page 8: 3.basic hardware elements

Interrupt enable/disablebit (PS register)

Hardware priority

STI (Set Interrupt)CLI (Clear Interrupt)

Interrupt mechanism

Page 9: 3.basic hardware elements

mainmainmemorymemory

i+1 PS inth

1OOi1OO

149

15O iret

1OOO

12OO12O1

mainmainmemorymemory

inthinth

progproginterruptinterrupt

1

2

3

interruptinterruptvectorvector

Interrupt processing

Page 10: 3.basic hardware elements

PS prog

12O1

3824

PS

PC

SP

stack

mainmemory

3824

39OO

CPU completes executionof the current instruction

Interrupt processing

Page 11: 3.basic hardware elements

interrupt signal has beenaccepted

PS inth

1OO

3822

PS

PC

SPstack

mainmainmemorymemory

3824

39OO

12O1

PS prog3823

3822

Interrupt processing

Page 12: 3.basic hardware elements

PS inth

151

3822

PS

PC

SP

stack

main memorymain memory

3824

39OO

12O1

PS prog

3823

3822

iret execution

Interrupt processing

Page 13: 3.basic hardware elements

stack

mainmemory

3824

39OO

PS prog

12O1

3824

PS

PC

SP

iret completed

Interrupt processing

Page 14: 3.basic hardware elements

O.S.Components

Contents

Page 15: 3.basic hardware elements

Process Management

O.S. COMPONENTS

Main-Memory Management

Secondary-MemoryManagement

Page 16: 3.basic hardware elements

File Management

I/O-System Management

O.S. COMPONENTS

Page 17: 3.basic hardware elements

Creating and deletingprocesses

Suspending and resumingprocesses

Provide mechanismsfor process interaction

Process management

Page 18: 3.basic hardware elements

Keeping track of whichparts of memoryare currently being usedand by whom

Main memory management

Page 19: 3.basic hardware elements

Deciding which processesare to be loaded whenmemory becomes available

Main memory management

Page 20: 3.basic hardware elements

Allocating anddeallocating memoryspace as needed

Main memory management

Page 21: 3.basic hardware elements

Secondary memorymanagement

Free space management

Storage allocation

Disk scheduling

Page 22: 3.basic hardware elements

I/O SYSTEM MANAGEMENT

The I/O subsystemconsists of

A memory-managementcomponent that includesbuffering and spooling

Page 23: 3.basic hardware elements

A general device driverinterface

Drivers for specifichardware devices

I/O SYSTEM MANAGEMENT

The I/O subsystemconsists of

Page 24: 3.basic hardware elements

File management

Creating and deletingfiles and directories

Supporting primitivesfor manipulating fileand directory

Page 25: 3.basic hardware elements

Mapping filesonto storage

Backing up fileson stable storage media

File management

Page 26: 3.basic hardware elements

Protection systems

Mechanism forcontrolling the accessof processes to systemresources

Page 27: 3.basic hardware elements

The mechanism mustprovide means forspecifying the controlsto be imposed and meansfor enforcement

Protection systems

Page 28: 3.basic hardware elements

The interface betweenusers and O.S.

A program that readsand interpretes controlstatements

Comand-Interpreter System

Page 29: 3.basic hardware elements

Its main function: to getnext command statementand execute it (shell)

Comand-Interpreter System

Page 30: 3.basic hardware elements

System calls

Contents

Page 31: 3.basic hardware elements

Processes communicatewith the O.S. and requestservices to it by makingsystem calls

System Calls

Page 32: 3.basic hardware elements

System calls providethe interface between anyprocess and O.S.

System Calls

Page 33: 3.basic hardware elements

Process control

Examples of System Call

Communications

Information management

Devicemanipulation

File manipulation

Page 34: 3.basic hardware elements

Corresponding to

each system call

there is a library procedure

Page 35: 3.basic hardware elements

count= read (file, buffer,nbytes)

count returns the number of bytesactually read

C program

Example:Example: readread system callsystem call

Page 36: 3.basic hardware elements

Library readLibrary readprocedureprocedure

operatingoperatingsystemsystem

system callREAD

INTINT

returnreturnfrom INTfrom INT

register x

x ← callparameters

load x

system callREAD

23

1

Page 37: 3.basic hardware elements

Puts the parameters of thesystem call in machineregisters

The library procedureThe library procedure

The control is returned tothe caller by returning thestatus code as a result

Issues a INT instruction tostart the O.S.

Page 38: 3.basic hardware elements

directly via registers

in a memory block whoseaddress is passed as aparameter in a registry

into the stack (push, pop)

Methods to pass parameters tooperating system

Page 39: 3.basic hardware elements

hardware(CPU, memory, disks, terminals, …)

UNIX O.S.

(process management, memorymanagement, file system, I/O, ...)

standard library(open, close, read, write, ..)

utility programs(shell, compiler, …)

users

usermode

kernelmode

userint.

libraryinterface

systemcallinterf.

Page 40: 3.basic hardware elements

Dual mode of operations

user mode

Hardware control does notallow the execution ofprivileged instructions

Used for normal execution ofuser programs

Page 41: 3.basic hardware elements

Used for the execution ofUsed for the execution ofO.S. functions as requiredO.S. functions as requiredby system callsby system calls

supervisor mode (kernel mode)

All instructions can beAll instructions can beexecutedexecuted

Dual mode of operations