1
$\begingroup$

In all books about this topic, I read that there is a rule of thumb is that 80% of the process execution time is lower than time slice. But how do I calculate this value? I looked at every article possible and I found like nothing. Can someone help me understand this topic?

I know that there is a topic with this question click here. I have the exact same problem, but the answer from there isn't clear to me.

Thanks in advance.

$\endgroup$

1 Answer 1

2
$\begingroup$

The end of a time slice is costly (need to interrupt the running program, switch over to the kernel, stash away the running process context, restarting another process means loading it's context, cache contents of the processor are now useless and have to be reloaded). You want to do this hopefully only when forced (the running program does a system call, which forces a context switch anyway; a high-priority interruption arrives), but on the other hand you don't want any process to just monopolize the system by never yielding. So sometimes (i.e., by time slice end) you will force it. The "80%" rule of thumb is just that, it works (most of the time, for most workloads, and probably makes very little practical difference if it is 60% or 90%).

Take a look at e.g. Pabla's discussion of the Completely fair scheduler in Linux to get a feel of the problems to be solved. The history of Linux' schedulers is quite enlightening (and people have been reported to be sucked into hacking it, never to be seen again...)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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