You are on page 1of 2

DEPARTMENT OF COMPUTER SCIENCE

CSC130 OPERATING SYSTEMS

CLASS EXERCISES 5 – CPU SCHEDULING

Process Burst Time (ms) All the following 5 processes arrive at time 0, in the
P1 10 order given the burst time are as follows. Consider the
P2 29 FCFS, SJF (non-preemptive) and RR (quantum = 10ms)
P3 3 scheduling algorithms for the set of processes. Which
P4 7 algorithm would give the minimum average waiting
P5 12 time?

FCFS
Process Waiting Time
P1
P2
P3
P4
P5
AVERAGE
FCFS Gantt Chart

JSF
Process Waiting Time
P1
P2
P3
P4
P5
AVERAGE
JSF Gantt Chart

RR
Process Waiting Time
P1
P2
P3
P4
P5
AVERAGE
FCFS Gantt Chart

Page 15
DEPARTMENT OF COMPUTER SCIENCE
CSC130 OPERATING SYSTEMS

CLASS EXERCISES 5 – CPU SCHEDULING


SUGGESTED SOLUTION

Process Burst Time


(ms) All the following 5 processes arrive at time 0, in the order
P1 10 given the burst time are as follows. Consider the FCFS,
P2 29 SJF and RR (quantum = 10ms) scheduling algorithms for
P3 3 the set of processes. Which algorithm would give the
P4 7 minimum average waiting time?
P5 12

FCFS
Process Waiting Time
P1 0
P2 10
P3 39
P4 42
P5 49
AVERAGE 28
FCFS Gantt Chart

0 P1 10 P2 39 P3 42 P4 49 P5 61
JSF
Process Waiting Time
P1 10
P2 32
P3 0
P4 3
P5 20
AVERAGE 13
JSF Gantt Chart

0 P3 3 P4
10 P1 20 P5 32 P2 61
RR
Process Waiting Time
P1 0
P2 32
P3 20
P4 23
P5 40
AVERAGE 23
FCFS Gantt Chart

0 P1 10 P2 20 P3 23 P4 30 P5 40 P2 50 P5 52 P2 61

Page 16

You might also like