CHAPTER 6

Synchronization and Memory Consistency

Although parallel processing enables fast execution, it also creates the need for synchronization. Synchronization operations ensure that although threads execute independently, their efforts are coordinated such that the same result that would be produced by a sequential execution is achieved. It is, however, equally important not to overspecify such coordination, in order to give threads enough flexibility to overlap their activities and optimize the overall execution time. Synchronization is in general one of the more difficult issues in parallel computing. However, it should be noted that for most scientific codes, the needed synchronization concepts and constructs are typically the simpler ones, and Sections 6.1 and 6.2 might be providing all or most of what is needed for scientific applications. Software system applications (e.g., a parallel database management system) typically require the more advanced concepts. UPC supports a range of synchronization primitives from the simple to the sophisticated to support all application needs. Therefore, in addition to scientific applications, we consider a number of standard computer science problems that can illustrate some of the UPC concepts in this chapter, such as the dining philosophers and the bakery shop.

One can differentiate between control synchronization and data (memory consistency) synchronization. Along the lines of control synchronization, two questions that can be ...

Get UPC: DISTRIBUTED SHARED MEMORY PROGRAMMING now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.