CS604 Assignment 2 Solution and Discussion

Operating Systems (CS604)
Assignment # 02
FALL 2019
Total marks = 20Deadline Date
02.12.2019Please carefully read the following instructions before attempting assignment.
RULES FOR MARKING
It should be clear that your assignment would not get any credit if:
The assignment is submitted after the due date.
The submitted assignment file does not open or it is corrupt.
The submitted assignment solution is copied from any other student or from the internet.You should consult the recommended books to clarify your concepts as handouts are not sufficient.
You are supposed to submit your assignment in .doc or docx format.
Any other formats like scan images, PDF, zip, rar, ppt and bmp etc will not be accepted.Objective:
• The objective of this assignment is to provide hands on experience of:
Different Process Scheduling Algorithms in Operating SystemNOTE
No assignment will be accepted after the due date via email in any case (whether it is the case of load shedding or internet malfunctioning etc.). Hence refrain from uploading assignment in the last hour of deadline. It is recommended to upload solution file at least two days before its closing date.
If you find any mistake or confusion in assignment (Question statement), please consult with your instructor before the deadline. After the deadline no queries will be entertained in this regard.
For any query, feel free to email at:
[email protected]Question No 01 4+3+3=10 marks
Assume you have to apply Shortest Job First (SJF) scheduling algorithms on the set of different processes given in the table below. The CPU burst time is also given for each process. Consider that all the processes arrive in the ready queue within time 0 seconds except P2 that arrive in ready queue within time 8 seconds. You are required to show the Gantt Chart to illustrate the execution sequence of these processes and calculate the Total Waiting Time and Average Waiting Time for the given processes by using SJF algorithm.Process CPU Burst Time (seconds) P0 2 P1 6 P2 1 P3 4 P4 3 P5 8 Question No 02 4+3+3=10 marks
Consider a scenario where you have to apply Round Robin scheduling algorithm on the below given set of processes with each having a quantum size=8 milliseconds. The CPU burst time and arrival time for each process is also provided in the given table. You are required to show the Gantt Chart to illustrate the execution sequence of these processes. Moreover, calculate the Average Turnaround Time and Average Waiting Time for given processes by using round robin algorithm.Process CPU Burst Time (Milliseconds) Arrival Time(Milliseconds) P0 15 0 P1 8 4 P2 25 18 P3 18 5 Wish you very Best of Luck!

Solution:
Q. 1 AnswerP0 P4 P3 P2 P1 P5 0 2 5 9 10 16 24 Total Waiting Time = 0+2+5+1+10+16 = 34 Seconds
Average Waiting Time = 34/6 = 5.66 SecondsQ.2 Answer:
Solution 1:P0 P1 P3 P0 P2 P3 P2 P3 P2 P2 0 8 16 24 31 39 47 55 57 65 66 Turnaround time= Exit Time Arrival Time
Turnaround time for P0 = 310 = 31
P1 = 164 = 12
P2 = 6618 = 48
P3 = 57 5= 52Total Turnaround Time = 39+12+48+52 = 143
Average Turnaround Time = 143 / 4 =35.75 millisecondWaiting Time= Turnaround Time Burst Time
Waiting time for P0 = 3115 = 16
P1 = 128 = 4
P2 = 4825 = 23
P3 = 5218 = 34Total Waiting Time = 16+4+23+34 =77
Average Waiting Time = 77 / 4 =19.25 millisecondSolution 2:
P0 P1 P3 P2 P0 P3 P2 P3 P2 P2 0 8 16 24 31 39 47 55 57 65 66 Turnaround time= Exit Time Arrival Time
Turnaround time for P0 = 390 = 39
P1 = 164 = 12
P2 = 6618 = 48
P3 = 57 5= 52Total Turnaround Time = 39+12+48+52 = 151
Average Turnaround Time = 151 / 4 =37.75 millisecondWaiting Time= Turnaround Time Burst Time
Waiting time for P0 = 3915 = 24
P1 = 128= 4
P2 = 4825= 23
P3 = 5218 = 34Total Waiting Time = 24+0+5+29 = 85
Average Waiting Time = 85 / 4 =21.25 millisecond

Solution:
Q. 1 AnswerP0 P4 P3 P2 P1 P5 0 2 5 9 10 16 24 Total Waiting Time = 0+2+5+1+10+16 = 34 Seconds
Average Waiting Time = 34/6 = 5.66 SecondsQ.2 Answer:
Solution 1:P0 P1 P3 P0 P2 P3 P2 P3 P2 P2 0 8 16 24 31 39 47 55 57 65 66 Turnaround time= Exit Time Arrival Time
Turnaround time for P0 = 310 = 31
P1 = 164 = 12
P2 = 6618 = 48
P3 = 57 5= 52Total Turnaround Time = 39+12+48+52 = 143
Average Turnaround Time = 143 / 4 =35.75 millisecondWaiting Time= Turnaround Time Burst Time
Waiting time for P0 = 3115 = 16
P1 = 128 = 4
P2 = 4825 = 23
P3 = 5218 = 34Total Waiting Time = 16+4+23+34 =77
Average Waiting Time = 77 / 4 =19.25 millisecondSolution 2:
P0 P1 P3 P2 P0 P3 P2 P3 P2 P2 0 8 16 24 31 39 47 55 57 65 66 Turnaround time= Exit Time Arrival Time
Turnaround time for P0 = 390 = 39
P1 = 164 = 12
P2 = 6618 = 48
P3 = 57 5= 52Total Turnaround Time = 39+12+48+52 = 151
Average Turnaround Time = 151 / 4 =37.75 millisecondWaiting Time= Turnaround Time Burst Time
Waiting time for P0 = 3915 = 24
P1 = 128= 4
P2 = 4825= 23
P3 = 5218 = 34Total Waiting Time = 24+0+5+29 = 85
Average Waiting Time = 85 / 4 =21.25 millisecond





@zareen said in CS604 Assignment 2 Solution and Discussion:
Assume you have to apply Shortest Job First (SJF) scheduling algorithms on the set of different processes given in the table below. The CPU burst time is also given for each process. Consider that all the processes arrive in the ready queue within time 0 seconds except P2 that arrive in ready queue within time 8 seconds. You are required to show the Gantt Chart to illustrate the execution sequence of these processes and calculate the Total Waiting Time and Average Waiting Time for the given processes by using SJF algorithm.

This post is deleted!