Xref: utzoo comp.unix.questions:4755 comp.unix.wizards:5635
Path: utzoo!mnetor!uunet!husc6!think!ames!sdcsvax!hub!angst%csilvax@hub.ucsb.edu
From: angst%csilvax@hub.ucsb.edu (Dave Stein)
Newsgroups: comp.unix.questions,comp.unix.wizards
Subject: Re: How to set priority of a running task (LONG)
Message-ID: <221@hub.ucsb.edu>
Date: 11 Dec 87 23:22:13 GMT
References: <1584@ssc-vax.UUCP>
Sender: news@hub.ucsb.edu
Reply-To: angst%csilvax@hub.ucsb.edu (Dave Stein)
Distribution: na
Organization: University of California, Santa Barbara
Lines: 41

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 

     ...

     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!