^{1}

^{1}

^{1}

^{1}

This paper proposes a novel chronically evaluated highest instantaneous priority next processor scheduling algorithm. The currently existing algorithms like first come first serve, shortest job first, round-robin, shortest remaining time first, highest response ratio next and varying response ratio priority algorithm have some problems associated with them. Some of them can lead to endless waiting or starvation and some of them like round-robin has problem of too many context switches and high waiting time associated with them. In the proposed algorithm, we have taken care of all such problems. As the novel algorithm is capable of achieving as good results as shortest remaining time first algorithm and also it will never lead to starvation.

Scheduling algorithm improves processor’s efficiency by improving its utilization. The short-term scheduler uses various algorithms to do assignments for the processor [

As performance of the algorithm may vary under various situations [

On analyzing the existing algorithms we found that they have some withdrawing factors, such as long waiting time or starvation associated with them. To overcome these demerits, we have proposed a novel algorithm for processor scheduling. The novel algorithm considers the instantaneous waiting time and instantaneous remaining time for evaluating the priority. The proposed approach is preemptive and the priority for the processes will be calculated when any new process arrives or any process finishes.

The First come first serve is one of the simplest processor scheduling algorithms [

To overcome this problem the shortest job first algorithm was proposed in which the job with shorter burst time is executed first [

To overcome this starvation problem new Round-robin algorithm was introduced [

In adaptive Round-Robin [

Next in the sequence is the highest response ratio next algorithm [

In 2015, Singh et al. Proposed Varying Response Ratio Priority algorithm. It calculates the priority of each process based on their waiting time and remaining burst time [

The novel algorithm proposed in this paper inherits some features from both highest response ratio next as well as shortest remaining time first approaches. The proposed approach is a preemptive approach. It uses instantaneous remaining time and waiting time together to calculate instantaneous priority.

The proposed chronically evaluated highest instantaneous priority next algorithm is a preemptive approach. It takes the instantaneous remaining time and waiting time of the processes into consideration to calculate their instantaneous priority. Then the process with highest instantaneous priority is allocated to the processor. This also makes this approach a priority base scheduling algorithm.

The AlgorithmThe flow chart included below explains the working of the proposed algorithm (see

The proposed algorithm considers two factors instantaneous remaining time and waiting time to calculate the instantaneous priority. Every time either a process finishes or a new one arrives, the priority for every contributing process is calculated.

where,

BT = Burst Time

Here, P represents the process number for “n” contributing processes and Rem.T is their respective remaining time. First the sum of remaining time from process 1 to n is calculated. Then the sum is divided by “n” to get mean value as Mean Rem.T. When waiting time of any process increases its priority will also increase. As no process has to wait endlessly. Hence,

Time will come when chronically increasing priority of that process will become considerably high to take over the processor from any other process with even smaller remaining time. This is called inversion of execution order.

The priority value will also increase with decreasing remaining time of any process, as shorter jobs should be executed first. Hence,

The exponent “n” in the denominator of the formula for calculating instantaneous priority is there to lowers the sharp growth of priority value for any process which has large waiting time. For the higher value of “n” the whole denominator term will become a huge value. Hence even for the process with large waiting time the priority will not increase sharply. This will make the priority value to increase slowly and the priority inversion will be delayed. Which will eventually enhance the performance by keeping the average waiting time for the process low. In the formula the constant 1 is added to the first ratio, so that when the waiting time of any process is zero the value of the first factor will become one. As initially when processes will arrive their waiting time

will be zero. Hence the factor

By scaling we mean to arrange all the processes on same scale with respect to the mean remaining time value. This will help to measure the processes priority on the same scale for getting a proper response. So the second ratio arranges the processes in order to which the enhancement values obtained from the first ratio are multiplied to obtain the instantaneous priority.

Let there be “I” number of processes initially in ready queue as_{k} be the process with highest burst time of T_{k} and sum of burst time for all (i-1) processes except P_{k} is

Or,

Now this expression 2 will be used to decide the value of exponent “n” in the formula.

During the run, cases may arise when processes may have same priority. In such cases process with shorter remaining time should be preferred, as it will make CEHIPN to behave like shortest remaining time first algorithm. If their remaining time is also same then any of the process can be chosen. Hence in this case of equality of process priority the below equality holds,

On rearranging the above expression, we will have,

When remaining time of the processes is same, then in expression 4 mentioned above we have,

Let,

Now the expression 4 can be rewritten as,

Or,

Or,

Therefore, when remaining time is same for both the processes then their waiting time will also be same. Hence anyone of them can be considered for next execution.

In this case, when both processes are having different remaining time but same priority. We can recall expression 4,

Now,

As given that,

Hence,

Or,

Expression 8 shows that waiting time of Pi is also greater than that of Pj. But priority of both the processes is still same. In this case, the process with smaller remaining time value will be selected next, as waiting time is included in expression 1 to increase the priority to avoid starvation only.

Consider the average waiting time at current instance as AWT for 'm' number of contributing processes. Now if process Pi with larger remaining time is executed first instead of Pj. Then average waiting time at the end, when both processes will finish, will be AWT(i). where,

On the other hand if Pj is executed first. Then average waiting time at the end, when both processes will finish, will be AWT(j). where,

Since Rem.Ti is greater than Rem.Tj. Hence AWT(i) will also be greater than AWT(j). We also know that average waiting time should be kept to minimum for the best performance. Hence second approach of selecting Pj will give better result. Therefore, when priority is same and it comes to selection between two processes. Then process with shorter remaining time will be selected first.

The performance of the algorithm can be analyzed by comparing the average waiting time, average response time and number of context switches of CEHIPN with other algorithms. We have considered the burst time of the processes in increasing, decreasing and random orders to generate four different cases. Then theoretical calculations are performed to obtain below data for analysis.

In Case I processes are arriving in random order of burst time and exponent “n” will take three different values 1, 2 and 3 respectively for three different calculations (see

Process | Arrival Time (ms) | Burst Time (ms) |
---|---|---|

P_{1 } | 0 | 10 |

P_{2 } | 1 | 3 |

P_{3 } | 3 | 5 |

P_{4 } | 4 | 4 |

P_{5 } | 10 | 6 |

Average Waiting Time (ms) | Average Response Time (ms) | Number of Context Switches (ms) | |
---|---|---|---|

CEHIPN With n = 1 (See | 5.8 | 3.4 | 5 |

CEHIPN With n = 2 (See | 5.2 | 1.6 | 5 |

CEHIPN With n = 3 (See | 5.2 | 1.6 | 5 |

FCFS (See | 9 | 9 | 4 |

SJF (See | 8.8 | 8.8 | 4 |

SRTF (See | 5.2 | 1.6 | 5 |

RR With Time Quantum = 7 (See | 9.6 | 7.2 | 5 |

HRRN (See | 8.8 | 8.8 | 4 |

VRRP (See | 7.8 | 6.4 | 6 |

MARR (See | 8.8 | 8.8 | 4 |

Adaptive RR (See | 8.8 | 8.8 | 4 |

Round #1: Time = 1 (P2 arrives)

Priority P1 = 0.67

Priority P2 = 2

P2 is selected.

Round #2: Time = 3 (P3 arrives)

Priority P1 = 0.68

Priority P2 = 5

Priority P3 = 1

P2 is selected.

Round #3: Time = 4 (P2 finished and P4 arrives)

Priority P1 = 0.89

Priority P3 = 1.44

Priority P4 = 1.5

P4 is selected.

Round #4: Time = 8 (P4 finished)

Priority P1 = 1.38

Priority P3 = 2.8

P3 is selected.

Round #5: Time = 10 (P5 arrives)

Priority P1 = 1.33

Priority P3 = 5.33

Priority P5 = 1

P3 is selected.

Round #6: Time = 13 (P3 finished)

Priority P1 = 1.94

Priority P5 = 1.88

P1 is selected. Here the priority of P1 got amplified, as it was waiting for a long time. It got selected over P5 which even has a smaller remaining time. Ensuring there will be no starvation.

Also in Case II the processes are arriving in random order of burst time and value of exponent “n” in three different calculations of CEHIPN is 1,2 and 3 respectively (see

In Case III the processes are arriving in decreasing order of burst time (see

Process | Arrival Time (ms) | Burst Time (ms) |
---|---|---|

P1 | 0 | 3 |

P2 | 2 | 7 |

P3 | 3 | 12 |

P4 | 4 | 4 |

P5 | 8 | 5 |

P6 | 19 | 11 |

In this case we will get same values for all the algorithms. As the burst time is in increasing order. So the shorter job will always come first and will be executed first, resulting in same sequence as for the shortest remaining time first algorithm (see

Average Waiting Time (ms) | Average Response Time (ms) | Number of Context Switches (ms) | |
---|---|---|---|

CEHIPN With n = 1 (See | 6.5 | 5.8 | 6 |

CEHIPN With n = 2 (See | 6.3 | 4.8 | 6 |

CEHIPN With n = 3 (See | 6.2 | 4.7 | 6 |

FCFS (See | 9.3 | 9.3 | 5 |

SJF (See | 6.8 | 6.8 | 5 |

SRTF (See | 6.2 | 4.7 | 6 |

RR With Time Quantum = 7 (See | 9.2 | 7.7 | 6 |

HRRN (See | 6.8 | 6.8 | 5 |

VRRP (See | 7.2 | 6.5 | 6 |

MARR (See | 9.3 | 9.3 | 5 |

Adaptive RR (See | 9.3 | 9.3 | 5 |

Process | Arrival Time (ms) | Burst Time (ms) |
---|---|---|

P1 | 0 | 11 |

P2 | 1 | 10 |

P3 | 2 | 8 |

P4 | 6 | 7 |

P5 | 26 | 6 |

Average Waiting Time (ms) | Average Response Time (ms) | Number of Context Switches (ms) | |
---|---|---|---|

CEHIPN With n = 1 (See | 10.8 | 2.8 | 6 |

CEHIPN With n = 3 (See | 10 | 0.8 | 6 |

FCFS (See | 12.4 | 12.4 | 4 |

SJF (See | 10.4 | 10.4 | 4 |

SRTF (See | 10 | 0.8 | 6 |

RR With Time Quantum = 10 (See | 16.8 | 11.8 | 5 |

HRRN (See | 11.4 | 11.4 | 4 |

VRRP (See | 12.4 | 5.8 | 6 |

MARR (See | 11.2 | 11.2 | 4 |

Adaptive RR (See | 11.2 | 11.2 | 4 |

Process | Arrival Time (ms) | Burst Time (ms) |
---|---|---|

P1 | 0 | 2 |

P2 | 1 | 6 |

P3 | 4 | 8 |

P4 | 6 | 10 |

P5 | 8 | 15 |

Average Waiting Time (ms) | Average Response Time (ms) | Number of Context Switches (ms) | |
---|---|---|---|

CEHIPN With n = 1 | 6.6 | 6.6 | 4 |

FCFS | 6.6 | 6.6 | 4 |

SJF | 6.6 | 6.6 | 4 |

SRTF | 6.6 | 6.6 | 4 |

RR With Time Quantum = 11 | 6.6 | 6.6 | 4 |

HRRN | 6.6 | 6.6 | 4 |

VRRP | 6.6 | 6.6 | 4 |

MARR | 6.6 | 6.6 | 4 |

Adaptive RR | 6.6 | 6.6 | 4 |

In the present study there is comparison of the novel CEHIPN algorithm with First come first serve, Shortest job first, Shortest remaining time first, Round-robin, Highest response ratio next, Varying Response Ratio Priority, Mid Average Round-Robin and Adaptive Round-Robin in terms of number of context switches, average waiting time, and average response time. There are four different cases where the Burst time of the contributing processes is arranged in random, decreasing and increasing orders to get the following results.

In

In

In

In case IV when processes are arranged in increasing order of their burst time, the average waiting time, average response time and the number of context switches for all the considered algorithms are same.

From the results of our study it is inferred that CEHIPN has much better results in terms of average waiting time, and average response time, when compared with First come first serve, Shortest job first, Round-robin, Highest response ratio next, Varying Response Ratio Priority, Mid Average Round-Robin and Adaptive Round-Robin. Also for higher values of exponent “n”, CEHIPN gives same results as Shortest remaining time first, until there

is no inversion of execution order. On the other hand, the number of context switches associated with CEHIPN is same as for Shortest remaining time first. Also the proposed CEHIPN algorithm will never lead to starvation.

In the present study it is concluded that novel CEHIPN algorithm is better than First come first serve, Shortest job first, Round-robin, Highest response ratio next, Varying Response Ratio Priority, Mid Average Round- Robin and Adaptive Round-Robin in terms of average waiting time and average response time. For higher values of exponent “n” CEHIPN gives result same as Shortest remaining time first, until there is no inversion of execution order and also it will never lead to starvation.

Amit Pandey,Pawan Singh,Nirayo H. Gebreegziabher,Abdella Kemal, (2016) Chronically Evaluated Highest Instantaneous Priority Next: A Novel Algorithm for Processor Scheduling. Journal of Computer and Communications,04,146-159. doi: 10.4236/jcc.2016.44013