Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Process.setPriority()

Hi!

I agree about the relative priorities and absolute. As it turns out, also nice to have some functional priorities along with those relative priorities.

What's a functional priority? Well lets assume that PRI_NORMAL maps to PRI_NORMAL on NT and 0 on Linux. Lets assuming that PRI_LOWEST maps to PRI_LOW on NT and -N on Linux.

If you want to run a process that always runs and behaves nicely with eclipse you want that process to be PRI_LOW on NT and 0 on Linux. There is no "right" abstracted priority of those 5 to use because priority does not encapsulate how well the OS deals with priorities at wildly different priorities (bad on busy linux servers) or the same( bad on NT where java/eclipse gets starved)

I'm currently using the 5 listed below and PRI_NICE_GREEDY (or something like that.) PRI_NICE_GREEDY is a functional name. It makes CPU greedy processes run nicely and maps to 0 on Linux and PRI_LOW on NT.

Thanks,
-Chris

At 05:32 PM 2/3/2003 -0700, Chris McKillop wrote:

Well, that isn't bad but it doesn't really give you a lot of
freedom.  It implies that HIGHEST is the upper bound and
LOWEST is the lower bound of possible priorities.  On QNX (as an
example), a normally run process would have the range mapped to
+53 to -9.  While on Windows this would be more accurate.

So I still vote for the two APIs but I like the contants.  Perhaps
we rename them to...

setPriority() and setAbsPriority() so that the shorter API is the
one that does relative priority setting?

    chris


On Wed, Jan 29, 2003 at 10:37:56AM -0500, Ed Burnette wrote:
> May I suggest one routine, and some constants to go with it:
>
> public int setPriority(int priority) { /* ... */ }
> public final int PRIORITY_HIGHEST = 2;
> public final int PRIORITY_ABOVENORMAL = 1;
> public final int PRIORITY_NORMAL = 0;
> public final int PRIORITY_BELOWNORMAL = -1;
> public final int PRIORITY_LOWEST = -2;
>
> (inspired by C# Thread.Priority property)
> Not sure about the values (positive and negative) but having constants would be nice (no pun intended).
>
> > -----Original Message-----
> > From: Chris McKillop [mailto:cdm@xxxxxxx]
> > Sent: Tuesday, January 28, 2003 1:14 AM
> > To: cdt-dev@xxxxxxxxxxx
> > Subject: Re: [cdt-dev] Process.setPriority()
> >
> >
> > On Mon, Jan 27, 2003 at 09:30:49AM -0800, Chris Songer wrote:
> > > Hi!
> > >
> > > I think you want both a relative and absolute actually. For
> > the fellow who
> > > wants to do something platform specific you let them pass
> > in a raw priority
> > > number. You also do what you suggest and have win32 like
> > settings, Low,
> > > BelowNormal, Normal, AboveNormal and High. If you just do
> > the latter then
> > > you've hosed the fellow who really needs control for some reason.
> > >
> >
> > Actually, I was thinking more like this...
> >
> > .setPriority( int val );
> > .setRelativePriority( int delta );
> >
> >
> > Then you have complete control, but without having to worry
> > about figuring
> > out what the priority of the caller's process actually might be.
> >
> > So, to emulate nice you could do...
> >
> > .setRelativePriority( -1 );
> >
> > ...but to be totally system specific...
> >
> > .setPriority( 9 );
> >
> > Just make sure to put a nice warning on the .setPriority()
> > value that it's
> > meaning is system dependant and that (more) portable code
> > should use relative
> > priorities. ;)
> >
> >     chris
> >
> > --
> >   Chris McKillop <cdm@xxxxxxx>   "The faster I go, the
> > behinder I get."
> >   Software Engineer, QSSL                   -- Lewis Carroll --
> >   http://qnx.wox.org/
> >
> >
> > _______________________________________________
> > cdt-dev mailing list
> > cdt-dev@xxxxxxxxxxx
> > http://dev.eclipse.org/mailman/listinfo/cdt-dev
> >
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/cdt-dev

--
  Chris McKillop <cdm@xxxxxxx>   "The faster I go, the behinder I get."
  Software Engineer, QSSL                   -- Lewis Carroll --
  http://qnx.wox.org/


_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/cdt-dev



Back to the top