[comp.unix.wizards] How to set priority of a running task

dmg@ssc-vax.UUCP (David Geary) (12/11/87)

Does anyone know how to reset a task's priority while it is running?
I know that I can set a task's priority when I execute it using
nice, but I want to set it while it is running.  I've heard of
renice, but we don't have it.  Any other way??

Thanx,

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~	"...You may be right,				~
~	    I may be crazy,				~
~	    but it just may be a lunatic		~
~	    you're looking for..."			~
~							~
~		"You May Be Right", Billy Joel		~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- 
***********************************************************
* David Geary, Boeing Aerospace Co., Seattle, WA 	  *
* (206)773-5249.  --I disclaim everything I've ever said--*
***********************************************************

angst%csilvax@hub.ucsb.edu (Dave Stein) (12/12/87)

In article <1584@ssc-vax.UUCP>, dmg@ssc-vax.UUCP (David Geary) writes...

>Does anyone know how to reset a task's priority while it is running?
>I know that I can set a task's priority when I execute it using
>nice, but I want to set it while it is running.  I've heard of
>renice, but we don't have it.  Any other way??

You didn't say what flavour of UN*X you're running, but on BSD 4.2/3
and those based on BSD (like Sun 3.X), you can use the setpriority
system call to accomplish this.

Excerpt reprinted without permission...

GETPRIORITY(2)      UNIX Programmer's Manual       GETPRIORITY(2)


NAME
     getpriority, setpriority - get/set program scheduling prior-
     ity

SYNOPSIS
     #include <sys/resource.h>

     ...

     setpriority(which, who, prio)
     int which, who, prio;

DESCRIPTION
     ...

     The setpriority call sets the priorities of all of the
     specified processes to the specified value.  Only the
     super-user may lower priorities.


I don't know if it's available on Sys V.  Anyone?

Dave Stein						    "Life's a clambake."
ARPA: angst%csilvax@hub.ucsb.edu	      Disclaimer: college students don't
UUCP: ...ucbvax!hub!csilvax!angst			  need no disclaimers!