Burst Round Robn as a Proportonal-Share Schedulng Algorthm Tarek Helmy * Abdelkader Dekdouk ** * College of Computer Scence & Engneerng, Kng Fahd Unversty of Petroleum and Mnerals, Dhahran 31261, Saud Araba. ** Computer Scence Department, D'Oran Es-Séna Unversty, B.P.1524, EL-Mnaour, Algera. E-mals: helmy@kfupm.edu.sa & aek_dk@yahoo.com Abstract In ths paper we ntroduce Burst Round Robn, a proportonal-share schedulng algorthm as an attempt to combne the low schedulng overhead of round robn algorthms and favor shortest jobs. As beng documented that weght readjustment enables exstng proportonal share schedulers to sgnfcantly reduce, but not elmnate, the unfarness n ther allocatons. We present a novel weght adjustment for processes that are blocked for I/O and lose some CPU tme to assure proportonal farness. Experments on the mplemented smulator showed that quckly knockng away shortest processes acheves better turnaround tme, watng tme, and response tme. The advantage we gan s that processes that are close to ther completon wll get more chances to complete and leave the ready queue. Ths wll reduce the number of processes n the ready queue by knockng out short jobs relatvely faster n a hope to ncrease the throughput and reduce the average watng tme. Index Terms - Proportonal-share CPU schedulng, Qualty of Servces and Performance Management. I. INTRODUCTION Modern operatng systems (OS) nowadays have become more complex than ever before. They have evolved from a sngle task, sngle user archtecture to a multtaskng envronment n whch processes run n a concurrent manner. Allocatng CPU to a process requres careful attenton to assure farness and avod process starvaton for CPU. Schedulng decson try to mnmze the followng: turnaround tme, response tme, and average watng tme for processes and the number of context swtches [1]. Schedulng algorthms are the mechansm by whch a resource s allocated to a clent. In our research we restrct the concept of a resource to CPU tme and clents to processes. A schedulng decson refers to the concept of selectng the next process for executon. Durng each schedulng decson, a context swtch occurs, meanng that the current process wll stop ts executon and put back to the ready queue and another process wll be dspatched. We defne schedulng overhead as the ncurred overhead when makng a schedulng decson (other than context swtches). Context swtches are overheads, because CPU remans dle durng context swtches, whch reduces CPU utlzaton. Frst-Come Frst-Serve (FCFS) algorthms wll have a mnmal amount of context swtches as a process, once allocated to the CPU, wll not release t untl ts completon. Ths means lower context swtches of n 1, where n s the number of processes, and constant tme schedulng overhead of O(1). But the responsveness s bad when we have multple tasks. Shortest Job Frst (SJF) algorthm s known to be the algorthm wth the least process turnaround tme and process average watng tme. Turnaround tme s the tme t takes a process from ts arrval tme to the tme of ts completon, whle watng tme s the amount of tme a process wats. SJF, however, s not practcal due to ts low responsveness n tme sharng OSs. Moreover the schedulng overhead of a process n a ready queue s O(n), where n s the number of processes n the ready queue. Round Robn (RR) algorthms are wdely used as they gve better responsveness but worse average turnaround tme and watng tme [1, 6]. Consderng a statc set of n processes the number of context swtches for only one round s n swtches. The expected number of rounds = B/q, where B s the average CPU burst tme for processes and q s a fxed tme quantum. RR wll have a hgher average watng and turnaround tme (whch s bad). However, RR algorthms are wdely used n modern OSs lke Lnux, BSD and Wndows. All use mult-level feedback queues wth prortes and a RR scheduler over each process queue. In addton, RR algorthms have low schedulng overhead of O(1), whch means schedulng the next process takes a constant tme [2, 3, 1]. A modfed verson of RR s the Weghted Round Robn (WRR) n whch each process P has a specfed weght that specfes ts share of the CPU tme. If a tme quantum q s specfed to be 1 tme unts (tu), and we have three processes A, B, and C havng weghts 7, 4, and 9, then the tme quantum gven to each process s proportonal to the process weght. An example of one round of WRR wll assgn, for example, process A 7% of the tme quantum. Smlarly process B wll receve
4% of the tme quantum and process C wll receve 9%. WRR s the smplest proportonal-share schedulng algorthm. The am of proportonal-share schedulers s to acheve proportonal farness for all the processes, that s: f a process P has been promsed a share S of CPU, t should get ths share. Assurng farness s essental especally n a dynamc envronment where processes get blocked from usng CPU. The process that lost CPU tme whle t was blocked has to be compensated as t wll try to gan more shares. Recently, research has been conducted on proportonal-share analyss to acheve good proportonal farness n a dynamc envronment whle havng a low schedulng overhead [9]. We have surveyed Lottery Schedulng [5, 11], Group Rato Round Robn Schedulng [2, 3, 1], and Vrtual Tme Round Robn [8, 7, 4, 12] and learned from ther dynamc consderatons. In those schedulng algorthms, the weght of a process when blocked for I/O gets updated as t moves back to the ready queue. Those papers use the term share to refer to the amount of the allocated resources that are dedcated to the process. The rest of ths paper s structured as follows. Secton II presents the proposed weghtng technque for round robn schedulng algorthm. Secton III dscusses the dynamc consderaton for mplementaton of our proposed schedulng algorthm. Secton IV presents the results of our expermental evaluaton. Secton V presents the conclusons and drectons for future work. II. THE PROPOSED WEIGHTING TECHNIQUE In ths paper we mplemented a new weghtng technque for round-robn CPU scheduler as an attempt to combne the low schedulng overhead of round robn algorthms and favor short jobs. Hgher process weghts mean relatvely hgher tme quanta. Shorter jobs wll be gven more tme, so that they wll be removed earler from the ready queue. Ths ams to acheve better throughput, and watng tme, whle tryng to keep the context swtches as low as possble. We start by formulatng a hypothess that a process weght s nversely proportonal to ts CPU burst tme: 1 Weght Burst The advantage we gan s that processes that are close to ther completon wll get more chances to complete and leave the ready queue. Ths wll reduce the number of processes n the ready queue by knockng out short jobs relatvely faster n a hope to ncrease the throughput and reduce the average watng tme. To assgn specfc weghts to processes, we wll need to normalze ths equaton and fnd a constant for ths relaton. The maxmum CPU burst tme s set to 1tu. We tred to classfy the processes nto fve weght categores. Processes that have less CPU burst tme wll have hgher weghts as follows: CPU Burst tme (tu) % of tme quantum 1-1 1% 1-25 8% 25-5 6% 5-75 5% 75-1 4% So a process that has a burst tme of 2tu, for example, wll have double the tme gven to another process that has a burst tme of 8tu. Ths smple approach has shown a sgnfcant mprovement n average turnaround tme, average watng tme and responsveness. Detals of the experment are shown n secton IV. We gradually ncrease the number of classes untl we reach 2, whch have shown better result as compared to other results. We formulate the followng for processes wth CPU tme greater than 5tu: Weght 1 = Burst 1 5 Because CPU burst tme s on a scale of 1, dvdng by 5, wll generate 2 classes of weghts. For processes that have CPU tme less than 5tu, they wll be served untl they fnsh. III. DYNAMIC CONSIDERATION Usually when a set of processes are beng executed, some processes go through a seres of swappng n and out, especally f the memory s full. In ths paper we consder processes that are blocked due to I/O requests only. When a process s blocked, t wll be moved to a watng queue to be further processed to an I/O devce. After fnshng ts I/O, t wll then move back to the ready queue. Those blocked processes have lost ther share of CPU when they block for I/O [6, 9]. To acheve proportonal farness, the weghts of those blocked processes wll be updated accordng to the gven formula: process _ Watng New _ Weght = Old _ Weght Avg _ processes _ Watng In ths formula, we try to avod skew-ness n average watng tme by gvng I/O bound processes hgher weghts on ther return to ready queue. In addton, we purpose a selectve preempton technque n whch I/O bound processes can preempt currently runnng process f they have more watng tme than the average watng tme for all the processes. Ths s because the process has been watng for I/O and should get hgher weght than currently runnng processes.
IV. EXPERIMENTAL RESULTS A. CPU Bound Processes The smulator whch s wrtten n java was used to evaluate varous schedulng algorthms. At frst we focused on evaluatng WRR wth the proposed weghtng technque aganst fxed tme quantum round robn. We have used a job queue of 5 processes that arrve at dfferent tmes and have lengths varyng from 1 to 1tu. We call ths set of 5 processes DATA1. The fxed tme quantum was set to 1tu. Moreover, we have modfed the smulator and added a watng queue n whch I/O bound processes are added when they are blocked. We have defned a scenaro and a sequence of process arrvals and tmed ther blockage for I/O. For example process A s a CPU bound process and process B s I/O bound. Process A arrves at tme 4 and has a CPU burst tme of 45tu. Process B arrves at tme 1 and has a CPU burst tme of 23tu, but t blocks watng for I/O after t executes for 8tu. Let us assume that the blocked process wll be watng for a certan amount of tme before t comes back to the ready queue. The BRR has shown a slght mprovement over RR, when we had only fve classes of weghts. Table 1 shows results of runnng RR algorthm wth a fxed tme quantum of 1tu on DATA1. We show that assgnng a hgher weght to shorter processes has gven us better watng tme, responsveness and turnaround tme. For a set of CPU bound process (.e. wth no I/O), the proposed algorthm acheved a reducton of 14.75% n average watng tme, 34% better response and 13.5% better turn around tme. However the amount of context swtches s 5.8% larger than RR, whch s consdered sgnfcantly large. Table 1: RR results on DATA1 (5 CPU bound processes) Mn 1 6 Mean 511.38 47.3 556.68 Max 1393 18 1492 S.Dev 432.27 45.23 457.13 Context Swtched 248 Table 2: BRR results on DATA1 usng 5 classes of weghts Mn 4 Mean 435.94 31.12 481.24 Max 1363 14 1462 S.Dev 46.37 26.21 431.84 Context Swtched 374 We ran the experment whle ncreasng the amount of weght classes untl we reached the 2-weghts classng, whch gave us a very approprate result when compared wth the fxed-tme quantum RR algorthm. Table 3 shows an mprovement of 27% n watng tme and 25% less average turnaround tme. The amount of context swtches s even much shorter than the frst weght assgnment used n Table 2. Table 3: BRR results on DATA1 usng 2 classes of weghts Mn 3 Mean 372.2 33.92 417.32 Max 145 119 154 S.Dev 397.91 28.24 423.62 Context Swtched 293 B. Results wth dynamc consderaton (wth I/O bound processes) We have created a new data set (DATA2) of 5 processes, whch nclude I/O bound processes. We ntend to compare the tradtonal RR algorthm, preemptve RR algorthm, BRR algorthm and preemptve BRR. The weght and preempton used n the BRR are newly proposed n ths paper. For the purpose of the experment, we have set DATA2 sample to have a scenaro of CPU process arrvals and burst tmes. We also declared that some process wll be blocked for I/O at a gven tme of ther executon and for a specfed perod of tme. We expect hgher turnaround, watng and response tmes than a set of processes that do not nclude any I/O bound processes. C. Round Robn versus proposed approach: After runnng the fxed RR algorthm on DATA2, we have acheved the followng lsted n table 4: Table 4: RR results on DATA2 wth I/O bound processes Mn 3 8 Mean 553.72 64.32 599.2 Max 174 211 1799 S.Dev 453.39 53.97 474.4 Context Swtches 496 As expected, turnaround, response and watng tmes all suffered from the exstence of only 1% I/O bound processes. We note that turnaround tme has ncreased from 556.68 to 599.2 wth an ncrease of about 7%. Response and watng tmes has suffered greatly and almost doubled. Now, when we run our weghted RR algorthm on the same dataset DATA2, we obtaned nterestng results:
Table 5: BRR results on DATA2 wth I/O bound processes Mn 9 Mean 422.9 49.62 468.2 Max 1437 146 152 S.Dev 391.2 4.72 412.9 Context Swtch 617 The use of the proposed weghtng technque mproved the turnaround tme from 599.2 to 468.2 wth an mprovement of 28%. Response tme, average tme both mproved by about 23%. D. Preemptve RR versus proposed approach wth preempton We now assume that newly added processes wll preempt the currently runnng process when t comes back from I/O. Preemptve RR s compared wth our proposed preempton technque, n whch weght of blocked processes s ncreased accordng to the gven formula. We frst ran preemptve round robn on DATA2 and obtaned the followng results: Table 6: Preemptve RR results on DATA2 wth I/O bound processes Mn 3 8 Mean 487.3 17.92 532.6 Max 1113 369 128 S.Dev 351.56 117.67 37.6 Context Swtched 585 We note that preempton mproves watng and turnaround tmes on the expense of response tme. The reason behnd hgh response tme s due to the fact that a returnng process wll preempt the currently runnng process, and jump over to the comng process that s appended to the end of the ready queue. Now, comparng preemptve RR wth our proposed preemptve weghted RR algorthm, we acheve the followng results: Table 7: Preemptve BRR results on DATA2 wth I/O bound processes Mn 9 Mean 414.24 12.3 459.54 Max 1323 244 146 S.Dev 363.23 77.95 385.34 Context Swtched 622 Our results show a sgnfcant mprovement of 13% n turnaround tme, 15% mprovement n watng tme and 4% mprovement n response tme, wth only lttle ncrease n context swtches, Fgures 1, 2, and 3. Fgure 1: Watng tme for the tested algorthms Tme Unts Tme Unts 18 16 1 1 1 8 6 Watng Tme Comparsons Mn Mean Max StdDev Wat(RR) Wat(PRR) Wat(WRR) Wat(PWRR) Fgure 2: Response tme for the tested algorthms 35 3 25 15 1 5 Response Tme Comparsons Mn Mean Max StdDev Response(RR) Response(PRR) Response(WRR) Response(PWRR) Fgure 3: Turnaround tme for the tested algorthms T m e U n ts 18 16 1 1 1 8 6 Turnaround Tme Comparsons Mn Mean Max StdDev Turnaround(RR) Turnaround(PRR) Turnaround(WRR) Turnaround(PWRR) V.CONCLUSION AND FUTURE WORK In ths paper, we have proposed a weghtng technque for round-robn schedulng algorthm based on processes CPU burst tme. Ths technque showed promsng results when ran on the schedulng smulator. Usng ths weghtng technque on a mx of processes
that nclude I/O bound processes has shown a good mprovement over the runnng of a fxed tme quantum RR. We suggest that ths should be further analyzed wth actual computaton of CPU burst tme to nvestgate whether the CPU burst tme computaton does not overwhelm the algorthm. ACKNOWLEDGEMENT We would lke to thank Kng Fahd Unversty of Petroleum and Mnerals for provdng the utlzed computng facltes. Specal thanks to the anonymous revewers for ther frutful comments. REFERENCES 1. Abraham Slberschatz, Peter Baer Galvn, and Greg Gagne, Operatng Systems Concepts, John Wley and Sons. 6Ed 5. 2. Bogdan Caprta, Wong Chun Chan, Jason Neth, Clfford Sten, and Haoqang Zheng, Group rato round-robn: O(1) proportonal share schedulng for un-processor and multprocessor systems, In USENIX Annual Techncal Conference, 5. 3. B. Caprta, W. C. Chan, and J. Neh, Group Round-Robn: Improvng the Farness and Complexty of Packet Schedulng, Techncal Report CUCS-18-3, Columba Unversty, June 3. 4. H. M. Chaskar and U. Madhow, Far schedulng wth tunable latency: a round-robn approach, IEEE/ACM Trans. Net., 11(4):592 61, 3. 5. Ion Stoca, Hussen Abdel-Wahab, and Kevn Jeffay, On the dualty between resource reservaton and proportonal share resource allocaton, In Multmeda Computng and Networkng, 1997. 6. Jason Neh and Chrs Vall and Hua Zhong, Vrtual-Tme Round-Robn: An O(1) Proportonal Share Scheduler, In Proceedngs of the 1 USENIX Annual Techncal Conference, June 1. 7. John Regehr, Some gudelnes for proportonal share CPU schedulng n general-purpose operatng systems, In The 22nd IEEE Real-Tme Systems Symposum (RTSS 1), London, UK, December 3-6 1. 8. John Regehr, Usng Herarchcal Schedulng to Support Soft Real-Tme Applcatons on General- Purpose Operatng Systems, PhD thess, Unversty of Vrgna, May 1. 9. Kevn Jeffay, F. Donelson Smth, and James Anderson Arun Moorthy, Proportonal share schedulng of operatng system servces for realtme applcaton, In Proceedngs of the 19th IEEE Real-Tme Systems Symposum, Madrd, Span, December 1998. 1. Luca Aben, Guseppe Lpar, and Gorgo Buttazzo, Constant bandwdth vs. proportonal share resource allocaton, In Proc. of the IEEE Internatonal Conference on Multmeda Computng and Systems, Florence, Italy, June 1999. 11. M B. Jones and J. Regehr, CPU Reservatons and Tme Constrants: Implementaton Experence on Wndows N, In Proceedngs of the Thrd Wndows NT Symposum, Seattle, WA, July 1999. 12. Y.Wang and A. Merchant, Proportonal servce allocaton n dstrbuted storage systems, Techncal Report HPL- 6-184, HP Laboratores, Dec. 6. 13. W. C. Chan and J. Neh, Group Rato Round- Robn: An O(1) Proportonal Share Scheduler, Techncal Report CUCS-12-3, Columba Unversty, Apr. 3.