ENHANCED ROUND ROBIN ALGORITHM FOR PROCESS SCHEDULING USING VARYING QUANTUM PRECISION 1 AASHNA BISHT, 2 MOHD ABDUL AHAD, 3 SIELVIE SHARMA Department of Computer Science, Jamia Hamdard, New Delhi Abstract: The performance of a processor can be defined in terms of how well it manages different processes coming to the CPU for execution. In this paper we are providing an improvement of the conventional round robin algorithm by dynamically modifying the time quantum. In our proposal, we will slightly modify the time quantum for the processes that require only a fractional greater time than the allotted time quantum cycle(s) to complete their execution. Keywords: Context Switches, Scheduling, Turnaround Time, Waiting Time. I. INTRODUCTION A processor can be termed as effectively performing if it performs the tasks of process management in an optimal way. The effectiveness of the processor can be judged mainly in terms of the following parameters. A. Turnaround Time: It is defined as the time spent by the process since its inception till it completes its execution. Mathematically it is defined as the difference between the arrival time and the time it finally completes its execution [13], [14]. B. Wait Time: It is defined as the time spent by the processes waiting for its chance to get the CPU. Mathematically it is defined as the difference between the Turnaround time and the burst time of a process P [14], [15]. C. Throughput: It gives the number of processes executed by the processor per unit time [12], [13], [14]. D. Context Switches: It is the number of times the CPU is given to and taken back from the process. E. Response Time: It is defined as the time required by the CPU to give a response to the process. The processor is said to be performing well if it gives minimum average turnaround time, waiting time and response time, maximum throughput and a minimum context switches [1], [2], [14], [15]. For performing the task of process scheduling there are various conventional algorithm. Some of them include [14], [15]: A. First Come First Serve: In this algorithm the CPU is allocated to the process that arrives first at the CPU [14], [15]. Then the CPU is allocated to the next arrived process and so on. It is being held by the process till the time it does not complete its execution or performs an I/O operation [1], [14], [15]. B. Shortest Job First: In this algorithm, the CPU is allocated to the process with the minimum burst time [1], [13], [14]. Then it is allotted to the process with the next higher burst time and so on. Here also the CPU is not taken away from the process till it finishes its execution or performs an I/O operation [1], [2], [14], [15]. C. Round Robin: In this algorithm, the processes are executed in first come first serve manner [1], [13], [14]. However a fixed amount of time period, known as time quantum is assigned to each process. If the process completes its execution within this time period, it is removed from the ready queue; otherwise it goes back at the end of the queue and waits for its next chance to get the CPU [1], [2] [15]. II. PRELIMINARIES There are numerous researches going around the globe on improving the effectiveness of round robin algorithm. The author of [1] proposes a fuzzy approach to find the suitable time quantum for the processes. They have presented the results using various simulations. The novelists of [2] propose a median based approach to find the time quantum, combining the conventional shortest job first and Round Robin algorithms. The authors of [3] proposes a new technique using maximum and minimum burst time of the set of processes in the ready queue and calculating a modified time quantum. The authors of [4] talks about calculating the time quantum using median and highest burst time and then executing the processes as per the new calculated time quantum. The researchers of [5] provided a mathematical model for calculating the waiting time and turnaround time. The authors of [6] talks about calculating the mean of the burst times of all the processes and then finds the difference between the mean of the burst time and the burst time of a particular process and allocates the CPU to the process which has the maximum difference. III. PROPOSED APPROACH Our proposed approach does not aim to change the philosophy of the conventional round robin algorithm 11
but to enhance it further. In our proposed approach, we will be modifying the time quantum of only those processes which require a slightly greater time than the allotted time quantum cycle(s). The remaining processes will be executed in the conventional Round Robin manner. The complete pseudo code of the proposed approach is given below. A. Abbreviations Used TQ: Time Quantum BT [ ]: (Burst Time): An Array consisting the Burst time of the Processes RT [ ]: (Remaining Time): Array containing the Remaining Time of the Process after the last but one turn. The value of RT [ ] is calculated as: RT [P i ] = BT [P i ] % TQ NOC [ ]: (Number of Cycles): An array consisting of the value of quotient when the burst time BT [P i ] is divided by TQ. It is calculated as: NOC [ ] = ceil (BT [P i ] / TQ), where ceil function gives the largest integer greater than or equal to the number. K = Threshold value. It is calculated as follows K = floor (( (BT [P i]) / N) / TQ), where Floor function gives the greatest integer less than or equal to the number. B. Pseudo Code for the Proposed C. pothetical Examples This section consists of few hypothetical examples for calculating the parameters like average turnaround time, average waiting time and the number of context switches. Example 1: Table 1(a): Set of Processes with their Burst Times Figure 1(a): Gantt chart for Example 1 as per Conventional Calculations using the classical : = (52+57+90+108+101) / 5 = 408 / 5 = 81.6 = [(52-12) + (57-15) + (90-23) + (108-37) + (101-21)] / 5 = 300 / 5 = 60 Number of Context Switches = 13 Table 1(b): Set of Processes with their Burst Times 12 Calculation of K K = Floor [((12+15+23+37+21) /5) /TQ] = 2 Now as per the proposed approach we will modify the time quantum for those processes for which the remaining time is less than or equal to K. These processes are P1 and P5. However the time quantum will be increased only in their last CPU cycle. For other cases, the processes will be executed as per the classical round robin algorithm with the original time quantum value.
Figure 1(b): Gantt chart using the proposed approach. Calculation of K= Floor [((19+09+23+13+17)/5) / TQ] = 4 Calculations as per the Proposed : = (12+57+91+108+88) / 5 = 356 / 5 = 71.2 = [(12-12) + (57-15) + (91-23) + (108-37) + (88-21)] / 5 = (0+42+68+71+67) / 5 = 248 / 5 = 49.6 Number of Context Switches = 10 Example 2: Table 2(a): Set of Processes with their Burst Times Figure 2(b): Gantt chart for Example 2 as per proposed Calculations using the Proposed : = 65+29+81+54+74/5 = 303/5 = 60.6 = 46+20+58+41+57/5 = 222/5 = 44.4 No. of Contest Switches = 18 Example 3: Table 3(a): Set of Processes with their Burst Times Figure 2(a): Gantt chart for Example 2 as per conventional Calculations as per Classical Round Robin Algorithm: = (73+45+81+66+78) / 5 =343/5 =68.6 = (54+36+58+53+61)/5 = 262/5 = 52.4 Number of Context Switches = 22 Table 2(b): Set of Processes with their Burst Times Figure 3(a): Gantt chart for Example 3 as per Conventional Calculations as per : = (69+31+92+98+80) / 5 = 74 = [(69-18) + (31-06) + (92-27) + (98-31) + (80-16)] / 5 = (51+25+65+67+64) / 5 = 54.4 Number of Context Switches = 21 Table 3(b): Set of Processes with their Burst Times 13
Figure 3(b): Gantt chart for Example 3 as per Proposed Calculations as per Proposed = (54+11+87+98+70) / 5 = 64 = [(54-18) + (11-06) + (87-27) + (98-31) + (70-16)] / 5 = (36+5+60+67+54) / 5 = 44.4 Number of Context Switches = 16 Example 4: Table 4(a): Set of Processes with their Burst Times Figure 4(b): Gantt chart for Example 4 as per Proposed Calculations as per the Proposed : = (260+ 257+ 183+ 205+ 220+ 122) / 6 = 1247 / 6 = 207.83 = [(260-63) + (257-57) + (183-41) + (205-42) + (220-35) + (122-22) / 6 = (197+ 200+ 142+ 163+ 185+ 100) / 6 = 987 / 6 = 164.5 Number of Context Switches = 13 IV. RESULTS AND CONCLUSIONS In this paper an improvement for the conventional round robin algorithm is proposed which is being supported by a set of hypothetical examples and a good amount of improvement is observed. The figures presented here give the comparison between the conventional Round Robin algorithm and the Proposed Figure 4(a): Gantt chart for Example 3 as per Conventional Calculations as per : = (260+ 254+ 255+ 257+ 215+ 217) / 6 = 1458 / 6 = 243 = = [(260-63) + (254-57) + (255-41) + (257-42) + (215-35) + (217-22)] / 6 = (197+ 197+ 214+ 215+ 180+ 195) / 6 = 1198 / 6 = 199.66 Number of Context Switches: 16 Figure 5. Comparison Graph for Example 1 Table 4(b): Set of Processes with their Burst Times 14 Figure 6. Comparison Graph for Example 2
REFERENCES Figure 7. Comparison Graph for Example 3 Figure 8. Comparison Graph for Example 4 In the best case scenario, the proposed improvement will save atleast N context switches reducing the overhead of the CPU to a large extent moreover the average turnaround time and the average waiting time will also gets reduced. And in the worst case scenario, the proposed improvement will work exactly in the similar manner as the conventional round robin algorithm. [1] Bashir Alam, Fuzzy Round Robin CPU Scheduling Algorithm, Journal of Computer Science, 9(8) : 1079-1085, 2013 2013 Science Publications. [2] Lalit Kishor, Dinesh Goyal, Time Quantum Based Improved Scheduling Algorithm, Volume 3, Issue International Journal of Advanced Research in Computer Science and Software Engineering. ISSN: 2277 128X, 4, April, 2013. [3] P. Surendra Varma, A Best possible time quantum for Improving Shortest Remaining Burst Round Robin (SRBRR) Algorithm, International Journal of Advanced Research in Computer Science and software Engineering, Volume 2, Issue 11, ISSN: 2277 128X, November 2012. [4] KN Rout, G.Das,B.M. Sahoo,A.K. Agrawalla,,Improving Average Waiting Time Using Dyanamic Time Quantum. [5] Shahram Saeidi, Hakimeh Alemi Baktash, Determining the Optimum Time Quantum Value in Round Robin Process Scheduling Method, International Journal of Information Technology and Computer Science, pp: 67-73 2012 [6] RNDSS Kiran, Polinati Vinod Babu, B.B Murali Krishna, Optimizing CPU Scheduling for Real Time Application Using Mean-Difference Round Robin (MDRR) Algorithm. [7] H.S. Behera, Simpi Patel, Bijayalakshmi Panda, A New Dynamic Round Robin and SRTN Algorithm with Variable Original Time Slice and Intelligent Time Slice for Soft Real Time Systems, [8] http://gama.vtu.lt/biblioteka/operating_systems/ Operating_syst ems.pdf [9] http://www.cs.kent.edu/~farrell/osf03/oldnotes/ L05.pdf [10] http://nptel.iitm.ac.in/courses/webcoursecontents/iisc-bang/operating% 20Systems/ pdf/lecture_notes/mod%201_ln.pdf [11] http://www.cs.kent.edu/~farrell/osf03/ oldnotes/l06.pdf [12] Supriya Raheja,, Reena Dhadich, Smita Rajpal, An Optimum Time Quantum Using Linguistic Synthesis for Round Robin CPU Scheduling Algorithm, International Journal on Soft Computing ( IJSC ) Vol.3, No.1, February 2012 [13] Silberschatz, A. P.B. Galvin and G. Gagne (2012), Operating System Concepts, 8th edition, Wiley India [14] Operating Systems Sibsankar Haldar 2009, Pearson Education, India [15] D.M. Dhamdhere operating Systems A Concept Based, Second edition, Tata McGraw-Hill, 2006. 15