HRNN Example

In the following example, there are 5 processes given. Their arrival time and Burst Time are given in the table.

Process IDArrival TimeBurst Time
003
125
244
361
482

At time 0, The Process P0 arrives with the CPU burst time of 3 units. Since it is the only process arrived till now hence this will get scheduled immediately.

os hrrn scheduling

P0 is executed for 3 units, meanwhile, only one process P1 arrives at time 3. This will get scheduled immediately since the OS doesn't have a choice.

os hrrn scheduling 1

P1 is executed for 5 units. Meanwhile, all the processes get available. We have to calculate the Response Ratio for all the remaining jobs.

Since, the Response ratio of P3 is higher hence P3 will be scheduled first.

os hrrn scheduling 2

P3 is scheduled for 1 unit. The next available processes are P2 and P4. Let's calculate their Response ratio.

The response ratio of P2 is higher hence P2 will be scheduled.

os hrrn scheduling 3

Now, the only available process is P4 with the burst time of 2 units, since there is no other process available hence this will be scheduled.

os hrrn scheduling 4
Process IDArrival TimeBurst TimeCompletion TimeTurn Around TimeWaiting Time
003330
125861
2441395
361932
4821575

                     Average Waiting Time = 13/5