Documente Academic
Documente Profesional
Documente Cultură
Admitted Running
New Ready
Interrupt
I/O or event exit
completion I/O or event wait
Wait Terminat
e
Process life cycle
Seven state model
Suspend
New
Admit Admit Scheduler
dispatch
Activate
Ready Running
Ready, Suspend
suspend Interrupt
exit
I/O or event
Event completion I/O or event
complete wait
Activate Terminat
Wait, Wait e
suspend Memory
release
Transitions
newready,suspend (process creation duty with blocked
process)
newready if the new process is of high priority
wait wait suspend, if no space for new process
readyready suspend, if the wait queues are empty
ready suspend ready, ready queue is empty
wait suspend ready suspend, event for what process
waited is completed
wait suspend wait, if the process is of high priority and
memory becomes available.(poor performance)
Running ready suspend, a high priority process
preempts the process and no memory available.
Process control block
The structure maintained by the operating system that
represents a process
Typical elements of PCB
Process identification
Process ID
Parent process ID
User identifier
Processor state information
User visible registers
Control registers
Stack pointers
PCB
Pointer Process state
Process ID
Program counter
Registers
Memory limits
List of open files
Process control block (contd.)
Process control information
Scheduling information
Process state
Priority
Scheduling related information
Event waiting
Data structuring
Pointers to other processes in queues
Inter process communication
Long term
Controls degree of multiprogramming
Good mixture of I/O and CPU bound process
Short term
CPU scheduler
Medium term
swapping
CPU and I/O burst
CPU burst
I/O burst or wait
Process can be viewed as an alternating sequence of CPU
and I/O burst.
Starts and ends with CPU burst
CPU burst
I/O
CPU burst
I/O
CPU burst
Context switching
Executing a new process needs to save the current
state of the currently executing process, that
includes the contents of different registers.
It is a pure overhead to the system.
It is dependent on hardware.
DECSYSTEM-20 uses different set of registers. Contex
switching here is a simply the change of pointer to a
new set of registers.
If the no of process is high, then needs the saving in
memory
Scheduling criteria
CPU utilization
Throughput
Turnaround time
Waiting time
Response time
Category of scheduling algorithm
Preemptive
Non-preemptive
When to make scheduling decision
Running wait
Terminate
Running ready Only in Preemptive
Wait ready
Scheduling algorithms
First in first out (FIFO)
Shortest job first (SJF)
Shortest remaining time next(SRTN)
Highest response ration next(HRTN)
Round Robin (RR)
Priority Scheduling
Multilevel queue
Multilevel feedback queue
FIFO
Process P1 P2 P3 P4 P5
Arrival time 0 0 2 8 12
Length 10 9 5 5 4
P1 P2
2 8 12
P3 P4 P5
P1 P2 P3 P4 P5
10 19 24 29 33
0
Process P1 P2 P3 P4 P5 Average
Waiting time 0 10 17 16 17 12
P2 P3 P5 P4 P1
9 14 18 23 33
0
Process P1 P2 P3 P4 P5 Average
Turnaround time 33 9 12 15 6 15
SRTN
Process P1 P2 P3 P4 P5
Arrival time 0 00 22 88 12
12
12
67 55 155 444
Length 10 9
P1 P2
P3 P4 P5
P2 P3 P2 P4 P4 P5 P2 P1
0 2 7 8 12 13 17 23 33
Process P1 P2 P3 P4 P5 Average
P2 P3 P1 P4 P5
0 9 14 24 29 33
Process P1 P2 P3 P4 P5 Average
P1 P2 P3 P1 P4 P2 P5
0 2 5 8 10 12 15 2 25 29 33
0
Process P1 P2 P3 P4 P5 Average
Turnaround time 20 29 13 17 21 20
Round Robin with Time slice 10 &2
P1 P2
2 8 12
P3 P4 P5
P1 P2 P3 P4 P5
10 19 24 29 33
0
With longer time slice RR will be converted to FIFO
P1 P2 P3 P1 P2 P3 P4 P1 P2 P5 P3 P4 P1 P2 P5 P4 P1 P2
Ready queue 2
Ready queue 3
Example
Process p1 p2 p3 p4 p5 p6 p7 p8
A/T 0 0 2 5 7 8 14 21
Priority 4 1 2 4 1 3 2 2
Len 18 3 6 20 6 10 9 10
AtAt
At time
At
Attime
time
53
59
61
68
time
time
(P11
13
7306815
39(time
40
51 31(timeis(time
23(time
is expires
expires
promoted)
promoted)
expires
expires for
for Pfor PP48Pis
6, for ,P5P7)promoted)
)6and P1 are promoted)
Q1(4,--)
Q1(4,--) P2(0,3,0)
Q1(4,--)
Q1(4,--)
Q1(4,--) P5(7,6,0)
Q2(8,10)
Q2(8,10)
Q2(8,10)
Q2(8,10)
Q2(8,10)
Q2(8,10) PPP
P68(59,2,0)
(51,2,0) (11,2,2)
3537(2,6,1)
(7,2,4),
(14,9,1)P5(11,6,0)
(7,2,0)
6 8(21,10,2)
(28,10,3)
P
Q3(16,20)
Q3(16,20)
Q3(16,20) P7P
Q3(16,20)
Q3(16,20)
Q3(16,20) 41(59,14,9)
P(23,1,16),P
Q3(16,20) PP(23,1,8),
666(8,10,5)
(30,18,10),P
(35,20,18),P
(51,7,10),
(35,20,16),P
(51,7,8),
P P P(59,14,0)
468(59,14,2)
(8,10,3)
(8,10,7)
P (31,2,9),
(39,2,14),
(30,18,9),P
(8,10,15),
(39,2,12),
P PP
P
4(35,20,5),P
(51,7,2)
(31,2,8),
(30,18,1),P
P (23,1,0) P
1(51,7,0) 6(39,2,1) 6(39,2,0)
(35,20,0),P
(31,2,0)
14 7 6 4 6 1 1 8
7 1 8 4
Q4(--,30)
Q4(--,30)
Q4(--,30) P (0,18,0)
PP1(0,18,3)
(0,18,13),
(0,18,7), PP (5,20,8)
(5,20,2)
Q4(--,30) 1 PP
Q4(--,30)
Q4(--,30)
Q4(--,30) (0,18,11),
(0,18,15),
(5,20,26)
P
4 111 (0,18,23), 4PP44(5,20,6)
4 (5,20,10)
4(5,20,18)
P2 P3 P5 P3 P5 P7 P8 P6 P7 P1 P8 P4 P6 P1 P4
0 3 7 11 13 15 23 31 39 40 51 53 59 61 68 82