Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Assignment 6

Program: BSCS
Session: 2017-2021
Semester: 7st Semester
Course Code: CS-206
Course Name: Operating Systems
Instructor: Waqas Sharif

Question No 1

CPU burst time indicates the time; the process needs the CPU. The following are the set of
processes with their respective CPU burst time (in milliseconds). These processes are being
scheduled using a non-preemptive, FSFC scheduling algorithm.

Process Burst time

P0 6

P1 8

P2 7

P3 3

Draw a Gantt chart and calculate the turnaround time, response time and average waiting time if
the process arrived in the following order:

(i) P1, P2, P0 & P3

(ii) P2, P3, P1 & P0


Answer

Gantt Chart:
P1 P2 P0 P3
0 8 15 21 24
Average waiting Time:

Waiting time= start time- arrival time

P1=0-0=0

P2=8-1=7

P0=15-2=13

P3=21-3=18

Average waiting time= 0+7+13+18/4

=9.5

Turnaround time:

Turnaround time= completion time – arrival time

P1=8-0=8

P2=15-1=14

P0=21-2=19

P3=24-3=21

Response time:

Time when CPU gets CPU – arrival time

P1=0-0=0

P2=8-1=7

P0=15-2=13

P3=21-3=18
(2)

Gantt chart:

P2 P3 P1 P0
0 7 10 18 24

Average waiting time:

Waiting time= start time- arrival time

P2=0-0=0

P3=7-1=6

P1=10-2=8

P0=18-3=15

Average waiting time= 0+6+8+15/4

=7.25

Turnaround Time:

Turnaround time=completion time-arrival time

P2=7-0=7

P3=10-1=9

P1=18-2=16

P0=24-3=21

Response time:

Response time= Time when CPU gets CPU – arrival time

P2=0-0=0

P3=7-1=6

P1=10-2=8

P0=18-3=15

You might also like