Question
For the processes listed in the following table, which of the following scheduling schemes will give the lowest average turnaround time?
| Process | Arrival Time | Processing Time |
|---|---|---|
| A | 0 | 3 |
| B | 1 | 6 |
| C | 4 | 4 |
| D | 6 | 2 |
Official answer and solution
- Official answer
- C
- From
- Official GATE 2015 answer key
Solution
Simulate each scheduling policy (FCFS, Non-preemptive SJF, SRTF, RR with quantum 2) and calculate the average turnaround time.
Given processes:
- A: arrival = 0, burst = 3
- B: arrival = 1, burst = 6
- C: arrival = 4, burst = 4
- D: arrival = 6, burst = 2
- Shortest Remaining Time First (SRTF):
- : Only A arrives. A runs until .
- : B arrives (burst 6). A remaining burst is 2. Since , A continues. A finishes at .
Completion time of A . - : Only B is present (remaining 6). B runs from to .
- : C arrives (burst 4). B has remaining burst 5. Since , C preempts B! C runs from to .
- : D arrives (burst 2). C has remaining burst 2. D has burst 2. C continues (or D runs). C finishes at .
Completion time of C . - : Ready queue has D (burst 2) and B (remaining 5). D runs from to .
Completion time of D . - : B runs from to .
Completion time of B .
Turnaround time ():
- A:
- B:
- C:
- D:
Average TAT for SRTF .
By optimality theorem of scheduling, Shortest Remaining Time First (SRTF) is provably optimal for minimizing average turnaround / waiting time among all scheduling algorithms. Hence, SRTF gives the lowest average turnaround time (Option C).
C
Confusing non-preemptive SJF with preemptive SRTF; non-preemptive SJF cannot preempt long process B once it starts.
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2015 Computer Science and Information Technology (CS) Session 3
- Question
- 44 of 65, printed as CS Q.34
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.