OS L3 PStates_2014

22
OPERATING SYSTEMS (THEORY) LECTURE - 3 K.ARIVUSELVAN  Assis t ant Pr o f ess o r Seni o r SITE  VI T University

Transcript of OS L3 PStates_2014

7/24/2019 OS L3 PStates_2014

http://slidepdf.com/reader/full/os-l3-pstates2014 1/22

OPERATING SYSTEMS (THEORY)

LECTURE - 3

K.ARIVUSELVAN

 Assistant Professor Senior – SITE 

VIT University

7/24/2019 OS L3 PStates_2014

http://slidepdf.com/reader/full/os-l3-pstates2014 2/22

 

7/24/2019 OS L3 PStates_2014

http://slidepdf.com/reader/full/os-l3-pstates2014 3/22

=> Two State Process Model

=>

=> Five State Process Model

7/24/2019 OS L3 PStates_2014

http://slidepdf.com/reader/full/os-l3-pstates2014 4/22

Two State Process Model

7/24/2019 OS L3 PStates_2014

http://slidepdf.com/reader/full/os-l3-pstates2014 5/22

Three State Process Model

Dispatch

Ready Running

Time-out

Event

OccursEvent

Wait

Waiting

7/24/2019 OS L3 PStates_2014

http://slidepdf.com/reader/full/os-l3-pstates2014 6/22

Ready Running

Running Ready

Running process has expired his time slot

Runnin rocess ets interru ted because a hi her riorit rocess is in

the ready state

unn ng a ng

 An access to a resource not yet available

a ng or a process o prov e npu

Waiting Ready

The event for which it was waiting occurs

7/24/2019 OS L3 PStates_2014

http://slidepdf.com/reader/full/os-l3-pstates2014 7/22

Five State Process Model

 

process that

is prepared to

execute

process that is

currently being

executed

7/24/2019 OS L3 PStates_2014

http://slidepdf.com/reader/full/os-l3-pstates2014 8/22

Submission of a batch job

User logs on

Created by OS to provide a service to a user

e.g., pr nt ng a e

7/24/2019 OS L3 PStates_2014

http://slidepdf.com/reader/full/os-l3-pstates2014 9/22

7/24/2019 OS L3 PStates_2014

http://slidepdf.com/reader/full/os-l3-pstates2014 10/22

TWO QUEUES

7/24/2019 OS L3 PStates_2014

http://slidepdf.com/reader/full/os-l3-pstates2014 11/22

Multiple Blocked Queues

7/24/2019 OS L3 PStates_2014

http://slidepdf.com/reader/full/os-l3-pstates2014 12/22

Modes of Execution

2 Modes:

=>User Mode (Less Privileged Mode)

=>System Mode / Kernel Mode (More Privileged Mode)

Why ?

 

How ?

 

7/24/2019 OS L3 PStates_2014

http://slidepdf.com/reader/full/os-l3-pstates2014 13/22

Process Switching

When to Switch a Process?

  rap :

 –

moved to terminated state)

(2) Interrupt:

The cause is external to the execution of the current instruction – (controlis transferred to Interrupt Handler )

7/24/2019 OS L3 PStates_2014

http://slidepdf.com/reader/full/os-l3-pstates2014 14/22

Context Switch

Main Idea:

The act of swapping a process state on or off the CPU is a

con ex sw c

,

the state of the old process and load the saved state for the new

process

Context of a process represented in the PCB

7/24/2019 OS L3 PStates_2014

http://slidepdf.com/reader/full/os-l3-pstates2014 15/22

7/24/2019 OS L3 PStates_2014

http://slidepdf.com/reader/full/os-l3-pstates2014 16/22

Steps in Context Switch

Save context of processor including program counter and other registers

 

other associate information

Move PCB to appropriate queue – ready, blocked

Select another rocess for execution. 

Update PCB of the selected process

Restore CPU context from that of the selected process.

7/24/2019 OS L3 PStates_2014

http://slidepdf.com/reader/full/os-l3-pstates2014 17/22

7/24/2019 OS L3 PStates_2014

http://slidepdf.com/reader/full/os-l3-pstates2014 18/22

7/24/2019 OS L3 PStates_2014

http://slidepdf.com/reader/full/os-l3-pstates2014 19/22

7/24/2019 OS L3 PStates_2014

http://slidepdf.com/reader/full/os-l3-pstates2014 20/22

Context-switch time is overhead; the system does no useful

work while switching

7/24/2019 OS L3 PStates_2014

http://slidepdf.com/reader/full/os-l3-pstates2014 21/22

7/24/2019 OS L3 PStates_2014

http://slidepdf.com/reader/full/os-l3-pstates2014 22/22

Revision

Pro ram

Process

Pro ram VS Process

Process Image PCB

rocess tates

Process Creation

Process Termination

Process Control Modes

Process switching

Context Switching