[comp.sys.amiga] process priorities

CRONEJP@UREGINA1.BITNET (Jonathan Crone) (03/14/88)

anyone know of a program that will let me change the process priorities
of running processes???

if such a devil exists pls mail me the Uuencoded to me please.


Jonathan Crone

====================================================================
Jonathan P. Crone
Vice President, AURA,  (Amiga Users of Regina Associated.)
(Regina, Sask. Canada )    (eh???)

CRONEJP@UREGINA1.BITNET
....rutgers!mimsy!uunet!mcl!cronejp

come on now....  does ANYONE give a damn about what i have to say?
====================================================================

page@swan.ulowell.edu (Bob Page) (03/15/88)

CRONEJP@UREGINA1.BITNET (Jonathan Crone) wrote:
>anyone know of a program that will let me change the process priorities
>of running processes???

It's called ChangeTaskPri, on the workbench disk, in the C: directory.

..Bob
-- 
Bob Page, U of Lowell CS Dept.  page@swan.ulowell.edu  ulowell!page
"Why?  It's the heat."	-- Laurie Anderson

shimoda@rmi.UUCP (Markus Schmidt) (03/18/88)

In article <5455@swan.ulowell.edu> page@swan.ulowell.edu (Bob Page) writes:
: CRONEJP@UREGINA1.BITNET (Jonathan Crone) wrote:
: >anyone know of a program that will let me change the process priorities
: >of running processes???
: 
: It's called ChangeTaskPri, on the workbench disk, in the C: directory.
Hi!

ChangeTaskPri changes just the priority of the cli it was
started from. But on the Gizmoz-Bench there was a tool to change
pri of running processes.

C u
Markus
(shimoda@rmi.uucp)
|._,|
 - -
==O==
 `-'

schein@cbmvax.UUCP (Dan Schein CATS) (03/18/88)

In article <8803140401.AA06838@jade.berkeley.edu> CRONEJP@UREGINA1.BITNET (Jonathan Crone) writes:
>anyone know of a program that will let me change the process priorities
>of running processes???
>
>if such a devil exists pls mail me the Uuencoded to me please.
>
  I have a PD / Shareware (?) program called "Taskx V2.0" by Steve Tibbett.
  It allows you to change the task priority of all the tasks running. Tasks
  like... printer.device, con, workbench, trackdisk.device, ect.  I suggest
  you locate a copy on one of the commercial networks or a BBS.
>
>Jonathan Crone
>


-- 
   Dan Schein		 uucp: {ihnp4|allegra|burdvax|rutgers}!cbmvax!schein
   Commodore AMIGA			ARPANET:  cbmvax!schein@uunet.uu.net
   1200 Wilson Drive			Bix: dschein	     Plink: Dan*CATS
   West Chester PA 19380		phone: (215) 431-9100	   ext. 9542
+----------------------------------------------------------------------------+
   All spelling mistakes are a result of my efforts to avoid education  :-)
+----------------------------------------------------------------------------+
        I help Commodore by supporting the AMIGA. Commodore supports
         me by allowing me to form my own suggestions and comments.

page@swan.ulowell.edu (Bob Page) (03/19/88)

shimoda@rmi.UUCP (Markus Schmidt) wrote:
>ChangeTaskPri changes just the priority of the cli it was started from.

I have two ChangeTaskPri programs on my disk, one from CBM and one from
the ARP projects.  Both will take a task number.

ChangeTaskPri <Priority> <Process>

I typed "ChangeTaskPri ?" to get this info.

..Bob
-- 
Bob Page, U of Lowell CS Dept.  page@swan.ulowell.edu  ulowell!page
		"Nicaragua" is Spanish for "Vietnam."

rusty@hocpa.UUCP (M.W.HADDOCK) (03/20/88)

In article <5558@swan.ulowell.edu> page@swan.ulowell.edu (Bob Page) writes:
>shimoda@rmi.UUCP (Markus Schmidt) wrote:
>>ChangeTaskPri changes just the priority of the cli it was started from.
>
>I have two ChangeTaskPri programs on my disk, one from CBM and one from
>the ARP projects.  Both will take a task number.
>
>ChangeTaskPri <Priority> <Process>
>
>I typed "ChangeTaskPri ?" to get this info.
>
>Bob Page, U of Lowell CS Dept.  page@swan.ulowell.edu  ulowell!page

Sorry Bob, but try using the Workbench 1.2 changetaskpri when you say
the one from CBM, OK?   The one that comes with 1.2 says, and I quote:

	Pri/a:
	Give new priority

The Beta 1.3 says 

	Pri/a,Process/k:
	Give new priority

The version that outputs

	"ChangeTaskPri <Priority> <Process>"

IS NOT FROM CBM but probably the ARP disk.  Sorry, I haven't installed
the ARP commands.... yet.  For completeness (as far as I know) there's
yet another Change Task Priority program (cpri) from a Dewi Williams
in Bell Labs.  in Colorado and his says:

	usage: cpri [+/-]priority CLI-process-number

The version from CBM only changes the priority of the CURRENT CLI.

As the Police say after giving you a ticket with the largest fine
that they can possibly dream up...... "Have A Nice Day!"

				-Rusty-
----
Rusty Haddock {uunet!likewise,cbosgd,rutgers!mtune}!hocpa!rusty
AT&T Consumer Products Laboratories - Human Factors Laboratory
Holmdel, New Joyzey  07733		(201) 834-1023
     -- Any sufficiently advanced technology is indistinguishable
	from magic.	-Arthur C Clark-
     -- ... or a rigged demo.

mp1u+@andrew.cmu.edu (Michael Portuesi) (03/26/88)

shimoda@rmi.UUCP (Markus Schmidt) writes:
> ChangeTaskPri changes just the priority of the cli it was
> started from. But on the Gizmoz-Bench there was a tool to change
> pri of running processes.

ChangeTaskPri also changes the priority of all new processes run from
that CLI.  So if you want to run your compiler at lower priority than
your terminal program, you issue a ChangeTaskPri command right before
running the compiler.

If anybody has a program that will allow changing the priority of
processes on the fly, could they do us all a favor and post it to the
sources and binaries groups?

		--M


Michael Portuesi / Carnegie Mellon University
ARPA/UUCP: mp1u+@andrew.cmu.edu		BITNET: rainwalker@drycas

"words like conviction can turn into a sentence"  -- general public

ali@polya.STANFORD.EDU (Ali T. Ozer) (04/11/88)

In article <UWGgjsy00XcQ0M0u8Q@andrew.cmu.edu> Michael Portuesi writes:
>If anybody has a program that will allow changing the priority of
>processes on the fly, could they do us all a favor and post it to the
>sources and binaries groups?

Here's one I put together. It's short, so rather than waiting for the
sources group, I'll post it here. This program lets you change the priority 
of a CLI process (those that are listed by stat or status, for instance).

1> pri -2 2    <- will change the priority of CLI process 2 to -2.

By the way, if you'd like the executable, I can send it to you in uuencoded
form --- please send me a message.

Ali Ozer, ali@polya.stanford.edu

------8<----------------------------------------------------------------------

/* PRI, by Ali T. Ozer (ARPA: ali@score.stanford.edu)
** Written April 1988. Freely distributable.
** 
** Usage: pri <pri> <process>
** 
** Sets the priority of the specified process to pri. These have to be CLI
** processes; pri won't change the prioirity of programs started from the WB.
*/

#include <libraries/dosextens.h>

struct DosLibrary *DosBase, *OpenLibrary();
struct FileHandle *Output();

#define ILLEGALNUM (-9999)  

void Bye (msg) char *msg; {
  struct FileHandle *out;
  if (msg && (out = Output())) Write (out, msg, (long)strlen(msg));
  if (DosBase) CloseLibrary (DosBase);
  exit (msg ? 5 : 0);
}

/* Parse a signed integer. Return ILLEGALNUM on parse error.
*/
int myatoi (str) char *str; {
  int sign = 1, num = 0;
  if (*str == '-') {str++; sign = -1;} else if (*str == '+') str++;
  while (*str) 
    if (*str < '0' || *str > '9') return (ILLEGALNUM);
    else num = num * 10 - '0' + (*str++);
  return (sign * num);
}

main (argc, argv) int argc; char **argv;
{
  int prn, pri;  /* Process number and new desired priority */
  struct RootNode *rn;
  long *lptr;

  if (argc == 0) Bye (NULL);  /* Don't run from Workbench */

  if (((DosBase = OpenLibrary ("dos.library", 0L)) == NULL) ||
      ((rn = (struct RootNode *)DosBase->dl_Root) == NULL) ||
      ((lptr = (long *)((rn->rn_TaskArray) << 2L)) == NULL)) Bye ("DOS?\n");

  /* Now parse the arguments. We need two arguments, first the priority 
  ** (-128..127), and second, the process number (1..Max# of CLIs allowed).
  */

  if (argc != 3) Bye ("Usage: pri <pri> <process>\n");
  if ((pri = myatoi(argv[1])) > 127 || pri < -128) Bye ("Bad priority\n");
  prn = myatoi(argv[2]);

  /* At this stage, lptr points to AmigaDOS's array of CLIs. The first element
  ** in this array is the maximum number of CLIs allowed. Then follows this
  ** many pointers, which, if not NULL, point to CLI processes. (Actually,
  ** they do not point to the process. A process is simply an Amiga 
  ** Task structure, followed by an Amiga MsgPort structure, and then
  ** followed other stuff. These pointers point to the MsgPort structure.
  ** Thus, to get to the task structure (so we can SetTaskPri()), we'll need
  ** to subtract the size of the task structure from the MsgPort pointer.)
  */

  Forbid();
  if ((prn > 0) && ((long)prn <= *lptr) && *(lptr+prn))
    SetTaskPri ((struct Task *)(*(lptr+prn) - sizeof(struct Task)), (long)pri);
    else Bye ("No such process\n");
  Permit();
}