"Deep Background" applications

Dan Trottier dan at maccs.McMaster.CA
Fri Jul 8 22:43:16 AEST 1988


In article <11019 at cgl.ucsf.EDU> seibel at hegel.mmwb.ucsf.edu.UUCP (George Seibel) writes:
>In article <29500025 at urbsdc> aglew at 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 at mcmaster.BITNET



More information about the Comp.unix.questions mailing list