DelayedFork.mesa
Copyright Ó 1989, 1991, 1992 by Xerox Corporation. All rights reserved.
Created by Christian Jacobi, May 8, 1989 5:43:15 pm PDT
Christian Jacobi, March 5, 1992 11:31 am PST
DelayedFork: CEDAR DEFINITIONS ~
BEGIN
ForkSoon: PROC [ms: INT ¬ 0, proc: PROC[REF], data: REF ¬ NIL, priority: CARD32 ¬ 2];
proc will be forked after approximately ms milliseconds
time very approximate (see below) !
Forked procedures are serialized using a few processes (using more processes if the queue is growing); this saves process initialization time and averages processor load. It also reduces the number of processes at any particular time, however it does not give an absolute guarantee against forking too many processes. (Explicitely: procedures which wedge won't return the underlying process.)
Time delay limitations:
Time approximated to some power-of-two of about a tenth of a second. The fork happens after two ticks of the approximated interval to guarantee a wait period of at least one interval.
A time -1 causes an immediate fork and increases the number of real processes executing procedures until some process becomes idle again. A time of 0 ensures that at least one process is executing the forked procedures.
Procedures which will wait long times on CONDITION's should not be forked with delay times less than 100 milliseconds because this might prevent other procedures from execution for this time interval. (No problem for delays of more then 100 milliseconds: Procedures which are delayed for more then 100 milliseconds will not delay urgent procedures; but the delay for less urgent procedures is limited.)
No nested procedures.
END.