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 ...

Get Patterns for Parallel Software Design 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.