Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a good introduction to memory barriers?

I'm looking for a good online introduction to memory barriers and the usual pitfalls in Java code:

  • Using synchronized too often or not often enough
  • When to use volatile and final
  • Double checked locking
  • etc.

I'd be especially interested in code which shows the behavior and/or examples how to solve common problems (like creating a map that several threads can access and where values are added lazily).

like image 308
Aaron Digulla Avatar asked Jan 17 '23 17:01

Aaron Digulla


1 Answers

You might find this article by Martin Thomson very helpful.

like image 200
Jonathan Avatar answered Jan 20 '23 14:01

Jonathan