www.vustudents.ning.com

We non-commercial site working hard since 2009 to facilitate learning Read More. We can't keep up without your support. Donate.

# CS604 Assignment No. 2 Spring 2020 Due date 14-06-2020

Question No 01                                                                                15 marks

Consider the following set of processes, with the CPU burst time given in milliseconds:

Process                Burst Time

P1                                   10

P2                                   1

P3                                   2

P4                                   1

P5                                   5

The processes are arrived in the order P1, P2, P3, P4, P5, all at time 0.

1. Draw Gantt chart showing the execution of these processes using FCFS and SJF scheduling.
2. Calculate the turnaround time of each process for FCFS scheduling algorithm as per part Calculation of part A?
3. Calculate the waiting time of each process for SJF scheduling algorithm as per calculation of Part A?

Wish you very Best of Luck!

Views: 818

Attachments:

### Replies to This Discussion

CS604_Assignment_No_02_Solution_Spring_2020

CS604_Assignment_No_02_Solution_Spring_2020

# CS604 Assignment 2

CS604(Operating system)
Assignment No 02

Question # 01:

Consider the following set of processes, with the CPU burst time given in milliseconds:

Process Burst Time
P1 10
P2 1
P3 2
P4 1
P5 5

The processes are arrived in the order P1, P2, P3, P4, P5, all at time 0.

A. Draw Gantt chart showing the execution of these processes using FCFS and SJF scheduling.
B. Calculate the turnaround time of each process for FCFS scheduling algorithm as per part Calculation of part A?
C. Calculate the waiting time of each process for SJF scheduling algorithm as per calculation of Part A?

A. Draw Gantt chart showing the execution of these processes using FCFS and SJF scheduling.

As given:
Process Arrival Time CPU Burst time (Milliseconds)
P1 0 10
P2 0 1
P3 0 2
P4 0 1
P5 0 5

Gantt chart using FCFS scheduling:

P1 P2 P3 P4 P5

10 11 13 14 19

Gantt chart using SJF scheduling:

P2 P4 P3 P5 P1

0 1 2 4 9 19

B. Calculate the turnaround time of each process for FCFS scheduling algorithm as per part Calculation of part A?

Process Arrival Time(AT)(Milliseconds) CPU Burst Time(BT)
(Milliseconds) Completion Time(CT)(Milliseconds) Turnaround Time(TAT = CT-AT)(Milliseconds)
P1 0 10 10 10 – 0 = 10
P2 0 1 11 11 – 0 = 11
P3 0 2 13 13 – 0 = 13
P4 0 1 14 14 – 0 = 14
P5 0 5 19 19 – 0 = 19

C. Calculate the waiting time of each process for SJF scheduling algorithm as per calculation of Part A?

Process Arrival Time (AT) (Milliseconds) CPU Burst Time (BT)
(Milliseconds) Completion Time (CT) (Milliseconds) Turnaround Time (TAT = CT-AT) (Milliseconds) Waiting Time (WT = TAT - BT)
(Milliseconds)
P1 0 10 19 19 – 0 = 19 19 –10 = 9
P2 0 1 1 1 – 0 = 1 1 –1 = 0
P3 0 2 4 4 – 0 = 4 4 –2 = 2
P4 0 1 2 2 – 0 = 2 2 –1 = 1
P5 0 5 9 9 – 0 = 9 9 –5 = 4

1

2

3

4

5

## Latest Activity

2 hours ago
Nida Arshad Javaid Ch posted photos
3 hours ago

4 hours ago

4 hours ago

4 hours ago

### 20210923_134331

4 hours ago
Ayesha arshad and Adeel are now friends
9 hours ago
11 hours ago