FastFork.mesa
Copyright Ó 1989, 1991, 1992 by Xerox Corporation. All rights reserved.
Created by Christian Jacobi, February 27, 1989 12:18:47 pm PST
Christian Jacobi, March 5, 1992 11:29 am PST
FastFork: CEDAR DEFINITIONS ~
BEGIN
Fork: PROC [proc: PROC[REF], data: REF ¬ NIL, priority: CARD32 ¬ 2];
Like TRUSTED { Process.Detach[FORK proc[data]] } except
1) faster ! (in average)
2) proc starts execution on specified priority.
Why this is faster than the language FORK:
It assumes the language FORK has to initialize a stack frame; but this Fork most often doesn't need to do this.
This package has a small pool for processes. If on fork the pool is not empty a process is reactivated instead of created. This algorithm also works if the number of processes exceeds the pool size: Processes in excess of the size pool size are keept alive for few tenths of a second before discarding.
This a) saves initialization times, and, b) maybe might improve VM paging behaviour by using a LIFO
Caveats
Like using the language FORK:
-This module does not prevent clients from forking too many processes.
-No nested procedures. However, this module would crash more friendly.
END.