0
1.3kviews
Consider the following set of process with CPU burst time.

Subject: Operating System

Topic: Process Concept and Scheduling

Difficulty: Medium

Process Burst Time Arrival Time
P1 10 11
P2 4 2
P3 5 3
P4 3 4

i) Draw Gnatt chart for FCFS, SJF pre-emptive and Round Robin (Quantum = 3). Calculate average waiting time and average turnaround time.

1 Answer
0
16views

Turn Around Time = Process Completion Time – Process Arrival Time

Waiting time = Turn Around time – Burst time


First Come First Serve (FCFS) Scheduling

FCFS

Process Arrival Time Burst Time Completion Time Turn Around Time Waiting Time
P1 11 10 24 24 – 11 = 13 13 – 10 = 3
P2 2 4 6 6 – 2 = 4 4 – 4 = 0
P3 3 5 11 11 – 3 = 8 8 – 5 = 3
P4 4 3 14 14 – 4 = 10 10 – 3 = 7

Average Turn Around Time = (13 + 4 + 8 + 10) / 4 = 8.75 ms

Average Waiting time = (3 + 0 + 3 + 7) / 4 = 3.25 ms


Shortest Job First (SJF) Scheduling (Pre-emptive)

SJF

Process Arrival Time Burst Time Completion Time Turn Around Time Waiting Time
P1 11 10 24 24 – 11 = 13 13 – 10 = 3
P2 2 4 6 6 – 2 = 4 4 – 4 = 0
P3 3 5 14 14 – 3 = 11 11 – 5 = 6
P4 4 3 9 9 – 4 = 5 5 – 3 = 2

Average Turn Around Time = (13 + 4 + 11 + 5) / 4 = 8.25 ms

Average Waiting time = (3 + 0 + 6 + 2) / 4 = 2.75 ms


Round Robin Scheduling

Quantum = 3 ms

Round Robin

Process Arrival Time Burst Time Completion Time Turn Around Time Waiting Time
P1 11 10 24 24 – 11 = 13 13 – 10 = 3
P2 2 4 15 15 – 2 = 13 13 – 4 = 9
P3 3 5 17 17 – 3 = 14 14 – 5 = 9
P4 4 3 11 11 – 4 = 7 7 – 3 = 4

Average Turn Around Time = (13 + 13 + 14 + 7) / 4 = 11.75 ms

Average Waiting time = (3 + 9 + 9 + 4) / 4 = 6.25 ms

Please log in to add an answer.