[comp.os.misc] question about process scheduling for UNIX SYS V

bier@puff.cs.wisc.edu (George Bier) (02/14/89)

I am trying to program a simulation of the scheduler for SYS V and my source
(Bach's book) is not very clear on the following point:

Suppose there are two processes with the exact same priority, (lets call them
A and B) and they are currently the two highest priority processes in the 
system.  One of the two processes (lets suppose A) is selected to execute.  
Suppose A makes a simple system call (one that does not require a
sleep or block).  Before A returns to user mode, its priority is recomputed.
As I understand it, if no clock interrupts have occured since A started
executing then its priority will stay exactly the same as it was before
the system call.  This means that A and B are both at the same priority.
The question is, does A continue executing or does a context switch to B 
occur as part of the return from the system code.  

The book indicates that A continues only if it is still the highest priority
process in the system, but does not indicate what happens if it is tied
for highest priority as it would be in this hypothetical instance.

I would be interested in what the correct answer is to this query for both
SYS V, and Berkeley 4.3, but more importantly for SYS V.

thanks,

--george bier

INTERNET: bier@cs.wisc.edu
UUCP:   ...!{harvard,seismo,topaz,akgua,allegra,usbvax}!uwvax!bier

"Nobody leaves this place without singing the blues"