Hardware support for atomic operations

Both TAS and CAS are Read-Modify-Write operations

Info

CAS can be implemented wait-free on hardware!

Java does not have a true TAS operation :P

TAS Lock and CAS Lock - Spinlock

Problem mit TAS Lock

lock-holder: state = true -> laufend neue Write-Action lock-contenders: Kopie von state laufend invalidiert, jedes Mal eine neue Kopie von Main Memory…

  • sowieso ein langsamer Ansatz
  • extra Wartezeit weil (wenn?) Bus-Capacity überschritten => TAS-Lock funktioniert, aber schreckliche Performance

Lösung - TATAS Lock

Load Linked / Store Conditional