Skip to content

Latest commit

 

History

History
26 lines (18 loc) · 1.23 KB

README.md

File metadata and controls

26 lines (18 loc) · 1.23 KB

Go Report Card GoDoc MIT licensed

Transactional Synchronization Extensions (TSX) is an extension to the Intel x86 ISA adding hardware transactional memory support.

Restricted Transactional Memory (RTM) uses new XBEGIN and XEND instructions to mark start and end of a critical section. The processor would treat this section as an atomic transaction.

This package exposes these primitives to the developer.

This code doesn't check if the CPU supports RTM at all, so it is necessary to do it first, e.g.:

import (
  "github.com/intel-go/cpuid"
)

func CpuHasRTM() bool {
	return cpuid.HasExtendedFeature(cpuid.RTM)
}

Caveat: Golang will not inline assembly at the moment so using this might be slower than similar GCC implementation.

Have a look at Intel's "Intrinsics for Restricted Transactional Memory Operations" for more background.