0
$\begingroup$

Suppose you have three stages for a job:

Creation stage = the job gets created

Executing stage = the job is executed/served

Finishing stage = the job is "marked" as finished.

Now, say the quantum time for a round-robin scheduler is 100ms. From what I understand, the 100ms is spent on the executing stage. Am I right to assume that the creation and finishing stage is OS stuff, and what really the quantum time is used on, is the executing time?

I'm a bit confused because I'm trying to write a model, and for the scheduler I'm trying to figure out whether "job 1 was created" counts as a "turn" or consumption of quantum time for that given job. So, if "job 1 was created" happens, then it switches to "executing job2".

I might be mixing up OS tasks and CPU execution here.

$\endgroup$
  • $\begingroup$ It's to make sure a particularly long-running process does not starve resources. It forces each process to only execute for a certain amount of time, to allow fairness to all processes. This way, shorter processes finish first. $\endgroup$ – Ryan Oct 19 '14 at 18:25
4
$\begingroup$

For the Round-Robin Scheduler the quantum time is to ensure that each process has a share to the CPU and we don't have starvation problems. It's known for being fair, such that each process shares the CPU equality. Quantum time is it's the amount of time spent on each process in the CPU until we context switch to the next process in the ready queue. For example say you have P1, P2, and P3 in the ready queue. And some P4 enters the ready queue at 550ms. The RR would perform something like this:

P1 - 0   to 100ms
P2 - 100 to 200ms
P3 - 200 to 300ms
P1 - 300 to 400ms
P2 - 400 to 500ms 
P3 - 500 to 600ms [P4 enters]
P4 - 600 to 700ms
... [P1 to P4 cycles]

If a process has a CPU-bound execution that is less than the time slice. Then we move to the next process keeping the same time slice. For example let's say P1 only needs to run for 50ms until it's done. Then you have:

P1 - 0   to 50ms [finnished, start P2]
P2 - 50  to 150ms
P3 - 150 to 250ms
P2 - 250 to 350ms
P3 - 350 to 450ms
...
$\endgroup$

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.