views:

166

answers:

2

Hi there,

I just made some changes to the context switch routine of Linux. I am facing now the following dilemma: The context switching time is no longer deterministic, i.e. the execution time varies on the applications that are switched out. I am wondering now what could be the negative implactions of such a behaviour. One potential pitful I have identified are Real Time Applications. When I have here non-constant times for performing the contest switches I assume that is not really ideal. Are there any other issues that need to be considered?

Many thanks, Helmut

A: 

Music and video players can have too big jitter with such scheduler.

osgx
+1  A: 

It depends on whether you mean "variable quanta" or "variable context switch overhead".

If you implemented variable quanta (e.g. standard quantum for a thread changes based on certain parameters) it might make spinlocks very inefficient depending on the range you use, since they are based on the idea that quantum will never be less than a certain value.

Variable quanta would also make UI responsiveness jittery because the UI thread would receive CPU time at unexpected intervals.

Also, some event handlers are designed to finish before a quantum expires for performance reasons (such as socket listeners). If you make this non-deterministic, there is a chance that an event handler won't finish in its quantum and will require an "unknown" amount of time before it finishes executing.

It is simply the worst form of "side-effects of changing quantum" :)

"Variable context switch overhead" on the other hand will simply make the system appear to fluctuate in speed and responsiveness, but will not cause the side effects I mentioned above.

ssg