PeriodicalFork.mesa
Copyright Ó 1989, 1991, 1992 by Xerox Corporation. All rights reserved.
Created by Christian Jacobi, March 1, 1989 4:34:03 pm PST
Christian Jacobi, March 5, 1992 11:34 am PST
PeriodicalFork: CEDAR DEFINITIONS ~
BEGIN
Register: PROC [ms: INT, proc: PROC[REF], data: REF ¬ NIL, priority: CARD32 ¬ 2];
proc will be called approximately once every ms milliseconds
time very approximate !
Unregister: PROC [proc: PROC[REF], data: REF ¬ NIL];
stops calling this proc/data closure soon
UnregisterSelf: PROC [];
stops further calls on this closure
must be used by proc called from PeriodicalFork only
this is implemented with signals and won't work if UNCAUGHT or ANY is catched
Allows to repeatedly fork a procedure.
Calls for every registration are synchronized: a procedure will not be called again unless the previous call returned.
Time intervalls between forks are approximative.
Time interval limitations
Minimum interval about a tenth of a second; depending on processor speed.
Interval approximated to some power of two of minimum interval
Motivation
Many packages have a process which periodically does some work. By using this mechanism such packages can avoid permanently allocating a PROCESS resource. The implementation tries to schedule calls so that the number of actual processes at any particular time is reduced. Maybe this might even improve VM paging behaviour a little.
END.