A question on Unix/Ultrix CPU scheduling

David Feldman david at linc.cis.upenn.edu
Thu Aug 4 13:40:28 AEST 1988


> From: nijhawan at bgsuvax.UUCP (Sandeep Nijhawan)
> 	If the Super User were to increase the priority of a process by
> using /etc/renice to the maximum possible (-20) and then run a program
> with an infinite loop (completely cpu-bound), would any other user
> process on the system get the cpu at all until the priority of the super
> user's process went below PUSER ? Why?
> 	I modified setpri() in kern_synch.c so that a process with a
> certain uid would always be given a priority of (PUSER - 1) irrespective
> of its p_cpu value. After I rebuilt the kernel and ran an infinte-loop
> process with that uid, I could still run other processes with other uids
> though they ran much less frequently. Any ideas about what's going on?
>	Any help would be much appreciated. Yes, I have Bach.

The UNIX philosophy of process switching is that each process gets a maximum
of one second (called the quanta) and then the process is switched out.
Of the waiting processes that are ready to run, the one with the highest
priority will be run next.  So, a process that runs at a priority higher
than any other process and has no need to wait (e.g. in a disk access or
a page fault) will execute in every other process exec slot.
My knowledge of this comes from v7m on a PDP-11, but I assume things have
not changed too much.

Also, process priorities drop over time if they are CPU hoggish, but this may
not be the case if the pri is less than PUSER.  I have never checked.

_   /|					Dave Feldman
\'o.O'					david at dsl.cis.upenn.edu
=(___)=		Ok, cough!
   U					DSL - land of wonder and enchantment
ACK! PHHT!

Standard Disclaimer: I am not Bill.  I have never been Bill.  I don't ever
	intend to become Bill.  I did not create the above representation
	of Bill.  I don't have cash; send me the Bill.



More information about the Comp.unix.wizards mailing list