1987-05-13 14:36:45 +00:00
|
|
|
DEFINITION MODULE Processes;
|
1988-02-19 15:54:01 +00:00
|
|
|
(*
|
|
|
|
Module: Processes
|
|
|
|
From: "Programming in Modula-2", 3rd, corrected edition, by N. Wirth
|
|
|
|
Version: $Header$
|
|
|
|
*)
|
1988-04-26 13:04:04 +00:00
|
|
|
(*
|
|
|
|
As discussed in "Unfair Process Scheduling in Modula-2", by
|
|
|
|
D. Hemmendinger, SIGplan Notices Volume 23 nr 3, march 1988,
|
|
|
|
the scheduler in this module is unfair, in that in some circumstances
|
|
|
|
ready-to-run processes never get a turn.
|
|
|
|
*)
|
1987-05-13 14:36:45 +00:00
|
|
|
|
|
|
|
TYPE SIGNAL;
|
|
|
|
|
|
|
|
PROCEDURE StartProcess(P: PROC; n: CARDINAL);
|
|
|
|
(* Start a concurrent process with program "P" and workspace of
|
|
|
|
size "n"
|
|
|
|
*)
|
|
|
|
|
|
|
|
PROCEDURE SEND(VAR s: SIGNAL);
|
|
|
|
(* One process waiting for "s" is resumed
|
|
|
|
*)
|
|
|
|
|
|
|
|
PROCEDURE WAIT(VAR s: SIGNAL);
|
|
|
|
(* Wait for some other process to send "s"
|
|
|
|
*)
|
|
|
|
|
|
|
|
PROCEDURE Awaited(s: SIGNAL): BOOLEAN;
|
|
|
|
(* Return TRUE if at least one process is waiting for sinal "s".
|
|
|
|
*)
|
|
|
|
|
|
|
|
PROCEDURE Init(VAR s: SIGNAL);
|
|
|
|
(* Compulsory initialization
|
|
|
|
*)
|
|
|
|
END Processes.
|