The Gateway to Computer Science Excellence

First time here? Checkout the FAQ!

x

+15 votes

Consider three processes (process id $0$, $1$, $2$ respectively) with compute time bursts $2$, $4$ and $8$ time units. All processes arrive at time zero. Consider the longest remaining time first (LRTF) scheduling algorithm. In LRTF ties are broken by giving priority to the process with the lowest process id. The average turn around time is:

- $13$ units
- $14$ units
- $15$ units
- $16$ units

+24 votes

Best answer

A.

Gantt Chart is as follows.

$P2$ | $P2$ | $P2$ | $P2$ | $P1$ | $P2$ | $P1$ | $P2$ | $P0$ | $P1$ | $P2$ | $P0$ | $P1$ | $P2$ |

P.ID | A.T | B.T | C.T | T.A.T. | W.T. |

$P0$ | $0$ | $2$ | $12$ | $12$ | $10$ |

$P1$ | $0$ | $4$ | $13$ | $13$ | $9$ |

$P2$ | $0$ | $8$ | $14$ | $14$ | $6$ |

TOTAL | $39$ | $25$ |

A.T.$=$ Arrival Time

B.T.$=$ Burst Time

C.T$=$ Completion Time.

T.A.T.$=$ Turn Around Time

W.T= Waiting Time.

Average TAT $= 39/3 = 13$ units.

+7 votes

Here,

LRTF means the process which has remaining time largest will run first and in case of same remaining time lowest **process_id **will be given priority to run.

First 4 sec ,P2 will run . then P2 remaining time =4 ,p1=4,p0=2.

Now P1 will get chance to run for 1 sec. P2=4,p1=3,p0=2.

Now p2 will get chance to run for 1 sec, P2=3,p1=3,p0=2.

This way if we do carefully, TAT of P1 will be 14 sec,p1=13 sec and p0= 12 sec.

Total TAT = 14+13+12= 39

Avg TAT= 39/3 =13 sec.

- All categories
- General Aptitude 1.3k
- Engineering Mathematics 5.4k
- Digital Logic 2.1k
- Programming & DS 3.9k
- Algorithms 3.4k
- Theory of Computation 4.2k
- Compiler Design 1.6k
- Databases 3.1k
- CO & Architecture 2.7k
- Computer Networks 3.1k
- Non GATE 1.1k
- Others 1.4k
- Admissions 501
- Exam Queries 447
- Tier 1 Placement Questions 19
- Job Queries 62
- Projects 12

37,941 questions

45,453 answers

131,195 comments

48,210 users