Odd uid: consider the three processes with arrival and burst time asProcess Arrival time Burst timeP1 0 9P2 1 4P3 2 7The pre-emptive shortest job first scheduling is used. Scheduling is carried out at arrival orcompletion of processes. What is the average waiting time for the three processes?Also find TTAT.
Question
Odd uid: consider the three processes with arrival and burst time asProcess Arrival time Burst timeP1 0 9P2 1 4P3 2 7The pre-emptive shortest job first scheduling is used. Scheduling is carried out at arrival orcompletion of processes. What is the average waiting time for the three processes?Also find TTAT.
Solution
To solve this problem, we need to follow the steps of the Preemptive Shortest Job First (SJF) scheduling algorithm. This algorithm selects the process with the smallest execution time first. If a new process arrives with less burst time, the current process is preempted.
Here are the steps:
-
At time t=0, process P1 is the only one in the queue, so it starts execution.
-
At time t=1, process P2 arrives. Since P2 has a shorter burst time than the remaining time of P1, P2 preempts P1.
-
P2 runs for its entire burst time of 4 units, so it finishes at time t=5.
-
At this point, both P1 and P3 are in the queue. P1 has a remaining burst time of 8 (since it was preempted after 1 unit of execution), and P3 has a burst time of 7. So, P3 is selected next.
-
P3 runs for its entire burst time and finishes at time t=12.
-
Now, only P1 is left in the queue, so it runs for its remaining burst time and finishes at time t=20.
Now, we can calculate the waiting time for each process:
- Waiting time for P1 = Finish time - Arrival time - Burst time = 20 - 0 - 9 = 11 units
- Waiting time for P2 = Finish time - Arrival time - Burst time = 5 - 1 - 4 = 0 units
- Waiting time for P3 = Finish time - Arrival time - Burst time = 12 - 2 - 7 = 3 units
So, the average waiting time = (11 + 0 + 3) / 3 = 4.67 units
The Turnaround Time (TTAT) for a process is the total time from its arrival to its completion. So:
- TTAT for P1 = Finish time - Arrival time = 20 - 0 = 20 units
- TTAT for P2 = Finish time - Arrival time = 5 - 1 = 4 units
- TTAT for P3 = Finish time - Arrival time = 12 - 2 = 10 units
So, the average TTAT = (20 + 4 + 10) / 3 = 11.33 units.
Similar Questions
Consider the following three processes in the FCFS.Process ID. Brust-time. Arrival-timeP1 3 3P2 6 6P3 9 9What is the average waiting time?2345
Consider the following set of processes :Process Priority Burst ArrivalP1 3 24 0P2 1 30P3 2 30The waiting time of all processes using the RR scheduling algorithms with quantum = 3 is:A.30B.6C.24D.12
Consider the given table below and find Completion time (CT), Turn-around time (TAT), Waiting time (WT), Response time (RT), Average Turn-around time and Average Waiting time in case of FCFS scheduling. Process ID Arrival time Burst time P1 2 2 P2 5 6 P3 0 4 P4 0 7 P5 7 4a.The waiting time for process P1 is 9msb.The waiting time for process P1 is 0msc.The waiting time for process P1 is 8msd.The waiting time for process P1 is 4ms
Consider the following set of processes, with the length of the CPU burst given in milliseconds:Process Burst Time PriorityP1 2 2P2 1 1P3 3 4P4 4 2The processes are assumed to have arrived in the order P1, P2, P3, P4, P5,all at time 0. What is the turnaround time of each process for the nonpreemptive Priority scheduling algorithms (a larger priority number implies a higher priority)?A.5, 10, 3, 9
Q5. Consider the set of 6 processes whose arrival time and burst time are given below-Arrival time Burst timeP1 0 6P2 1 7P3 2 8P4 3 10P5 4 3P6 5 4If the CPU scheduling policy is Round Robin with time quantum = 3, calculate the average waiting time andaverage turnaround time. For the given scheduling Algorithm (a) FCFS (b) SJF (c) SRTF
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.