Microsoft KB Archive/42227
MSJ SEMCODE: OS/2 Semaphores with Concurrent Threads
PSS ID Number: Q42227 Article last modified on 04-16-1991
MS-DOS | OS/2
Summary: The following is a summary of the program found in the “Microsoft Systems Journal” and in the Software/Data Library: Issue: May 1988, Volume 3, Number 3, pages 19-26 Title: “Using OS/2 Semaphores to Coordinate Concurrent Threads of Execution” Author: Kevin Ruddell Keyword: SEMCODE SEMCODE can be found in the Software/Data Library by searching on the keyword SEMCODE, the Q number of this article, or S10075. SEMCODE was archived using the PKware file-compression utility. SEMCODE contains the code listings, which include information on how to use OS/2 semaphores to coordinate concurrent threads of execution. Each of the figures in SEMCODE is described briefly below: Figure 1 - Using System Semaphores Figure 2 - Two Threads Serializing Access to a Resource Figure 3 - ExitList Processing for a Fast-Safe RAM Semaphore Figure 4 - Signaling between Threads Figure 5 - Using DosSemSetWait() Figure 6 - Using DosMuxSemWait() Figure 7 - Example of a Circular Buffer Figure 8 - Classical Counting Semaphore Figure 9 - Simulating a Counting Semaphore under OS/2 The following text is taken from the cover of the “Microsoft Systems Journal”: OS/2 semaphores are an interprocess communication facility for coordinating concurrent threads of execution. They can serialize access to code and allow a thread to signal that an event has occurred. This article looks at the four types of semaphores: exclusive system, nonexclusive system, RAM, and FSRam.