3
$\begingroup$

I would like to know what impacts does a scheduling algorithm, let's say Round Robin or FIFO, have on an Operating System. I understand that a scheduling algorithm has the processes run in burst then switch between one another. But what does this mean for an OS. All I can figure out is that the OS has to keep track of which process is running, see if it has done/completed its operation, choose/switch to another process and run it for a given time. Am I missing the obvious here? It does not really seam to me that a scheduling algorithm really affect the OS per se but the CPU hardware.

$\endgroup$

migrated from cstheory.stackexchange.com Nov 1 '12 at 20:15

This question came from our site for theoretical computer scientists and researchers in related fields.

  • 2
    $\begingroup$ I don't understand what's being asked here. Is this real-time systems theory of some sort? Would you be able to clarify your question a little? $\endgroup$ – Niel de Beaudrap Nov 1 '12 at 20:53
  • $\begingroup$ Can you make it more clear what you want to ask? $\endgroup$ – Shashwat Nov 2 '12 at 7:31
4
$\begingroup$

It seems that the missing piece here is that the switching does not only occur when a process completes. The switch will occur when either 1) the process completes, or 2) when the process explicitly yields its remaining run time slice (whatever it has not used of its time quantum), or 3) when the OS pre-emptively interrupts the process due to that process having been running for all of its assigned time quantum.

The OS is responsible for allowing all the processes that need to get 'OnProc' (on processor) some time to actually be running on a processor. The scheduling algorithm is what determines how "fair" the choice of which process next gets to run on a processor is. Note that technically all of the above really should have the word 'process' replaced with the word 'thread' (of which a single process may have many, and also not all threads necessarily have a process associated with them)

As for what the impact is on the OS - that is a question that needs more definition. I can say that other than the scheduler threads and timers and interrupts, generally all threads are subject to the scheduler so the OS will be impacted by the choice of algorithm.

$\endgroup$
2
$\begingroup$

Round Robin is supposed to provide better response time to the OS. Every job has been given a fair share of the processing time (fixed quantum time).

  • It avoids starvation. Since every job has a fixed quantum time, so the LONGER job doesn't hold the CPU too long for itself (unless quantum time given is too long).
  • It is used in multitasking and multi-user environment since it has a fast context switch by switching to different PCB through the preempt process.

  • It does affect the OS in a way IF quantum time given to every job is too long. Since a job holding a CPU for a long time, it would cause the OS not to be responsive which defeats the purpose of Round Robin. (Too long quantum time sometime would cause Round Robin behaves similarly to FCFS). Imagine the highest job requirement is 10ns and the rest is either 5 or 8. However, quantum time given is 11. That means, this round robin is basically a FCFS.

  • IF quantum time given is too short, there would be too many context switching going on and overall jobs wouldn't be completed in time.

So the point is Round Robin is very dependent on the quantum time.

$\endgroup$
  • $\begingroup$ Thank you for the formatting. $\endgroup$ – JustinC May 23 at 18:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.