Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: Jeff Denham <jdenham@brighttiger.com>
Subject: Re: Thread priorities
Date: 1999/03/12	[thread overview]
Message-ID: <36E92C41.8A412DBD@brighttiger.com> (raw)
In-Reply-To: 7caki3$fv8$1@news5.svr.pol.co.uk

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
__________________________________________________
Jeff Denham (jdenham@brighttiger.com)

Bright Tiger Technologies:  Resource-management software
for building and managing fast, reliable web sites
See us at http://www.brighttiger.com

125 Nagog Park
Acton, MA 01720
Phone: (978) 263-5455 x177
Fax:   (978) 263-5547





  reply	other threads:[~1999-03-12  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 [this message]
1999-03-16  5:00   ` Rob Kirkbride
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