Question
Consider the following set of processes that need to be scheduled on a single CPU. All the times are given in milliseconds.
| Process Name | Arrival Time | Execution Time |
|---|---|---|
| A | 0 | 6 |
| B | 3 | 2 |
| C | 5 | 4 |
| D | 7 | 6 |
| E | 10 | 3 |
Using the shortest remaining time first scheduling algorithm, the average process turnaround time (in msec) is ____________________.
Official answer and solution
- Official answer
- 7.2
- From
- Official GATE 2014 answer key
Solution
Construct the execution Gantt chart under Shortest Remaining Time First (SRTF) scheduling and calculate average turnaround time.
Given processes:
- : Arrival 0, Burst 6
- : Arrival 3, Burst 2
- : Arrival 5, Burst 4
- : Arrival 7, Burst 6
- : Arrival 10, Burst 3
Execution trace:
- : Process runs. At , remaining burst of .
- At : arrives with burst 2. Since , preempts .
- : Process runs. At , completes ().
- At : arrives with burst 4. Remaining: . runs because .
- : Process runs. At , remaining burst of .
- At : arrives with burst 6. Remaining: . has shortest remaining time.
- : Process runs and completes at ().
- At : Ready queue has . runs.
- : Process runs. At , remaining burst of .
- At : arrives with burst 3. Remaining: . has shortest remaining time.
- : Process runs and completes at ().
- At : Ready queue has . runs.
- : Process runs and completes at ().
- : Process runs and completes at ().
Turnaround time ():
Sum of Turnaround Times = .
7.2
Calculating average waiting time instead of average turnaround time.
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2014 Computer Science and Information Technology (CS) Session 1
- Question
- 42 of 65, printed as CS Q.32
- 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.