33 33 votes We wish to schedule three processes $P1$, $P2$ and $P3$ on a uniprocessor system. The priorities, CPU time requirements and arrival times of the processes are as shown below. $$\begin{array}{|c|c|c|c|} \hline \textbf{Process} & \textbf{Priority} & \textbf{CPU time} & \textbf{Arrival time}\\ & & \textbf{required} & \textbf{(hh:mm:ss)} \\\hline \text{P1} & \text{10 (highest)} & 20\text{ sec} & 00:00:05 \\\hline \text{P2} & 9 & 10 \text{ sec}& 00:00:03 \\\hline \text{P3} & \text{8 (lowest)} & 15 \text{ sec}& 00:00:00 \\\hline \end{array}$$ We have a choice of preemptive or non-preemptive scheduling. In preemptive scheduling, a late-arriving higher priority process can preempt a currently running process with lower priority. In non-preemptive scheduling, a late-arriving higher priority process must wait for the currently executing process to complete before it can be scheduled on the processor. What are the turnaround times (time from arrival till completion) of $P2$ using preemptive and non-preemptive scheduling respectively? $30$ sec, $30$ sec $30$ sec, $10$ sec $42$ sec, $42$ sec $30$ sec, $42$ sec Operating System gateit-2005 operating-system process-scheduling normal + – Ishrat Jahan 9.3k views answer comment Share Follow Print 0 reply Please log in or register to add a comment.
Best answer 39 39 votes Answer will be (D). TAT = Completion Time - Arrival Time. The Gannt Chart for Non Preemptive scheduling will be $(0)P3,(15)P1,(35)P2(45).$ From above this can be inferred easily that completion time for $P2$ is $45$, for $P1$ is $35$ and $P3$ is $15.$ Gantt Chart for Preemptive- $(0)P3,(1)P3,(2)P3,(3)P2,(4)P2,(5)P1,(25)P2,(33)P3(45)$. Similarly take completion time from above for individual processes and subtract it from the Arrival time to get TAT. Gate Keeda answered Nov 3, 2014 • edited Jun 29, 2018 by kenzou Gate Keeda comment Share Follow See all 3 Comments 3 3 Comments reply Vicky rix commented Dec 1, 2017 reply Follow flag The table can be modified before solving as Priority CPU TIME AT P1 10 20 5 P2 9 10 3 P3 8 15 0 3 3 replyShare Jhaiyam commented May 17, 2020 reply Follow flag How is p1 getting executed before p2 as its arrival time is 5? 0 0 replyShare magiko commented Mar 3, 2021 reply Follow flag because when p3 finished, it was at sec 15. both p1 and p2 were waiting and p1 has higher priority than p2 to be executed before p2 0 0 replyShare Please log in or register to add a comment.
3 3 votes BEST ANSWER akshay_123 answered Jul 12, 2025 akshay_123 comment Share Follow 0 reply Please log in or register to add a comment.
1 1 vote Explanation Prashant-G answered Jul 18 Prashant-G comment Share Follow 0 reply Please log in or register to add a comment.