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

3.5. 3.5 Shared Resource

The Shared Resource pattern is a specialization of Blackboard [POSA1] [POSA4] that lacks a control component and introducing aspects of activity parallelism. In the Shared Resource pattern, computations can be performed on ordered data without themselves having a prescribed order. Commonly, components perform different computations on different data pieces simultaneously [OR98] [Ort03].

3.5.1. Example: Token Space

Consider the case of a token space [Gra99]. In its simplest form, a token space is merely a passive storage structure for tokens placed there by active processes called clients. A token may be a specialized data structure, a list, a data tuple or any data type defined via inheritance from some base token class.

In this example a token is considered as a data tuple whose first element is a typed field and whose other elements are name-value pairs, each referred to as a token item. A token may have one or more token items that contain identification information. One or more token items contain data that is being transferred between parallel clients. The token space supports two operations: 'put' and 'request' [Gra99]. A 'put' operation places a token in the token space and is capable of blocking for flow control. If a 'put' operation cannot be blocked, every data source has the potential to saturate the token space. A 'request' operation can only succeed if its tokens are matched. The matching of a token in a request requires matching of each ...

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