Skip to content

Golang primitives for Intel's TSX Restricted Transactional Memory

License

Notifications You must be signed in to change notification settings

0xmjk/go-tsx-rtm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Golang primitives for Intel's TSX Restricted Transactional Memory

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published