0% found this document useful (0 votes)
15 views

Op Tutorial Process State

The document describes different process scheduling algorithms including Round Robin, First In First Out, Shortest Job First, and Priority scheduling. It provides sample processes with CPU burst times and priorities. Gantt charts are drawn to illustrate the execution of the processes under each algorithm and the average waiting and turnaround times are calculated.

Uploaded by

xx
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Op Tutorial Process State

The document describes different process scheduling algorithms including Round Robin, First In First Out, Shortest Job First, and Priority scheduling. It provides sample processes with CPU burst times and priorities. Gantt charts are drawn to illustrate the execution of the processes under each algorithm and the average waiting and turnaround times are calculated.

Uploaded by

xx
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

1. Draw and explain the process state diagram.

New terminated

Ready runningg
g

waiting

i. New: when a new process is being created.


ii. Running: a process is said to be in running state when instructions are being executed.
iii. Waiting: the process is waiting for some event to occur, such as an I/O operation.
iv. Ready: the process is waiting for processor.
v. Terminated: the process has finished execution.

2. Consider the following set of processes, with the length of the CPU-burst time given in milliseconds:

process CPU burst time in priority


milliseconds
P1 10 2
P2 11 5
P3 22 1
P4 6 3
P5 2 4
Time slice: 3ms

a) Draw a Gantt chart illustrating the execution of these processes using RR, FIFO, SJF (Shortest
Job First) & Priority (lowest number is high priority).
i. RR:

P1 P2 P3 P4 P5 P1 P2 P3 P4 P1 P2 P3 P1 P2 P3 P3 P3 P3 P3
0 3 6 9 12 14 17 20 23 26 29 32 35 36 38 41 44 47
50 51
Tw(P1)= (11+9+6)= 26
Tw(P2)= (3+11+9+6)= 29
Tw(P3)= (6+11+9+3)= 29
Tw(P4)= (9+11)= 20
Tw(P5)= (12) =12
Tw(average)= (26+29+29+20+12)/5 =23.2miliseconds

Turnaround time:
P1= 26+10=36
P2=29+11=40
P3=29+22=51
P4=20+6=26
P5+12+2=14
Average TT(36+40+51+26+14)/5=33.4

ii. FIFO:

P1 P2 P3 P4 P5
0 10 21 43 49 51
P1=0
P2=10
P3=21
P4=43
P5=49
Average waiting time= (10+21+43+49)=24.6

Turnaround time:
P1=10
P2=21
P3=43
P4=49
P5=51
Average TT=(10+21+43+49+51)/5=34.8

iii. SJF:

P5 P4 P1 P2 P3
0 2 8 18 29 51
Waiting time:
P1=8
Turnaround time:
P1=18
P2=29
P3=51
P4=8
P5=2
Average time= (18+29+51+8+2)/5=21.6

iv. Priority:

P3 P1 P4 P5 P2
0 22 32 34 40 51
Waiting time:
P1=22
P2=40
P3=0
P4=32
P5=38
Average time= (22+40+32+38)/5+26.4

Turnaround time:
P1=32
P2=51
P3=22
P4=38
P5=40
Average time:
(132+32)/5=32.8

b) What is the average waiting time for these processes?

c) What is the average turnaround time for these processes

You might also like