Revamped Round Robin Scheduling Chhayanath Padhy, M.Tech Student, Government College of Engineering Kalahandi, Odissa, India Dillip Ranjan Nayak, Assistant Professor, Government College of Engineering Kalahandi, Odissa, India Abstract Round robin scheduling algorithm is widely used algorithm in time sharing systems. This is because it gives fair chance to every process in the queue. But the main disadvantage with this algorithm is that it has a fixed time quantum assigned for each process that results a larger number of context switching, larger amount of waiting time and turnaround time. In this paper, we have done some modification with the traditional round robin algorithm. The static time quantum is replaced with a dynamic time quantum calculation in every cycle to reduce the waiting time, turn-around time, number of context switching to make the algorithm more efficient and perform better in comparison with the traditional round robin scheduling algorithm. This paper presents a new CPU scheduling algorithm which shows that RRR performs better than RR algorithm in terms of reducing the number of context switches, average waiting time and average turnaround time.. Keywords: CPU Scheduling, Round Robin, switch, Waiting time, time. Introduction Operating system is an interface between end user and system hardware, so that the user can handle the system in a convenient manner. It controls and coordinates the use of the hardware among various application programs. Main goal of the scheduling is to maximize the different performance metrics such as CPU utilization, throughput and to minimize response time, waiting time and turnaround time. In Round Robin (RR) every process has equal priority and is given a static time quantum after which the process is preempted. Although RR gives improved response time and uses shared resources efficiently, its limitations are larger waiting time, larger turnaround time for processes with variable CPU bursts[4][5]. A. Preliminaries A program in execution is called a process. A processes is 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. The time at which a process arrives is its arrival time. Throughput: number of processes which complete execution per time unit (maximize). time (tat): total amount of time to execute a particular process (minimize).waiting time (wt): amount of time a process has been waiting in the ready queue (minimize). response time: amount of time it takes from when a request is submitted to when the response is produced (minimize); does not include the time for a response to be output In time sharing system, the CPU executes multiple processes by switching among them very fast. The number of times CPU switches from one process to another is called as the number of context switches (cs). B. Scheduling s The various well known CPU scheduling algorithms are First Come First Serve (FCFS), Shortest Job First (SJF), Highest Response Ratio Next (HRRN) and Priority. All the above four algorithms are non-preemptive in nature and are not suitable for time sharing systems. Shortest Remaining Next (SRTN) and Round Robin (RR) are preemptive in nature. RR is most suitable for time sharing systems. C. Related Work SARR algorithm [1] is based on a new approach called dynamic time- quantum, in which time quantum is repeatedly adjusted according to the burst time of the running processes was developed in the year 2009. C.Yashuwaanth [2] in November 2009 proposed a modified RR architecture which overcomes the limitations of simple RR and is suitable for the soft real time systems. The idea of algorithm[3] is to calculate dynamic time quantum by providing control of CPU to lowest burst time process first then highest burst time process present in the list and so on up to N th process. particular unit of time called time quantum, each and every process runs to the limit of the time quantum and the new processes are added to the tail of the ready queue.if the process has the burst time within the limit of the time quantum then that process is executed otherwise that process has to wait for its next cycle, this increases the number of context switches, average turnaround time as well as the average wait time [4] [5]. The Proportional Share Scheduling proposed by Helmy and Dekdouk [7] in November 2007 combines low overhead of round robin algorithms and favor shortest jobs. In the year 2000 Abielmona [6] provided an analytical overview of a myriad of scheduling algorithms. In [8] the author uses an approach by placing the burst time of the jobs in ascending order and then a combination of sorting followed by computation of the median to determine an optimal dynamic time quantum. www.borjournals.com Blue Ocean Research Journals 51
D. Contribution In this paper, we have improved the RR algorithm by taking the dynamic time quantum and the ordering of processes. As static time quantum is a limitation of RR algorithm, we have used the concept of dynamic time quantum. This concept reduces context switching, average waiting time and average turnaround time. E. Organization of the Paper Section 2 shows the proposed approach. Section 3 explains experimental analysis. The whole work and the future scope is discussed in section 4. 2. Proposed RRR In our proposed algorithm, the time quantum is taken as the sum of median and number of process present in the ready queue A. Uniqueness Of Our Approach In our algorithm, the jobs are sorted in ascending order of their burst time to give better turnaround time and waiting time. If time quantum is very small, it causes too many context switches. If it is very large, the algorithm leads to FCFS. So our algorithm solves this problem by taking a dynamic time quantum where the time quantum is repeatedly adjusted according to the remaining burst time of currently running processes. The median can be calculated using the following formulae [3] [8]. Median = Y (n+1)/2 ½ (Y n/2 + Y ((n/2) +1)) If n is odd If n is even Where, M = median, Y = number located in the middle of a group of numbers arranged in ascending order, n = number of processes in the ready queue. Then, the dynamic time quantum is calculated as follows: Dynamic (qt) = (Median + n) Proposed 1. Initialize cs=0, atat=0, awt=0 //Where cs=, atat=average turnaround time, awat=average waiting time 2. While (ready queue! =0) Sort the process in ascending order according to their burst time Find median Then qt= Median + n // where n= No. of remaining processes in ready queue // qt= quantum 3. Assign the qt to each process For each process i=1 to n Pi->qt 4. If a new process arrives or the rest burst time left in the ready queue Update the value of n and go to step2 [End while] 5. Calculate context switches (cs), average waiting time (awt), average turnaround time (atat) 6. Exit B.Illustration Let us consider the process burst time sequence be 10,40,30,20,50, Initially the burst time of all the processes were sorted in ascending order which resulted in sequence 10,20,30,40,50. Then the time quantum of the above burst time which was calculated to be 35 was assigned as the time quantum for all the processes. In the next step remaining burst time of each process was calculated after assigning the time quantum. After first loop the remaining burst time sequence for above processes changed to 0,0, 0,5,15. When a process completes its burst time, it gets deleted from the ready queue automatically. So in this case, the processes P1, P2 and P3 were deleted from the ready queue. Now the remaining burst time were sorted in increasing order and then the recalculated time quantum of these burst times was assigned to remaining process. After sorting the current burst time, the sequence was 5, 15 and the value of time quantum was 12. So 12 were assigned as the time quantum for remaining processes. After second loop the remaining burst time was calculated to be 3. As the only remaining process was P5, the dynamic time quantum 4 was given as the time quantum so that it completes its execution without any context switching. The above process was continued till all the processes were deleted from the ready queue. 3. Experimental Analysis A. Assumptions The environment where all the experiments are performed is a single processor environment and all the processes are independent. All the attributes like burst time, number of processes and the time slice of all the processes are known before submitting the processes to the processor. All processes are CPU bound. No processes are I/O bound. B. Experimental Work Our experiment consists of several input and output parameters. The input parameters consist of burst time, arrival time, time quantum and the number of processes. The output parameters consist of average waiting time, average turnaround time and number of context switches. www.borjournals.com Blue Ocean Research Journals 52
C. Data Set We have performed six experiments for evaluating performance of our new proposed algorithm. For the first three experiments, we have considered the data set as the processes with burst time in increasing, decreasing and random order respectively. D. Experiments Performed: To evaluate the performance of our proposed algorithm, we have taken a set of five processes in six different cases. We have taken 5 processes. The algorithm works effectively even if it is used with a very large number of processes. We have compared the experimental results of our proposed algorithm with the round robin scheduling algorithm with fixed time quantum. Here we have assumed a constant time quantum equal to 25 in all the cases. Avg.waiting [Table-2 Comparison between RR & RRR] (in RR 25 14 160.4 224.2 RRR 60,37,4 7 102.4 166.2 Case 2: Let us assume five processes arriving at time = 0, with decreasing burst time P1 = 82, P2 = 50, P3 = 31, P4 = 27, p5= 19 as shown in TABLE-3. The Table-4 shows the output using RR algorithm and our new proposed algorithm (RRR) Figure-3 and Figure-4 shows Gantt chart for both the algorithms respectively. Case 1: Let us assume five processes arriving at time = 0, with increasing burst time P1 = 13, P2 = 35, P 3 = 46, P4 = 63, p5= 97 as shown in TABLE-1. The Table-2 shows the output using RR algorithm and our new proposed algorithm (RRR) Figure-1 and Figure-2shows Gantt chart for both the algorithms respectively. Processes Arrival Burst P1 0 30 P2 0 44 P3 0 55 P4 0 90 P5 0 100 [Table 1] [Figure-1 Gantt chart for RR in Table- 2] [Table-3] [Figure-3 Gantt chart for RR in Table-4] [Figure-4 Gantt chart for RRR in Table-4] [Figure-2 Gantt chart for RRR in Table-2] Avg. waiting (i n (in RR 25 10 128 169.8 RRR 36,32,15 7 61 102.8 [Table-4 Comparison between RR & RRR] Case 3: Let us assume five processes arriving at time = 0, with random burst time P1 = 43, P2 = 87, P3 = 15, P4 = 27, p5= 38 as shown in TABLE-5. The Table-6 shows the output using RR algorithm and our new pro- www.borjournals.com Blue Ocean Research Journals 53
posed algorithm (RRR) Figure-5 and Figure-6 shows Gantt chart for both the algorithms respectively. [Table-6 Comparison between RR & RRR] Case 4: Let us assume five processes arriving at different times 0, 2, 4, 6, 10 respectively with increasing burst time (P1 = 10, P2 = 22, P3 = 30, P4 = 65, p5= 77) as shown in TABLE-7. The Table-8 shows the output using RR algorithm and our new proposed algorithm (RRR). Figure-7 and Figure-8 shows Gantt chart for both the algorithms respectively. [Figure-5 Gantt chart for RR in Table-6] [Figure-6 Gantt chart for RR in Table-6] Processes Arrival Burst P1 0 10 P2 2 22 P3 4 30 P4 6 65 P5 10 77 [Table-7] Avg.waiting (in RR 25 10 61.8 107 RRR 10,51,22,5 7 52 92.8 [Figure 7 Gantt chart for RR in Table-8] [Figure 8 Gantt chart for RRR in Table-8] [Table-8 Comparison between RR & RRR] [Figure-6 Gantt chart for RR in Table-6] Case 5: Let us assume five processes arriving at different times 0, 2, 4, 6, 8 respectively with decreasing burst time (P1 = 75, P2 = 69, P3 = 65, P4 = 13, p5= 9) as shown in TABLE-9. The Table-10 shows the output using RR algorithm and our new proposed algorithm (RRR). Figure-9 and Figure-10 shows Gantt chart for both the algorithms respectively. www.borjournals.com Blue Ocean Research Journals 54
Processes Arrival Burst P1 0 75 P2 2 69 P3 4 65 P4 6 13 P5 8 9 [Table-9] [Table-11] [Figure 9 Gantt chart for RR in Table-10] [Figure-11 Gantt chart for RR in Table-12] [Figure-12 Gantt chart for RRR in Table-12] [Figure 10 Gantt chart for RR in Table-10] Avg.waiting (in Avg.waiting Turnaroun d (in RR 25 10 109.6 165.8 RRR 75,43,26 6 88.2 134.4 [Table-10 Comparison between RR & RRR] Case 6: Let us assume five processes arriving at different times 0, 3, 4, 7, 10 respectively with random burst time (P1 = 70, P2 = 85, P3 = 60, P4 = 45, p5= 100) as shown in TABLE-11. The Table-12 shows the output using RR algorithm and our new proposed algorithm (RRR). Figure-11and Figure-12 shows Gantt chart for both the algorithms respectively. RR 25 10 61.8 107 RRR 10,51,22,5 7 52 92.8 [Table-12 Comparison between RR & RRR] Avg. waiting RR 25 10 61.8 107 RRR 10,51,22,5 7 52 92.8 www.borjournals.com Blue Ocean Research Journals 55
Fig.13: Comparison of average waiting time taking static and dynamic time quantum for increasing, decreasing and random burst sequence. Fig.14: Comparison of average turnaround time taking static and dynamic time quantum for increasing, decreasing and random burst sequence. www.borjournals.com Blue Ocean Research Journals 56
Fig.15: Comparison of context switch taking static and dynamic time quantum for increasing, decreasing and random burst sequence. Fig.16: Comparison of average waiting time taking static and dynamic time quantum for increasing, decreasing and random burst sequence taking different arrival time into account. www.borjournals.com Blue Ocean Research Journals 57
Fig.17: Comparison of average turnaround time taking static and dynamic time quantum for increasing, decreasing and random burst sequence taking different arrival time into account. Fig.18: Comparison of context switch taking static and dynamic time quantum for increasing, decreasing and random burst sequence taking different arrival time into account www.borjournals.com Blue Ocean Research Journals 58
4. Conclusion From the performed experiment with the utilized new algorithm, it is found out that in the new approach the performance is enhanced in terms of context switching, average waiting time and average turnaround time. This causes better performance of the uniprocessor system 5. References [1] Rami J. Matarneh. Self-Adjustment in Round Robin Depending on Burst of Now Running Processes, American J. of Applied Sciences 6(10):1831-1837, 2009, ISSN 1546-9239. [2] C. Yaashuwanth, Dr. R. Ramesh. A New Scheduling s for Real Tasks, (IJCSIS) International Journal of Computer Science and Information Security, Vol.6, No.2, 2009. [3] H.S. Behera, R. Mohanty, Debashree Nayak A New Proposed Dynamic with Readjusted Round Robin Scheduling and its Performance Analysis, International Journal of Computer Applications(0975-8887) Volume 5- No.5, August 2010. [4] Silberschatz, A., P.B.GalvinandG.Gagne, 2004. Operating Systems Concepts. 7th Edn. John Wiley and Sons, USA., ISBN: 13:978-0471694663, pp: 944. [5] Tanebun, A.S., 2008, Modern Operating Systems.3rd Edn. Prentice Hall, ISBN: 13:9780136006633, pp: 1104. [6] Rami Abielmona, Scheduling ic Research, Department of Electrical and Computer Engineering Ottawa- Carleton Institute, 2000. [7] Tarek Helmy, Abdelkader Dekdouk, " Burst Round Robin: As a Proportional-Share Scheduling ", IEEE Proceedings of the fourth IEEE-GCC Conference on towards Techno-Industrial Innovations, pp. 424-428, 11-14 November, 2007. [8] Debashree Nayak,Sanjeev Kumar Malla, Debashree Debadarshini, Improved round robin scheduling using dynamic time quantum, International Journal of Computer Applications (0975 8887),Volume 38 No.5, January 2012. www.borjournals.com Blue Ocean Research Journals 59