Process Priority

Is there a way to set the priority of a process (as opposed to a thread)
spawned by spawn() or equivalent programatically? We have a process
manager that spawns numerous programs and we want to modify it so that we
can spawn processes at different priorities.

…Stephen

On 27 Feb 2004 16:23:05 GMT, Stephen Rasku wrote:

Is there a way to set the priority of a process (as opposed to a thread)
spawned by spawn() or equivalent programatically? We have a process
manager that spawns numerous programs and we want to modify it so that we
can spawn processes at different priorities.

…Stephen

Look at the (undocumented) param member of the inherit structure passed to
spawn(), along with the (undocumented) SPAWN_EXPLICIT_SCHED bit in the
flags (see /usr/include/spawn.h).

This works in 6.21B. I’m not sure why it is undocumented. Perhaps QSSL can
comment?

Rob Rutherford
Ruzz Technology

Stephen Rasku wrote:

Is there a way to set the priority of a process (as opposed to a thread)
spawned by spawn() or equivalent programatically? We have a process
manager that spawns numerous programs and we want to modify it so that we
can spawn processes at different priorities.

if you know the name you can use system(“slay slay -P 18 programmName”);

jan

In article <c27956$ahp$1@inn.qnx.com>, Jan Rüdiger wrote:

Stephen Rasku wrote:
Is there a way to set the priority of a process (as opposed to a thread)
spawned by spawn() or equivalent programatically? We have a process
manager that spawns numerous programs and we want to modify it so that we
can spawn processes at different priorities.

if you know the name you can use system(“slay slay -P 18 programmName”);

I wasn’t aware of “slay”. Thanks for the tip. We also found a system
call, setprio(), that will work for us.

…Stephen

Stephen Rasku wrote:

Is there a way to set the priority of a process (as opposed to a thread)
spawned by spawn() or equivalent programatically? We have a process
manager that spawns numerous programs and we want to modify it so that we
can spawn processes at different priorities.

…Stephen

4th spawn’s argument is a pointer to ‘struct inheritance’ which has the
following fields among others: ‘struct sched_param param’ and ‘int
policy’. I guess that’s what you’re looking for.

Stephen Rasku <spr@shaw.ca> wrote:

Is there a way to set the priority of a process (as opposed to a thread)
spawned by spawn() or equivalent programatically? We have a process
manager that spawns numerous programs and we want to modify it so that we
can spawn processes at different priorities.

Or, change your priority first, then spawn the program, as priority is
inherited from parent to child.

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.