Locks. Naturally, an explicit lock can simply be represented by an empty memo in a folder.
FOLDER_NAME lock;MEMO q;...memo_write(lock,"",0);...q = memo_get(lock);... /* perform critical section */memo_replace(q);
Semaphores. The simplest implementation of a counting semaphore is identical to a lock, except that to initialize the semaphore, a process places as many empty memos in the semaphore's folder as are required by the initial count.
This page last updated 09/30/97