<p>In a multitasking operating system context, sometimes you hear the term round-robin scheduling. What does it refer to?<br>
What other kind of scheduling is there?</p>

[{'answer_id': 79426, 'author': 'Swati', 'author_id': 12682, 'author_profile': 'https://Stackoverflow.com/users/12682', 'pm_score': 6, 'selected': True, 'text': '<p><strong>Round Robin Scheduling</strong></p>\n\n<p>If you are a host in a party of 100 guests, round-robin scheduling would mean that you spend 1 minute (a fixed amount) per guest. You go through each guest one-by-one, and after 100 minutes, you would have spent 1 minute with each guest. More on <a href="http://en.wikipedia.org/wiki/Round-robin_scheduling" rel="noreferrer" title="Round-robin scheduling">Wikipedia</a>.</p>\n\n<p>There are many other types of scheduling, such as priority-based (i.e. most important people first), first-come-first-serve, earliest-deadline-first (i.e. person leaving earliest first), etc. You can start off by googling for scheduling algorithms or check out <a href="http://en.wikipedia.org/wiki/Scheduling_algorithm" rel="noreferrer" title="scheduling algorithms">scheduling at Wikipedia</a></p>\n'}, {'answer_id': 79431, 'author': 'mbowcock', 'author_id': 8758, 'author_profile': 'https://Stackoverflow.com/users/8758', 'pm_score': 0, 'selected': False, 'text': '<p>Round robin is a simple scheduling algorithm where time is divided evenly among jobs without priority.</p>\n\n<p>For example - if you have 5 processes running - each process will be allowed to run for 1/5 a unit of time before another process is allowed to run. Round robin is typically easy to implement in an OS.</p>\n'}, {'answer_id': 83324, 'author': 'Tall Jeff', 'author_id': 1553, 'author_profile': 'https://Stackoverflow.com/users/1553', 'pm_score': 2, 'selected': False, 'text': "<p>The answers here and even the Wikipedia article describe round-robin scheduling to inherently include periodic timeslicing. While this is very common, I believe that Round-Robin scheduling and timeslicing are <strong><em>not</em></strong> exactly the same thing. Certainly, for timeslicing to make sense, round-robin schedling is implied when rotating to each task, however you can do round-robin scheduling without having timeslicing. That is, each task at the same priority in the round-robin rotation can be allowed to run until they reach a resource block condition and only then having the next task in the rotation run. In other words, when equal priority tasks exist, the reschedling points are <strong><em>not</em></strong> time pre-emptive.</p>\n\n<p>The above idea is actually realized specifically in the case of Wind River's VxWorks kernel. Within their priority scheme, tasks of each priority run round robin but do not timeslice without specifically enabling that feature in the kernel. The reason for this flexibility is to avoid the overhead of timeslicing tasks that are already known to run into a block within a well bounded time.</p>\n\n<p>Therefore, while timeslicing based scheduling implies round-robin scheduling, round-robin scheduling does not require equal time based timeslicing.</p>\n"}, {'answer_id': 84198, 'author': 'unwieldy', 'author_id': 14963, 'author_profile': 'https://Stackoverflow.com/users/14963', 'pm_score': 3, 'selected': False, 'text': '<p>Timeslicing is inherent to any round-robin scheduling system in practice, AFAIK.</p>\n\n<p>I disagree with InSciTek Jeff\'s implication that the following <em>is</em> round-robin scheduling:</p>\n\n<blockquote>\n  <p>That is, each task at the same priority in the round-robin rotation can be allowed to run until they reach a resource blocking condition before yeilding to the next task in the rotation.</p>\n</blockquote>\n\n<p>I do not see how this could be considered round-robin. This is actually preemptive scheduling. However, it is possible to have a scheduling algorithm which has elements of both round-robin and preemptive scheduling, which VxWorks does if round-robin scheduling and preemption are both enabled (round-robin is disabled by default). The way to enable round-robin scheduling is to provide a non-zero value in <em>kernelTimeSlice</em>.</p>\n\n<p>I do agree with this statement:</p>\n\n<blockquote>\n  <p>Therefore, while timeslicing based scheduling implies round-robin scheduling, round-robin scheduling does not require equal time based timeslicing.</p>\n</blockquote>\n\n<p>You are right that it doesn\'t require equal time. Preemption can muck with that. And actually in VxWorks, if a task is preempted during round-robin scheduling, when the task gets control again it will execute for the rest of the time it was allocated. </p>\n\n<p>Edit directed at InSciTek Jeff (I don\'t have comment privileges)\nYes, I was referring to task locking/interrupt disabling, although I obviously didn\'t express that very well. You preempted me (ha!) with your second comment. I hope to debate the more salient point, that you believe round-robin scheduling can exist without time slicing. Or did you just mean equal time based time slicing? I disagree with the former, but agree with the latter. I am eager to learn. Thanks.</p>\n\n<p>Edit2 directed at Jeff:</p>\n\n<blockquote>\n  <p>Round-robin can exist without timeslicing. That is exactly what happens in VxWorks when kernelTimeSlice is disabled (zero).</p>\n</blockquote>\n\n<p>I disagree with this statement. See <a href="http://www.slac.stanford.edu/exp/glast/flight/sw/vxdocs/vxworks/guide/c-basic.html" rel="noreferrer">this document</a> section 2.2.3 with the heading Round-Robin Scheduling.</p>\n\n<blockquote>\n  <p>Round-robin scheduling uses time\n  slicing to achieve fair allocation of\n  the CPU to all tasks with the same\n  priority. Each task, in a group of\n  tasks with the same priority, executes\n  for a defined interval or time slice.\n  Round-robin scheduling is enabled by\n  calling kernelTimeSlice( ), which\n  takes a parameter for a time slice, or\n  interval. [...] If round-robin\n  scheduling is enabled, and preemption\n  is enabled for the executing task, the\n  system tick handler increments the\n  task\'s time-slice count.</p>\n</blockquote>\n\n<p>Timeslicing is inherent in round-robin scheduling. Otherwise you are relying on a task to give up CPU control, which round-robin scheduling is intended to solve.</p>\n'}, {'answer_id': 2605673, 'author': 'Ashish', 'author_id': 312573, 'author_profile': 'https://Stackoverflow.com/users/312573', 'pm_score': 0, 'selected': False, 'text': '<p>Actaully, you are getting confused with Preemptive scheduling and Round robin. Infact RR is part of Preemptive scheduling.</p>\n'}, {'answer_id': 2891729, 'author': 'dbasnett', 'author_id': 66532, 'author_profile': 'https://Stackoverflow.com/users/66532', 'pm_score': 1, 'selected': False, 'text': '<p>An opinion.  It seems that we are intertwining two mechanisms into one.  Assuming only the OP\'s original assertion "In a multitasking operating system context" then   </p>\n\n<p>1 - A round robin scheduler always schedules the next item in a circular queue.</p>\n\n<p>2 - How the scheduler regains control to perform the scheduling is separate and unrelated.</p>\n\n<p>I don\'t disagree that the most prevalent method for 2 is time-slicing / yield waiting for resource, but as has been noted there are others.  If I am not mistaken the first Mac\'s didn\'t utilize time-slicing, they used voluntary yield / yield waiting for resource (20+ year old brain cells can be wrong sometimes;).</p>\n'}, {'answer_id': 42277060, 'author': 'tanmay sakpal', 'author_id': 7575639, 'author_profile': 'https://Stackoverflow.com/users/7575639', 'pm_score': 0, 'selected': False, 'text': '<p>Round Robin scheduling is based on time sharing also known as quantum (max time given by CPU to any process in one go). There are multiple processes(which require different time to complete aka burst time) in a queue and CPU has to process them all so it keeps switching between processes to give every process equal time based on the quantum value. This type of scheduling is known as Round Robin scheduling.\nCheckout this simple video to understand round robin scheduling easily: <a href="https://www.youtube.com/watch?v=9hw-_qJ55K4" rel="nofollow noreferrer">https://www.youtube.com/watch?v=9hw-_qJ55K4</a></p>\n'}]
['https://Stackoverflow.com/questions/79389', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/10703/']