EXTRA THRESHOLD IN ROUND ROBIN ALGORITHM IN MULTIPROCESSOR SYSTEM 1 AISHWARYA ARORA, 2 HIMANSHI BHATIA 1,2 Department of Computer Science, Jamia Hamdard, New Delhi, Delhi E-mail: aishwaryaa30@gmail.com, 18himanshi@gmail.com Abstract- The prevalent Round Scheduling Algorithm makes use of a variable, Time Quantum for its pre-emption which allots a slice of time to the processors to switch between the processes. Setting the quantum too small causes lot many process switching and reduce the CPU efficiency, but setting it large results in starvation of other processes in the queue. The conventional Round algorithm does not allow any process to be allocated to the processor for more than one Time Quantum. So, if a process has a burst time less than or equal to the time quantum then the process is executed in one go but if a fraction of burst time is left over then the process is moved to the tail of the ready queue and waits till other processes in the ready queue executes following the FCFS decorum. This procedure is continued until the process terminates. Our proposed Round Scheduling for multiprocessor system (considering homogeneous CPUs) cites a new variable ET (Extra Threshold) which has a value equal to 10% of the time quantum in a system. The processes with burst time less than or equal to the added result of Time Quantum and Extra Threshold (TQ+ET) are able to execute in the same time slice without having to wait in the ready queue for their allocation to the processor in the next time cycle. This ameliorates the conventional Round by improving the throughput, turnaround time and waiting time. Keywords- Time Quantum, Extra Threshold, Turnaround Time, Waiting Time, Context Switch I. INTRODUCTION II. RELATED WORK A multiprocessor system provides a benefit of concurrent employment of more than one CPU. This makes the Work- Load Balancing important so that the processes are almost equally distributed among the CPUs and no process waits for more than (n- 1)*TQ time for being allocated to the processor, where n is the number of process here. The different types of scheduling algorithms are given below: First Come First Serve (FCFS) is a nonpreemptive algorithm which follows FIFO (First In, First Out) principle. It suffers from convoy effect and results in lower CPU and device utilization. Shortest Job First (SJF), more appropriately known as Shortest-Next-CPU-First algorithm. Scheduling depends upon the length of next CPU burst of a process [3]. It cannot be implemented in short term scheduling i.e. CPU scheduling. In Priority Scheduling, processes are prioritized. The process with higher seniority is executed first and processes with equal priority are served on FCFS basis. The Round Algorithm (RR) follows preemptive FCFS in which preemption is defined through a small unit of time known as the time quantum. In Multilevel Queue Scheduling, multiple queues are managed with few processes in foreground queue and others in background queue. Both the queues can operate on any of the scheduling algorithms (FCFS, SJF, RR and others mentioned above). Multilevel Feedback Queue Scheduling Algorithm is akin to multilevel queue scheduling which allows switching of processes from one queue to another. Various notable researches for improving the conventional Round have been carried out around the globe. The novelist of suggests improving the Round (RR) algorithm using dynamic Intelligent Time Slice (ITS) by merging it with Shortest Remaining Time Next (SRTN) algorithm. The authors of calculate the time slice for tasks and allocate the time slice for every individual task. The researcher uses a comparative approach by placing the burst time of the jobs in ascending order and then executing it. Similarly, analysts of have put forth their ideas for modifying the Round Scheduling algorithm which are currently in use. III. ABBREVIATIONS 1. TQ=Time Quantum 2. ET=Extra Threshold 3. Old_TQ=Original value of TQ 4. RT=Remaining Time 5. BT=Burst Time 6. NOC= Number Of Cycles 7. j[k]=processors 8. i=process 9. Counter= Number of Switches for each process Some important definitions, Turnaround Time: Total amount of time for a process to be completed Waiting Time: Total amount of time a particular process has waited-for in the ready queue 100
Burst Time: The time required by the process to complete its execution. Mathematically, Waiting Time (for a particular process or job) is given by (Turnaround Time of the process Burst Time of the process) No. of cycles= where,.. symbol indicates the ceil function which rounds a number down to the nearest integer. Remaining Time(RT[i]) is calculated by subtracting burst time from time quantum(tq- BT[i]) ET(Extra Threshold)= 0.1*(TQ) IV. PROPOSED ALGORITHM 1. For all processes in ready queue do { 2. Counter[i]=1 3. TQ=Old_TQ 4. RT[i]=0 5.j[k]=0 6. NOC[i]= BT[i]/TQ 7. while(bt[i]!=0){ 8. if(k==3) 9. k=0 10. if BT[i]<TQ { 11. Assign processor j[k] to job i 12. k++ 13. Counter++ 14. } 15. if(bt[i]%tq==0) { 16. Assign processor j[k] to the job i 17. BT[i]=BT[i]-TQ 18. Counter[i]++ 19. k++ 20. } 21. else if(bt[i]%tq!=0) { 22. RT[i]=BT[i]-TQ 23. if(counter[i]== NOC[i]) { 24. If (RT[i]<=ET) { 25. TQ=TQ+ET//RT[i] 26. BT[i]=BT[i]-TQ 27. TQ=Old_TQ 28. Assign processor j[k] to job i 29. k++ 30. } 31.else 32. BT[i]=BT[i]-TQ 33. } 34. } 35. else { 36. BT[i]=BT[i]-TQ 37. Counter++ 38. Assign processor j[k] to job i 39. k++ 40. } 41. } 42. } V. FLOW CHART VI. PROPOSED APPROACH The proposed approach adduces a new variable, Extra Threshold (ET) in the Round Algorithm. The value of ET is equal to 10% of the time quantum (TQ). The CPU burst of processes less than or equal to the combined value of TQ and ET can be processed in the same time slice cycle. This attributes an advantage of reduced turnaround time and wait time keeping the efficiency same i.e. O(n). The algorithm for it is explained as: For the processes in the ready queue set the value of Old_TQ to TQ, RT[i]=0; k=0 and Counter[i] to 1. Also set NOC[i] to ceil of BT[i] divided by TQ. Iterate the while loop until the condition BT[i]!=0 is true and if the value of k=3 then modify it to 0 since we are considering only 4 processors here. Check - If burst time of a process is less than the time quantum, assign the processor j[k] to the process I and increment k and Counter by 1. Now if the burst time of a process is completely divisible by the time quantum then assign the processor j[k] to the job i and subtract the time quantum from the respective burst time of the process 101
and take it back to the ready queue if it is not complete. Also increment the Counter and k. Further, check if the burst time of a process is not completely divisible by the time quantum then calculate RT[i] by subtracting TQ from BT[i]. Else increment the counter and subtract TQ from BT[i] and assign the processor j[k] to job i. Check further if the Counter[i] is equal to NOC[i] and check if the remaining time of the process is less than or equal to ET. If the condition satisfies add RT[i] to TQ, subtract time quantum from the respective burst time of the process and assign Old_TQ value to TQ. Also assign the processor j[k] to job i and increment the value of k. Else subtract time quantum from the respective burst time of the process. Repeat the above algorithm for all the processes present in the ready queue until they are complete i.e. BT[i]=0. Wait Time = (10-10)+(58.2-10.2)+(88.2-21)+(77.2-19)+(48-8)+(88.7-20.5)=281.6ms B) Modified Round TQ=10ms; ET=1ms TQ + ET=11ms b) Table 2 (Ready Queue table for B) J2 10.2 1 J3 21 2 J4 19 2 J5 8 1 J6 20.5 2 VII. HYPOTHETICAL EXAMPLES A set of 3 examples are illustrated for the proposed Round algorithm - Suppose, Arrival time for 6particular processes or jobs=0ms& 4 processors are being assigned to the jobs. i. EXAMPLE 1 A) Classical Round TQ=10ms a) Table 1 (Ready Queue table for A) Cycles)= J2 10.2 2 J3 21 3 J4 19 2 J5 8 1 J6 20.5 3 Figure 2 shows the Gantt chart for the above ready 10+20.2+69.2+78.2+48.2+88.7=314.5ms Wait Time = (10-10)+(20.2-10.2)+(69.2-21)+(78.2-19)+(48.2-8)+(88.7-20.5)=225.8ms ii. EXAMPLE 2 A) Classical Round TQ=12ms a) Table 3(Ready Queue table for A) J1 12 1 J2 25.2 3 J3 12.5 2 J4 24 2 J5 10 1 J6 20 2 Figure 1 shows the Gantt chart for the above ready 10+58.2+88.2+77.2+48+88.7=370.3ms Figure 3 shows the Gantt chart for the above ready 102
12+103.7+82.5+94.5+58+102.5=453.2ms Wait Time = (12-12)+(103.7-25.2)+(82.5-12.5)+(94.5-24)+(58-10)+(102.5-20)=349.5ms B) Modified Round TQ=12ms; ET=1.2ms TQ+ET=13.5ms b) Table 4 Ready Queue table for B J1 12 1 J2 25.2 2 J3 12.5 1 J4 24 2 J5 10 1 J6 20 2 Figure 4 shows the Gantt chart for the above ready 12+83.7+36.5+95.7+58.5+103.7=390.1ms Wait Time = (12-12)+(83.7-25.2)+(36.5-12.5)+(95.7-24)+(58.5-10)+(103.7-20)=286.4ms iii. EXAMPLE 3 A) Regular Round TQ=20ms a) Table 5 Ready Queue table for A J2 20 1 J3 22 2 J4 21 2 J5 18 1 J6 25 2 Figure 5 shows the Gantt chart for the above ready 10+30+110+111+88+116=465ms Wait Time = (10-10)+(30-20)+(110-22)+(111-21)+(88-18)+(116-25)=349ms B) Modified Round TQ=20ms; ET=2.0ms TQ+ ET=22ms b) Table 6 Ready Queue table for A J2 20 1 J3 22 1 J4 21 1 J5 18 1 J6 25 2 Figure 6 shows the Gantt chart for the above ready Turnaround Time= 10+30+52+71+89+114=366ms Wait Time = (10-10)+(30-20)+(52-22)+(71-21)+(89-18)+(114-25)=250ms VIII. RESULTS Comparison Table for EXAMPLE 1 Compariso n factor Turnaroun d Time Waiting time Context Switches Classica l Round 370.3m s 281.6m s Propose d Round 314.5ms 225.8ms Improveme nt Observed 55.8ms 55.8ms 11 8 3 103
Comparison Table for EXAMPLE 2 Compariso n factor Turnaroun d Time Waiting time Context Switches Classica l Round Propose d Round Improvemen t Observed 453.2ms 390.1ms 63.1ms 349.5ms 286.4ms 63.1ms 10 8 2 Comparison Table for EXAMPLE 3 Compariso n factor Turnaroun d Time Waiting time Context Switches Classica l Round Propose d Round Improvemen t Observed 465ms 366ms 99ms 349ms 250ms 99ms 8 6 2 Comparison Graph for EXAMPLE 1 Comparison Graph for EXAMPLE 2 Comparison Graph for EXAMPLE 3 REFERENCES [1] H.S Behera, Simpli Patel, Bijayalakshmi Panda Veer Surendra University of Technology A New Dynamic Round and SRTN Algorithm Time Slice for Soft Real Time Systems International Journal of Computer Applications (IJCA)Volume 16-No. 1,February 2011 [2] Yashuwanth and Ramesh, Dept. of Electrical and Electronic Engineering Anna University, Chennai Intelligent Time Slice for Round in Real Time Operating Systems International Journal of Research and Reviews in Applied Sciences(IJRRAS 2 (2)),February 2010 [3] A. Silberschatz, P. B. Galvin and G. Gagne, Operating System Principles, 7th Edition., John Wiley and Sons, 2008 [6] T. Helmy and A. Dekdouk, Burst Round : As A Proportional-Share Scheduling Algorithm, In Proceedings of The Forth IEEE-GCC Conference on Towards Techno-Industrial Innovations,pp.424-428,11-14 November 2007, at the Gulf International Convention Center, Bahrain [7] Ji-Young Kwak, Ji-Seung Nam, and Doo-Hyun Kim, A Modified Dynamic Weighted Round robin cell scheduling algorithm, ETRI Journal, Volume 24, Number 5, October 2002 [8] Saroj Hiranwal, Computer Science and Engineering Suresh Gyan Vihar University Jaipur, Rajasthan, India, Dr. K.C. Roy roy.krishna@rediffmail.com,electronics and communication Engineering Pacific University Udaipur, Rajasthan, India Adaptive Round Scheduling using Shortest Burst Approach Based on Smart Time Slice, International Journal of Data Engineering (IJDE), Volume 2, Issue 3. [9] Prof. Rakesh Mohanty, Prof. H. S. Behera, Khusbu Patwari, Manas Ranjan Das, Monisha Dash, Sudhashree Design and Performance Evaluation of a New Proposed Shortest Remaining Burst Round (SRBRR) Scheduling Algorithm, Am. J. Applied Sci., 6 (10): 1831-1837, 2009. [10] Debashree Nayak Lecturer Gandhi Institute of Technology And Management, Bhubaneswar, Odisha, India, Sanjeev Kumar Malla Student Gandhi Institute of Technology And Management, Bhubaneswar, Odisha, India, Debashree Debadarshini Student Gandhi Institute of Technology And Management, Bhubaneswar, Odisha, India, Improved round robin scheduling using dynamic time quantum, 104
International Journal of Computer Applications (0975 8887),Volume 38 No.5, January 2012. [11] H. S. Behera, Rakesh Mohanty, Sabyasachi Sahu, Sourav Kumar Bhoi, Comparative performance analysis of multidynamic time quantum round robin (mdtqrr),indian Journal of Computer Science and Engineering (IJCSE), Vol. 2 No. 2 Apr-May 2011. [12] CPU Scheduling: http://www.cs.uic.edu/ ~jbell/ CourseNotes/ OperatingSystems/ 5_CPU_Scheduling.html 105