~/talk

Thread Safety with Phaser, StampedLock and VarHandle

Talkat GeeCON 2019 · 2019-05-15..05-17· [java]
slides:none on file

Compares Phaser, StampedLock and VarHandle with code and microbenchmarks: starting threads via volatile spin, wait/notify, CountDownLatch and phaser arrive and awaitAdvance finds Phaser gives sub-10µs max skew and far lower total delay than others. Shows StampedLock optimistic reads with StampedLock.tryOptimisticRead plus validate and fallback to readLock to preserve invariants. Replaces locks with VarHandle-backed CAS on a double[] (using VarHandle compareAndSet), yielding ~88M move ops and ~55M distance ops, beating stamped locks and synchronized in these tests.

AI-written summary · about

  1. 0:00Start
  2. 11:41Countdown Latch
  3. 18:15Stamped Lock
  4. 20:00Stamp Lock
  5. 24:45Validate the Stamp
  6. 37:56Var Handles
  7. 45:03Here's Not the Reason Why Matthews in Jaya Match for this Is Jh Will Need a Long Warm Up So Contrary To Do that as a Demo Here I Can Only Show You the Results Not So Much Fun like like Seeing the Answers Here So I'M Going To Just Copy and Paste these Values in Here so We We Have those and Then We'Re Going To Refactor this To Use Var Handles Now Let's Get Rid of this Temp Lock and We Get To Do this all with Four Handles
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.