From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,ad5311af1ae95293 X-Google-Attributes: gidfee84,public X-Google-Thread: 10650a,ad5311af1ae95293 X-Google-Attributes: gid10650a,public From: "Rob Kirkbride" Subject: Re: Thread priorities Date: 1999/03/16 Message-ID: <7cl5sf$v8f$1@news7.svr.pol.co.uk>#1/1 X-Deja-AN: 455554937 References: <7caki3$fv8$1@news5.svr.pol.co.uk> <36E92C41.8A412DBD@brighttiger.com> X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 X-Complaints-To: abuse@theplanet.net X-Trace: news7.svr.pol.co.uk 921574095 32015 62.136.60.239 (16 Mar 1999 08:48:15 GMT) Organization: Customer of Planet Online NNTP-Posting-Date: 16 Mar 1999 08:48:15 GMT Newsgroups: comp.unix.internals,comp.unix.osf.osf1 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 >__________________________________________________