Tuesday, December 22, 2009

Summary









Summary


Windows supports a complete set of synchronization operations that allows threads and processes to be implemented safely. Synchronization introduces a host of program design and development issues that must be considered carefully, to ensure both program correctness and good performance.


Looking Ahead


Chapter 9 concentrates on multithreaded and synchronization performance issues. The first topic is the performance impact of SMP systems; in some cases, resource contention can dramatically reduce performance, and several strategies are provided to assure robust or even improved performance on SMP systems. Trade-offs between mutexes and CRITICAL_SECTIONs, followed by CRITICAL_SECTION tuning with spin counts, are treated next. The chapter concludes with guidelines summarizing the performance-enhancing techniques, as well as performance pitfalls.


Additional Reading


Windows

Synchronization issues are independent of the OS, and many OS texts discuss the issue at length and within a more general framework.


Other books on Windows synchronization have already been mentioned. When dealing with more general Windows books, however, exercise caution because some are misleading when it comes to threads and synchronization, and most have not been updated to reflect the NT5 features used here. One very popular and well-reviewed book, for instance, while consuming a large number of pages of prose, never mentions the need for volatile storage, does not explain the four event combinations adequately, and recommends the deadlock-prone multiple semaphore wait solution (discussed in the section on semaphores) as a technique for obtaining more than one semaphore unit.


David Butenhof's Programming with POSIX Threads is recommended for in-depth thread and synchronization understanding, even for the Windows programmer. The discussions and descriptions generally apply equally well to Windows, and porting the example programs can be a good exercise.









    No comments: