先发第一部分;:附原文
Anyone designing multithreaded applications will agree: the problem of efficient synchronization is among the most difficult tasks of parallel programming. Modern operating systems provide a multitude of synchronization objects, which determine a variety of synchronization methods and schemes.
This article addresses some of the issues of parallel program synchronization and tries to clarify at least a few of them.
Below, several synchronization schemes are discussed; synchronization object behavior is described; internal system implementation of user-visible synchronization objects or functions is also explained where applicable. Hidden timings and latencies are provided; execution thread layout is shown over time, and non-obvious thread time shifts are pointed out.
Readers will also find code examples illustrating important points of the synchronization problem.
All discussions of synchronization objects and algorithms appearing in this article pertain to Microsoft Windows* implementations of such objects and algorithms.
Definitions
Several abbreviations are used throughout the article to denote the following terms:
IPI stands for Inter-Processor Interrupt, an interruption signal sent by one processor to another.
APC, Asynchronous Procedure Call, which is a Microsoft Windows* notification scheme enabling the execution of a specified procedure within the context of a specified thread.