Share on Facebook
From Wikipedia, the free encyclopedia
Jump to: navigation, search

Transactional Synchronization Extensions (TSX) is an extension to the x86 instruction set architecture that adds hardware transactional memory support. It was documented by Intel in February 2012 and is scheduled to be first implemented in Intel microprocessors based on the Haswell microarchitecture.[1][2]

Contents

Features [edit]

TSX provides two software interfaces for designating code regions for transactional execution. Hardware Lock Elision (HLE) is an instruction prefix-based interface designed to be backward compatible with processors without TSX support. Restricted Transactional Memory (RTM) is a new instruction set interface that provides greater flexibility for programmers. TSX enables optimistic execution of transactional code regions. The hardware monitors multiple threads for conflicting memory accesses and aborts and rolls back transactions that cannot be successfully completed. Mechanisms are provided for software to detect and handle failed transactions.

Hardware Lock Elision [edit]

Hardware Lock Elision adds two new instruction prefixes XACQUIRE and XRELEASE. These two prefixes reuse the opcodes of the existing REPNE/REPE prefixes (F2H/F3H). On processors that do not support TSX, REPNE/REPE prefixes are ignored on instructions for which the XACQUIRE/XRELEASE are valid, thus enabling backward compatibility.

The XACQUIRE prefix hint can only be used with the following instructions with an explicit LOCK prefix: ADD, ADC, AND, BTC, BTR, BTS, CMPXCHG, CMPXCHG8B, DEC, INC, NEG, NOT, OR, SBB, SUB, XOR, XADD, and XCHG. The XCHG instruction can be used without the LOCK prefix as well.

The XRELEASE prefix hint can only be used with the following instructions with an explicit LOCK prefix: ADD, ADC, AND, BTC, BTR, BTS, CMPXCHG, CMPXCHG8B, DEC, INC, NEG, NOT, OR, SBB, SUB, XOR, XADD, and XCHG. The XCHG instruction can be used without the LOCK prefix as well. The "MOV mem, reg" and "MOV mem, imm" instructions can be used as well.

HLE allows optimistic execution of a critical section by eliding the write to a lock, so that the lock appears to be free to other threads. A failed transaction results in execution restarting from the XACQUIRE-prefixed instruction, but treating the instruction as if the XACQUIRE prefix were not present.

Restricted Transactional Memory [edit]

Restricted Transactional Memory is an alternative implementation to HLE which gives the programmer the flexibility to specify a fallback code path that is executed when a transaction cannot be successfully executed. RTM adds three new instructions XBEGIN, XEND and XABORT. The XBEGIN and XEND instructions mark the start and the end of a transactional code region; the XABORT instruction explicitly aborts a transaction. Transaction failure redirects the processor to the fallback code path specified by the XBEGIN instruction, with the abort status returned in the EAX register.

EAX Register
Bit Position
Meaning
0 Set if abort caused by XABORT instruction.
1 If set, the transaction may succeed on a retry. This bit is always clear if bit 0 is set.
2 Set if another logical processor conflicted with a memory address that was part of the transaction that aborted.
3 Set if an internal buffer overflowed.
4 Set if debug breakpoint was hit.
5 Set if an abort occurred during execution of a nested transaction.
23:6 Reserved.
31:24 XABORT argument (only valid if bit 0 set, otherwise reserved).

XTEST instruction [edit]

TSX provides a new XTEST instruction that returns whether the processor is executing a transactional region.

References [edit]

  1. ^ "Transactional Synchronization in Haswell". Software.intel.com. Retrieved 2012-02-07. 
  2. ^ "Transactional memory going mainstream with Intel Haswell". Ars Technica. 2012-02-08. Retrieved 2012-02-09. 

External links [edit]

Wikipedia content is licensed under the GNU Free Document License or Creative Commons CC-BY-SA
Loading...
Loading...
Top Videos
Latest Videos

Here you can share your comments or contribute with more information, content, resources or links about this topic.