O'Reilly logo

Patterns for Parallel Software Design by Jorge Luis Ortega-Arjona

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

4.5. 4.5 Shared Variable Channel

The Shared Variable Channel pattern describes the design of a channel component for a Communicating Sequential Elements system, based on shared variables and synchronization mechanisms. These provide a method for implementing send and receive operations that emulate the behavior of a channel component for a shared memory parallel system.

4.5.1. Example

Consider the Heat Equation example from the description of the Communicating Sequential Elements pattern [OR98] [Ort00] [Section 3.3]. A parallel program to implement this was designed at the architectural level using a domain decomposition based on Communicating Sequential Elements, in which a one-dimensional body, a wire, is divided into segments such that the temperature level of each segment could be simultaneously computed, but in which each segment requires information from its previous and following neighbor segments to obtain its own temperature. We assume that the parallel program is to be developed for a shared memory computer and that the programming language available for such a computer supports semaphores [Dij68] [Har98], critical regions [Hoa72] [Bri72] or monitors [Hoa74] [Bri75] [Har98] as synchronization mechanisms for asynchronous process communication.

In the Communicating Sequential Elements pattern implementation of the Heat Equation, each sequential element is responsible for calculating the temperature of a segment of the wire. Each element therefore needs to receive data ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required