Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Jun 1997 11:13:05 -0500 (CDT)
From:      "Lee Crites (AEI)" <leec@adam.adonai.net>
To:        freebsd-hackers@FreeBSD.ORG
Subject:   setting a really low priority...
Message-ID:  <Pine.BSF.3.95.970605103350.6738B-100000@adam.adonai.net>

next in thread | raw e-mail | index | archive | help

I'd like to have a few processes running on my system which will get,
and maintain, a fixed priority.

Yes, I could use nice to change the initial priority.  In fact, that is
how I am starting one other process on my system already.

But this isn't really what I'm looking for.  I'm more interested in
porting my real-time code to fbsd. 

[note: in this discussion, a 'higher' priority means the process is more
important, thus will be given more system resources, not that it's
priority number is larger -- which would be a 'lower' priority in my
discussion.]

My main scheduler task needs to be fixed at a really high priority.  It
also needs to have it's memory pinned and such, but that's another topic
for another time.  When it runs, I want everyone else to shut up and
take notice.  When it's done with one step it will go to sleep (via the
select() command) until time for the next step to happen.  It is
currenlty running on several other machines (all aix :( ).  It takes up
something less than 3% of the total system, but it needs virtually 100%
of the system when it is awake -- mostly for the scheduling. 

It takes up lots of memory (24meg of ram) and will run for a
loooooonnnnnnnnnnnnnnng time (24/365); use lots of system resources;
trigger events, send/recv socket data (14 tcp, 2 udp), manipulate
semaphores (up to 7) and shared memory (14 of the 24meg), etc, etc;
start and stop lots of other processes (38 of them).  All of these are
things which traditionally move a processes priority down, down, down,
down...

What I'd like is something like aix's fixed priority system.  You can
use the 'regular' unix user priorities, which float around based upon
all sorts of esoteric things (like those listed above), but there are
also fixed priorities which stay fixed.  As I recall (in aix) there are
127 priority levels. The 'regular' user level priorities are, I believe
30 - 69.  There are higher fixed priorities 0 - 29 and lower fixed
priorities from 70 down to 127.

Is there such an animal in FreeBSD?  Can I tell a process to run at a
certain priority and have it stay there?  Is there a way to tell a
process that it will only use a certain range of priorities? 

I'm pretty sure that either of the above would not be a 'standard' unix
feature.  I've tried scanning the code, but frankly didn't get very far. 
(with no real string to grep for and/or no particular process to trace,
etc)

Now, to toss another blob of goo into the soup...

The main scheduler program uses pthreads.  I've tried to get the pthread
scheduling/priority working on aix, but, alas, aix has implemented such
a *tinnny* subset of pthreads that thread priorities don't work very
well (if at all).  So, not only would I like to be able to fix my
process's main thread priority to something fixed, I'd also like to be
able to do the same kind of thing for each thread.

Is the soup murky enough yet?  Okay, I'll let it go at that, then.

Anyway, any pointers you could give me would be greatly appreciated.
(even pointers to some "m's", code, etc)

Lee





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.95.970605103350.6738B-100000>