1 DEFINITION MODULE Semaphores;
3 Module: Processes with semaphores
4 Author: Ceriel J.H. Jacobs
5 Version: $Id: Semaphores.def,v 1.3 1994/06/24 12:49:38 ceriel Exp $
7 On systems using quasi-concurrency, the only opportunities for process-
8 switches are calls to Down and Up.
13 PROCEDURE Level(s: Sema) : CARDINAL;
14 (* Returns current value of semaphore s *)
16 PROCEDURE NewSema(n: CARDINAL) : Sema;
17 (* Creates a new semaphore with initial level "n" *)
19 PROCEDURE Down(VAR s: Sema);
20 (* If the value of "s" is > 0, then just decrement "s".
21 Else, suspend the current process until the semaphore becomes
25 PROCEDURE Up(VAR s: Sema);
26 (* Increment the semaphore "s".
29 PROCEDURE StartProcess(P: PROC; n: CARDINAL);
30 (* Create a new process with procedure P and workspace of size "n".
31 Also transfer control to it.