1. Shortest remaining time first
  2. Round robin with time quantum less than the shortest CPU burst
  3. Uniform random
  4. Highest priority first with priority proportional to CPU burst length
4 views

1 Answers

Option 1 : Shortest remaining time first

Concept:

Waiting time:

It is the total time spent by the process in the ready state waiting for CPU.

Shortest remaining time first:

This algorithm is the pre-emptive shortest job first algorithm and optimal. In this process having small running time remaining until completion are selected to execute first, this can also cause starvation. But in shortest remaining time first algorithm, turnaround time, waiting time is minimum and CPU utilization is high.

Example:

Process

Arrival time

Burst time

P1

0

5

P2

1

7

P3

2

3

 

For shortest remaining time first,

Gantt chart:

P1

P2

P3

P3

P1

P2

0            1               2              3              5              9            15

Average waiting time in SRTF = 3.67 ms (Burst time are in ms)

For round robin scheduling with TQ = 1

Gantt chart:

P1

P2

P1

P3

P2

P1

P3

P2

P1

P3

P2

P1

P2

0     1      2      3      4      5      6      7      8      9     10    11    12   15

Average waiting time in RR = 6.33 ms

For uniform random (say FCFS)

Gantt chart:

P1

P2

P3

0               5               12             15

Average waiting using FCFS = 4.67 ms

Priority scheduling algorithm:

In this example, average waiting time for this = 4.67 ms

Therefore, Shortest remaining time first algorithm has minimum average waiting time.

4 views

Related Questions