Highest response ratio next

Highest response ratio next (HRRN) scheduling is a non-preemptive discipline. It was developed by Brinch Hansen as modification of shortest job next or shortest job first (SJN or SJF) to mitigate the problem of process starvation. In HRRN, the next job is not that with the shortest estimated run time, but that with the highest response ratio defined as

$$response\ ratio = \frac{waiting\ time\ of\ a\ process\ so\ far + estimated\ run\ time}{estimated\ run\ time} = 1 + \frac{waiting\ time\ of\ a\ process\ so\ far}{estimated\ run\ time}$$

This means, the jobs that have spent a long time waiting compete against those estimated to have short run times. As you can see in the above equation of response ratio, if the waiting time of a process increases, its response ratio increases making the long-awaited process to execute next. So, this algorithm solves the starvation problem that exists in SJN scheduling algorithm.

Algorithm
Given a Linked list Q, iterate through Q to find the highest ratio by comparing each ratio within the queue. Once a ratio of element N is greater than the element M with the highest ratio replace element M with element N as the highest ratio element in the list. Once the end of the list is reached dequeue the highest ratio element. If the element is at the start of the list, dequeue it and set the list to its next element, returning the element. Otherwise N's neighbours are reassigned to identify each other as their next and previous neighbour, returning the result of N.