Design of Modified HRRN Scheduling Algorithm for Priority Systems Using Hybrid Priority Scheme

The basic aim of this paper is to design a scheduling algorithm which is suitable for priority systems and it should not suffer with starvation or indefinite postponement. Highest Response Ratio Next (HRRN) scheduling is a non-preemptive discipline, in which the priority of each job is dependent on its estimated run time, and also the amount of time it has spent waiting. Jobs gain higher priority the longer they wait, which prevents indefinite postponement (process starvation). In fact, the jobs that have spent a long time waiting compete against those estimated to have short run times. HRRN prevents indefinite postponements but does not suitable for priority systems. So, modifying HRRN in such a way that it will be suitable for priority based systems.


Introduction
A process is an instance of a computer program that is being executed. The processes waiting to be assigned to a processor are put in a queue called ready queue. The time for which a process holds the CPU is known as burst time. Arrival Time is the time at which a process arrives at the ready queue. The interval from the time of submission of a process to the time of completion is the turnaround time.. Waiting time is the amount of time a process has been waiting in the ready queue. A context switch is the computing process of storing and restoring the state (context) of a CPU so that execution can be resumed from the same point at a later time. This enables multiple processes to share a single CPU. Optimal scheduling algorithm will have minimum waiting time, minimum turnaround time and minimum number of context switches.
The process scheduler is the component of the operating system that is responsible for deciding whether the currently running process should continue running and, if not, which process should run next. There are four events that may occur where the scheduler needs to step in and make this decision: The current process goes from the running to the waiting state because it issues an I/O request or some operating system request that cannot be satisfied immediately.
The current process terminates. A timer interrupt causes the scheduler to run and decide that a process has run for its allotted interval of time and it is time to move it from the running to the ready state. An I/O operation is complete for a process that requested it and the process now moves from the waiting to the ready state. The scheduler may then decide to move this ready process into the running state.
A scheduler is a preemptive scheduler if it has the ability to get invoked by an interrupt and move a process out of a running state and let another process run. The last two events above may cause this to happen. If a scheduler cannot take the CPU away from a process then it is a cooperative or non-preemptive scheduler.
The objective of scheduling algorithms is to assign the CPU to the next ready process based on some predetermined policy. We study the following scheduling algorithms: First-Come First-Served (FCFS) is a non-preemptive algorithm that assigns the CPU to the process in the ready queue that has been waiting for the longest time. This is a simple algorithm and it is not used very often in modern operating systems. A long process could cause a delay for all other processes that arrive after that process.

ISSN: 2303-3703
Shortest Process (Job) Next (SJN) is another non-preemptive algorithm that attempts to decrease the average waiting time (and response time) of the system. This algorithm performs better than FCFS, however, it is not fair to long processes. In general preemptive scheduling algorithms are preferred due to their abilities to switch the CPU to another process even when the current running process is not completed.
In Round Robin (RR) scheduling a time slice is defined and the CPU is assigned to a process for a maximum of one time slice or until the process releases the CPU (whichever comes first). This algorithm requires more overheads but it is fair to all processes and performs better than non-preemptive scheduling algorithms.
Shortest Remaining Time Next (SRTN) is a preemptive version of SJN algorithm where the remaining processing time is considered for assigning CPU to the next process.
Highest Response Ratio Next (HRRN) selects a process with the largest ratio of waiting time over service time. This guarantees that a process does not starve due to its requirements.
Feedback Queue (FQ) scheduling algorithm partitions the ready processes into several separate queues and the processes are assigned to one queue and they are allowed to move between queues. Each queue has its own scheduling algorithm.
In priority systems, each process is assigned a priority and the scheduler will always select the highest priority ready process. Priority queues replace the ready queue, and processes are dispatched, starting with the head of the highest priority queue. There are three possible ways of assigning priorities to processes 1. Statically or externally Priority is assigned by some external system manager before process is scheduled.

Dynamically or internally
Priority is assigned according to an algorithm. 3. Hybrid Priority is assigned by some combination of external and internal schemes.
A problem with such a scenario is low-priority process starvation, in that if there is a steady stream of high-priority ready processes, the low-priority processes may not get any time on the processor.

HRRN scheduling algorithm
Highest Response Ratio Next (HRRN) scheduling is a non-preemptive discipline, in which the priority of each job is dependent on its estimated run time, and also the amount of time it has spent waiting. Jobs gain higher priority the longer they wait, which prevents indefinite postponement (process starvation). In fact, the jobs that have spent a long time waiting compete against those estimated to have short run times. Priority = waiting time + estimated runtime / estimated runtime (Or) Ratio = waiting time + service time / service time Advantages Improves upon SPF scheduling Still non-preemptive Considers how long process has been waiting Prevents indefinite postponement Disadvantages Does not support external priority system. Processes are scheduled by using internal priority system.

RESEARCH METHOD Design of Modified HRRN algorithm
The major problem with HRRN is it will not consider the external priorities of the process.
The Modified HRRN uses the following formula to derive internal priority. Ratio = waiting time + service time / service time -----(1) Here we Consider Hybrid Priority Systems,In Hybrid priority systems the priority is assigned by some combination of external and internal schemes.The Hybrid priority of the

Procedure for Algorithm
Step-1: start Step-2 : Processes with Arrival time,Burst Time and priority are considered.
Step-3 : Ready Queue filled according to arrival times.
Step-4: Hybrid priority is computed for each process using the formula H p = 0.5 * E p + 0.5 * R Step-5: Process with highest hybrid priority is executed first.
Step-7: Now, Calculate average waiting time, average turnaround time, number of context switches.

RESULTS AND ANALYSIS A. Assumptions
All experiments are assumed to be performed in uniprocessor environment and all the processes are independent from each other. Attributes like burst time and priority are known prior to submission of process. All processes are CPU bound. No process is I/O bound. Processes with same arrival time are scheduled.

B. Illustration and Results Case I :
Consider the Processes with following Arrival time, Burst Time and priorities Ratio for p3 = 4+4 / 4 = 2 As process p2 is having highest response ratio than that of p3. Process p2 will be considered for execution and then followed by p3. Since it is Non-preemptive, it executes process p1 completely. It takes 7 ms to complete process p1 execution. Now, among p2 and p3 the process with highest Hybrid priority is chosen for execution. Hybrid priority for p2 will be H p = 0.5 * E p + 0.5 * R = 0.5 * 1 + 0.5 * (5+4 /4) = 1.625 Hybrid priority for p3 will be H p = 0.5 * E p + 0.5 * R = 0.5 * 2 + 0.5 * 2 = 2 As process p3 is having highest hybrid priority than that of p2.So, Process p3 will be considered for execution and then followed by p2.

Conclusion
Modified HRRN is suitable for priority systems and it is not suffering with starvation or indefinite postponement. Also it is producing good results. Therefore, Modified HRRN is suitable for priority systems. In future, the same algorithm can be extended such that it is also applicable to time shared systems.