1. (10 points) a) P1 arrived at 0 and need 6 units burst time, P2 is arrived at
ID: 3757296 • Letter: 1
Question
1. (10 points) a) P1 arrived at 0 and need 6 units burst time, P2 is arrived at 1 and need 4 units of burst time, process P3 is arrived at 2 and need 6 units of burst time and process P4 arrived at 3 and need 4 units of burst time. No I/O in any jobs. Assume that context switch takes one unit of time. Draw the Gnatt chart and find the average waiting time, turnaround time using SJF non-preemptive scheduling. (5 Points) b) Five jobs are waiting to be run (no l/O). Their expected run times are 2, 6, 3,15, and 10. In what order should they be run to minimize average response time? Explain why. (5 points)Explanation / Answer
A. SJF non preemptive policy switch to the process having minimum processing time.
At time t=0 only process P1 was available hence using SJF non preemptive policy , between 0 to 6 CPU brust, only P1 will be processed.
Once P1 is over, after 6th brust, all other process are available and in increasing order of burst time, their processing order will be
P2 , P4 and then P3.
So, based on the order of execution, Gnatt chart will be as shown below
0 P1 6 7 P2 11 12 P4 16 17 P3 23
I-----------| |---------| |---------------| |-------------------|
Waiting time of P1 =0
Waiting time of P2 = 7-1=6 //waiting time = arrival time - start of process
Waiting time of P3 = 17-2 = 15
Waiting time of P4 = 12-3 = 9
Average waiting time = (0+6+15+9)/4 = 7.5 cpu burst
Turnaround time is the time interval between the process arrival and its completion
Turnaround time of P1 = 6-0 = 6
Turnaround time of P2 = 11-1=10
Turnaround time of P3 = 23-2 = 21
Turnaround time of P4 = 16-3 = 13
Average turnaround time = (6+10+21+13)/4 = 50/4 = 12.5 cpu burst
B. Response time is the time gap between the time of arrival of process and first response to the request. In order to minimize the response time, each process should at first run in round robin fashion with 1 unit of cpu burst. Thereafter Shortest Remaining Time First policy can be used.
So average response time will be = (0+1+2+3)/4 = 6/4 = 1.5 CPU burst
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.