GATE - 2005 | OS | We wish to schedule three processes P1, P2 and P3 on a uniprocessor

GATE - 2005 | OS | We wish to schedule three processes P1, P2 and P3 on a uniprocessor
Posted on 19-02-2022

GATE - 2005 [Operating System]

Question:

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.

 Process

 Priority

 CPU time required

 Arrival time (hh:mm:ss)

 P1

 10(highest)

 20 sec

 00:00:05

 P2

 9

 10 sec

 00:00:03

 P3

 8 (lowest)

 15 sec

 00:00:00

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.

A

30 sec, 30 sec

B

30 sec, 10 sec

C

42 sec, 42 sec

D

30 sec, 42 sec

    

Solution:

Option (D) is Correct.

For preemtive,

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.  Process	 Priority	 CPU time required	 Arrival time (hh:mm:ss)  P1	 10(highest)	 20 sec	 00:00:05  P2	 9	 10 sec	 00:00:03  P3	 8 (lowest)	 15 sec	 00:00:00We 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.

TAT of P2 = Completion time of P2 - Arrival time of P2
= 33 - 3
= 30 sec


For non-preemptive,

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.  Process	 Priority	 CPU time required	 Arrival time (hh:mm:ss)  P1	 10(highest)	 20 sec	 00:00:05  P2	 9	 10 sec	 00:00:03  P3	 8 (lowest)	 15 sec	 00:00:00We 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.

TAT of P2 = Completion time of P2 - Arrival time of P2
= 45 - 3
= 42 sec

Thank You