Path: utzoo!yunexus!maccs!dan
From: dan@maccs.McMaster.CA (Dan Trottier)
Newsgroups: comp.unix.questions
Subject: Re: "Deep Background" applications
Message-ID: <1303@maccs.McMaster.CA>
Date: 8 Jul 88 12:43:16 GMT
Article-I.D.: maccs.1303
References: <649@necis.UUCP> <29500025@urbsdc> <11019@cgl.ucsf.EDU>
Reply-To: dan@maccs.UUCP (Dan Trottier)
Distribution: na
Organization: McMaster U., Hamilton, Ont., Can.
Lines: 52

In article <11019@cgl.ucsf.EDU> seibel@hegel.mmwb.ucsf.edu.UUCP (George Seibel) writes:
>In article <29500025@urbsdc> aglew@urbsdc.Urbana.Gould.COM writes:
>]
>][buncha stuff about Gould RT unix]
>]
>][More stuff deleted about needing differing levels of background execution
>][priorities.
>
>Boy, would that be nice.  We have a job mix that includes a healthy
>fraction of multi-day cpu burners.  We'd really like a way to make
>those jobs butt out when someone wants to run a short (10 min-1 hr)
>job.   Does anyone know of an easy way to do something like this on
>a bsd 4.[2-3] system?
>
Yes.

Use the BSD command called nice(1) when starting up the job. The scenario
is as follows:

	All jobs run at niceness 0 by default
		- This means they equally share the cpu with
		  other level 0 jobs

	Jobs that run at niceness > 0 get less of the cpu
		- This means they will get less cpu cycles than 
		  jobs with lower niceness values

	Jobs that run with niceness < 0 get more of the cpu
		- This means they will get more cpu cycles than
		  jobs with higher niceness values
		- Only ROOT can set niceness to less that zero

So in order to run a job in the deep background and thus only execute when
nothing else needs the cpu you should use a line like:

	nice 20 myjob &

If you want another background job to capture more of the cpu then try:

	nice 10 anotherjob &

Try several combinations of these nicenesses and see what the effects are.
I found that a utility called "top" does a nice job of showing you the top
X number of jobs running on the system and the resources they are using.

Sorry about posting this but I think many people will be interested in
this.

dan
-- 
       A.I. - is a three toed sloth!        | ...!uunet!mnetor!maccs!dan
-- Official scrabble players dictionary --  | dan@mcmaster.BITNET