Synchronize Shared Storage Accesses (SYNCSTG)


Bound program access

Built-in number for SYNCSTG is 617. SYNCSTG ( action : unsigned binary (4) literal )

Description  Enforces an ordering on shared storage accesses performed by the issuing thread. In this discussion, shared storage accesses are reads and writes from/to storage shared among multiple threads. The threads may be associated with the same or different processes.

The action field specifies what type of shared storage accesses (reads, writes, or both) are to be ordered.

The affected shared storage accesses will be ordered in the sense that accesses appearing in the logical flow of the source code before the SYNCSTG will be guaranteed to be completed from the standpoint of the issuing thread before those appearing in the logical flow after the SYNCSTG. For instance, if two reads from two shared locations are separated by a SYNCSTG(0), then the second access will read a value no less current than the first access. If two writes to two shared locations are separated by a SYNCSTG(0), then the first write will be available before the second write.

To completely enforce shared storage access ordering between two or more threads, it is necessary that all threads dependent on the access ordering -- both readers and writers of the shared data -- use appropriate SYNCSTG operations or some other synchronization mechanism such as locks, mutexes, semaphores, or data queues (this list is not intended to be exhaustive).

This instruction is only guaranteed to affect the ordering of shared storage accesses, and is necessary only when the accesses are to different shared storage locations and the semantics of the program depend on the ordering of the shared accesses between two or more threads. In addition, this instruction is only necessary in cases where other synchronization mechanisms (locks, mutexes, etc) are not being used to serialize access to the shared storage locations.

This instruction may have an associated performance penalty, so it is recommended that SYNCSTG be used conservatively when possible.

Authorization Required

Lock Enforcement

Exceptions