Transactional memory built-in functions

Transactional memory is a model for parallel programming. This module provides functions that allow you to designate a block of instructions or statements to be treated atomically. Such an atomic block is called a transaction. When a thread executes a transaction, all of the memory operations within the transaction occur simultaneously from the perspective of other threads.

For some kinds of parallel programs, a transaction implementation can be more efficient than other implementation methods, such as locks. You can use these built-in functions to mark the beginning and end of transactions, and to diagnose the reasons for failure.

In the transactional memory built-in functions, the TM_buff parameter allows for a user-provided memory location to be used to store the transaction state and debugging information.

The transactional state is entered following a successful call to __TM_begin or __TM_simple_begin, and ended by __TM_end, __TM_abort, __TM_named_abort, or by transaction failure.

Transaction failure occurs when any of the following conditions is met:
  • Memory that is accessed in the transactional state is accessed by another thread or by the same thread running in the suspended state before the transaction completes.
  • The architecture-defined footprint for memory accesses within a transaction is exceeded.
  • The architecture-defined nesting limit for nested transactions is exceeded.

Transactions can be nested. You can use __TM_begin or __TM_simple_begin in the transactional state. Within an outermost transaction initiated with __TM_begin, nested transactions must be initiated with __TM_simple_begin, or by __TM_begin using the same buffer of the outermost containing transaction.

A nested transaction is subsumed into the containing transaction. Therefore, a failure of the nested transaction is treated as a failure of all containing transactions, and the nested transaction completes only when all contained transactions complete.



Voice your opinion on getting help information Ask IBM compiler experts a technical question in the IBM XL compilers forum Reach out to us