Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Round-robin scheduling
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Algorithm employed by process and network schedulers in computing}} {{About|scheduling in computing|other uses|Round-robin (disambiguation)}} {{Use American English|date=August 2022}} [[File:Round Robin Schedule Example.jpg|thumb|350x350px|A Round Robin preemptive scheduling example with quantum=3]] '''Round-robin''' ('''RR''') is one of the algorithms employed by [[process scheduler|process]] and [[network scheduler]]s in [[computing]].<ref name="ostep-1">{{citation|title=Operating Systems: Three Easy Pieces [Chapter: Scheduling Introduction]|url=http://pages.cs.wisc.edu/~remzi/OSTEP/cpu-sched.pdf|publisher= Arpaci-Dusseau Books|date = 2014|first1 = Remzi H.|last1 =Arpaci-Dusseau|first2=Andrea C.|last2 = Arpaci-Dusseau}}</ref><ref name=Zander>[[Guowang Miao]], Jens Zander, Ki Won Sung, and Ben Slimane, Fundamentals of Mobile Data Networks, Cambridge University Press, {{ISBN|1107143217}}, 2016.</ref> As the term is generally used, [[Preemption (computing)#Time slice|time slices]] (also known as time quanta)<ref>{{Cite book|title=Operating Systems: Internals and Design Principles|last=Stallings|first=William|publisher=Pearson|year=2015|isbn=978-0-13-380591-8|pages=409}}</ref> are assigned to each process in equal portions and in circular order, handling all processes without [[:wikt:priority|priority]] (also known as [[cyclic executive]]). Round-robin scheduling is simple, easy to implement, and [[Resource starvation|starvation]]-free. Round-robin scheduling can be applied to other scheduling problems, such as data packet scheduling in computer networks. It is an [[operating system]] concept. The name of the algorithm comes from the [[Round-robin (disambiguation)|round-robin]] principle known from other fields, where each person takes an equal share of something in turn. ==Process scheduling== {{anchor|Process schedulling}} <!-- Former section name --> To [[Process scheduler|schedule processes]] fairly, a round-robin scheduler generally employs [[time-sharing]], giving each job a time slot or ''quantum''<ref name = "McConnell2004">{{cite book | title = [[Operating System Concepts]] | last1 = Silberschatz | first1 = Abraham | author-link1 = Abraham Silberschatz | last2 = Galvin | first2 = Peter B. | last3 = Gagne | first3 = Greg | year = 2010 | publisher = [[John Wiley & Sons]] (Asia) | isbn = 978-0-470-23399-3 | chapter = Process Scheduling | quote = 5.3.4 Round Robin Scheduling | edition = 8th | pages = 194 }}</ref> (its allowance of CPU time), and interrupting the job if it is not completed by then. The job is resumed next time a time slot is assigned to that process. If the process terminates or changes its state to waiting during its attributed time quantum, the scheduler selects the first process in the ready queue to execute. In the absence of time-sharing, or if the quanta were large relative to the sizes of the jobs, a process that produced large jobs would be favored over other processes. Round-robin algorithm is a pre-emptive algorithm as the scheduler forces the process out of the CPU once the time quota expires. For example, if the time slot is 100 milliseconds, and ''job1'' takes a total time of 250 ms to complete, the round-robin scheduler will suspend the job after 100 ms and give other jobs their time on the CPU. Once the other jobs have had their equal share (100 ms each), ''job1'' will get another allocation of [[CPU]] time and the cycle will repeat. This process continues until the job finishes and needs no more time on the CPU. * '''Job1 = Total time to complete 250 ms (quantum 100 ms)'''. # First allocation = 100 ms. # Second allocation = 100 ms. # Third allocation = 100 ms but ''job1'' self-terminates after 50 ms. # Total CPU time of ''job1'' = 250 ms Consider the following table with the arrival time and execute time of the process with the quantum time of 100 ms to understand the round-robin scheduling: {| class="wikitable" style="margin: 1em auto 1em auto;" |- ! Process name !! Arrival time !! Execute time |- | P0 || 0 || 250 |- | P1 || 50 || 170 |- | P2 || 130 || 75 |- | P3 || 190 || 100 |- | P4 || 210 || 130 |- | P5 || 350 || 50 |} [[File:RoundRobin.jpg|center|400px|Round Robin Scheduling]] Another approach is to divide all processes into an equal number of timing quanta such that the quantum size is proportional to the size of the process. Hence, all processes end at the same time. ==Network packet scheduling== {{Main|Network scheduler}} In [[best-effort]] [[packet switching]] and other [[statistical multiplexing]], round-robin scheduling can be used as an alternative to [[first-come first-served]] queuing. A multiplexer, switch, or router that provides round-robin scheduling has a separate queue for every data flow, where a data flow may be identified by its source and destination address. The algorithm allows every active data flow that has data packets in the queue to take turns in transferring packets on a shared channel in a periodically repeated order. The scheduling is [[Work-conserving scheduler|work-conserving]], meaning that if one flow is out of packets, the next data flow will take its place. Hence, the scheduling tries to prevent link resources from going unused. Round-robin scheduling results in [[max-min fairness]] if the data packets are equally sized, since the data flow that has waited the longest time is given scheduling priority. It may not be desirable if the size of the data packets varies widely from one job to another. A user that produces large packets would be favored over other users. In that case [[fair queuing]] would be preferable. If guaranteed or differentiated quality of service is offered, and not only best-effort communication, [[deficit round robin|deficit round-robin]] (DRR) scheduling, [[weighted round robin|weighted round-robin]] (WRR) scheduling, or [[weighted fair queuing]] (WFQ) may be considered. In [[multiple access|multiple-access]] networks, where several terminals are connected to a shared physical medium, round-robin scheduling may be provided by [[token passing]] [[channel access]] schemes such as [[Token Ring]], or by [[polling (computer science)|polling]] or resource reservation from a central control station. In a centralized wireless packet radio network, where many stations share one frequency channel, a scheduling algorithm in a central base station may reserve time slots for the mobile stations in a round-robin fashion and provide fairness. However, if [[link adaptation]] is used, it will take a much longer time to transmit a certain amount of data to "expensive" users than to others since the channel conditions differ. It would be more efficient to wait with the transmission until the channel conditions are improved, or at least to give scheduling priority to less expensive users. Round-robin scheduling does not utilize this. Higher throughput and [[system spectrum efficiency]] may be achieved by channel-dependent scheduling, for example a [[proportionally fair]] algorithm, or [[maximum throughput scheduling]]. Note that the latter is characterized by undesirable [[scheduling starvation]]. This type of scheduling is one of the very basic algorithms for Operating Systems in computers which can be implemented through a circular queue data structure. ==See also== * [[Multilevel queue]] * <code>[[SCHED_RR]]</code> ==References== {{Reflist}} {{Queueing theory}} [[Category:Processor scheduling algorithms]] [[Category:Network scheduling algorithms]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:About
(
edit
)
Template:Anchor
(
edit
)
Template:Citation
(
edit
)
Template:Cite book
(
edit
)
Template:ISBN
(
edit
)
Template:Main
(
edit
)
Template:Queueing theory
(
edit
)
Template:Reflist
(
edit
)
Template:Short description
(
edit
)
Template:Use American English
(
edit
)