From: "Rob Kirkbride" <rob@rk-comp.demon.co.uk>
Subject: Re: Thread priorities
Date: 1999/03/16 [thread overview]
Message-ID: <7cl5sf$v8f$1@news7.svr.pol.co.uk> (raw)
In-Reply-To: 36E92C41.8A412DBD@brighttiger.com
I've got a copy of the Guide to Realtime Scheduling, and I do understand the
distinction between POSIX priorities and MACH priorities.
I am more interested in the algorithm which the scheduler uses for adjusting
the priorities. I have used ps -o SCHED as well as the kernel debugger for
determining thread priorities but this does not reveal why a threads
priority may have been changed.
ps and the kernel debugger still seem to show busy threads have increased
their priority. I am wondering if maybe a thread could be blocked on a
device (which I think can result in its priority being increased) and then
goes busy. If the scheduler hasn't got around to reducing its priority back
again will it still have a raised priority?
Rob
Jeff Denham wrote in message <36E92C41.8A412DBD@brighttiger.com>...
>Rob wrote:
>
>> Can someone either point me to a reference or provide some clarification
how
>> the priority adjustment is performed in Digital Unix?
>>
>> My understanding is that if a thread becomes CPU intensive the scheduler
can
>> reduce its priority and similarly if a process is blocked waiting then
the
>> scheduler can increase its priority.
>>
>> I have written a kernel debugger extension to print out various fields
from
>> the thread structure and it seems that the inverse seems to be happening
(at
>> least with respect to the threads that are busy). In other words the
number
>> is reducing which for Mach priorities indicates that its priority is
>> increasing.
>>
>> If anyone can shed any light on the calculation of these fields, or any
of
>> the fields in the thread structure it would be appreciated.
>>
>> Rob Kirkbride (rob@rk-comp.demon.co.uk)
>
>Mach priorities in Tru64 go from 0 (highest) to 64 (lowest).
>Posix priorities go the other way. Check out the -O SCHED
>flag to the ps command for a peek at the views of your threads'
>prios. Also check out the _Guide_to_Realtime_Programming_,
>which has a chapter on scheduling.
>
>It POSIX terms, if I recall correctly, the scheme looks like this:
>
>0-19: User range
>20-31: System range
>32-63: Realtime range
>
>The base priority for a thread is 19 (BASEPRI_USER) (44 in Mach
>terms). This priority degrades from here down to 0, depending
>on the number of compute cycles and the nice value for the thread.
>
>In the thread structure, there's several sched fields (from faulty
>memory):
>
>th_priority: the thread's "base" priority. Normally this is Mach 44
> but can be higher if the thread is running in a nice-d
>process
>
>th_schedpri: the thread's effective (current priority). This determines
> which of the 64 run queues a thread will pend in
before
> running and its "importance" when running. This is
> one that gets jerked around by the scheduler's
weighting
> algorithms.
>
>th_policy: timeshare, fixed-pri round-robin, fixed-pri fifo...
>
>Don't know if any of this helps. There's also a Digital Technical
>Journal article online (from 1995 or so) that gives some more
>details on the affects of SMP on scheduling and how kernel
>preemption works.
>
>Uresh Valhalia's _UNIX_Internals:_The_New_Frontiers_
>(Pretice Hall) has some info on DEC OSF/1 scheduling
>as well, but he mangled it pretty badly!
>
>-- Jeff
>__________________________________________________
next prev parent reply other threads:[~1999-03-16 5:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-03-12 5:00 Thread priorities Rob
1999-03-12 5:00 ` Jeff Denham
1999-03-16 5:00 ` Rob Kirkbride [this message]
1999-03-16 5:00 ` Jeff Denham
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox