Please show explination for answer and how you got that answer. Please give an e
ID: 3552280 • Letter: P
Question
Please show explination for answer and how you got that answer. Please give an explination for each :
6. If the OS applies SF (Shortest First) scheduling instead, what will be the executing order of processes for CPU? Please list them as format as P Py if Px get executed first X- 7. If the OS applies SF (Shortest First) scheduling, what will be the average waiting time of 4 processes 8. Assume OS applies priority scheduling (preemptive scheduling) to 4 processes above and they still have the same execution time as before (ie: P1 300 ms, P2 6 ms, P3 2 ms, P4 50 ms.). If value 1 stands for th highest priority, 2 stands for the second highest priority, and 4 stands for the least priority, here are priorities for each process: P1 1, P3 2. P4 3, P2 4. What will be the new average waiting time for each process?Explanation / Answer
given
time of execution for processes is..
Shortest time first...
a)
the process with smallest processtime will be executed first..so the order of execution will be
P3--->P2--->P1--->P4
b.
waiting time is the time the process is waiting for it to be executed form the time it has arrived
so waiting time = time at which it started - arrival time
here arrival time is not specified so we can consider arrival time to be 0ms that is all processes arrived at the same time at 0ms
as process P3 has least time of execution it will be executed first. waiting time for P3 will be 0 as it will arrive at 0 and will start execution at 0 without waiting
P2 has execution time of 6 which is next least so now P2 will be executed.it arrived at 0 but it should wait till the completion of P3 so its waiting time will be 2
similarly for P1 waiting time is 8 as it should wait till the completion of P3 and P2 (2+6) =8
and
for P4 it will be 38 as it should wait till P3,P2,P1 to complete (2+6+30)=38
( from is stating time and to is the ending time of process..P3 stats at 0 ..0 to 1 one unit of time + 1 to 2 one unit of time =2units of time for P3 )
avg waiting time = sum of all waiting time / number of processes
=0+2+8+38/4
=48/4
=12
c.
if priorities are given then process with high priority will be executed first.
now P1 has highest priority so P1 will be executed first followed by P3 then P4 and finnaly P2
P1--->P3--->P4--->P2
avg waiting time =( 0+30+32+82)/4
=144/4
=36
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.