[ale] Scheduling questions

Joe Steele joe at madewell.com
Tue Nov 25 12:36:05 EST 2003


On Monday, November 24, 2003 10:37 PM, Bjorn Dittmer-Roche wrote:
> Hey all,
>
>       I have volunteered to write some stuff about acheiving low latency
> on Unix (like) OSes for an audio list I'm on. It's coming along OK but
> here are two issues that I'm having particular trouble with:
>
> * Here is what I say about general purpose timesharing:
>
> --------------------------------
>
> Without any special attention, Unix scheduling uses a default time-sharing
> scheduler that works somthing like this:  each process is given a "nice
> value" and an initial priority. If a process uses lots of CPU time, it's
> priority is reduced, otherwise it might be increased, but never above the
> "nice value". At any given time, the Kernel selects the runnable process
> with the highest priority to run. If several processes are runnable and
> all have the same priority, it may split the time between them in some way
> or it may just run one of them until it is no longer runnable.
>
> --------------------------------
>
> Of course this varies from system to system so I'm just trying to give
> people an idea. Is it more or less correct?
>

If you haven't seen it previously, you might look at:
http://www.oreilly.com/catalog/linuxkernel/chapter/ch10.html

It's a chapter about process scheduling from the book 
_Understanding_the_Linux_Kernel_, and it might just tell you more 
than you ever wanted to know.  If that doesn't satisfy you, then the 
next step would be to read the kernel source.


> * The other question is this: does POSIX define the relationship between
> pthread scheduling and process scheduling? That is, if I have a processess
> with a given priority and threads that all have their own priorities, will
> each thread be scheduled by the OS or will they be "sub-scheduled" within
> the process. More important than POSIX: do implementations generally agree
> one way or the other? I've done some googling, but I haven't seen this
> issue addressed (except for particular OSes), so maybe someone knows a
> good link? My impression is that Posix specifies subscheduling but that
> some implementations extend this. seem right?

POSIX (http://www.unix.org/single_unix_specification/) defines both 
process level thread contention as well as system level thread 
contention.  Whether one or both methods is supported is 
implementation specific.  I believe Linux only uses the system level 
contention method.  I have no idea what other implementations do.

--Joe




More information about the Ale mailing list