False Sharing in Java

Publicado em: 25 July 2021
no canal de: Jakob Jenkov
17,441
633

False sharing in Java occurs when two threads running on two different CPUs write to two different variables which happen to be stored within the same CPU cache line. When the first thread modifies one of the variables - the whole CPU cache line is invalidated in the CPU caches of the other CPU where the other thread is running. This means, that the other CPUs need to reload the content of the invalidated cache line - even if they don't really need the variable that was modified within that cache line.

This false sharing tutorial explains how false sharing can occur in Java code, as we well as what you can do to avoid false sharing in your Java apps - e.g. by using the @Contended Java annotation.

Chapters:

0:00 False sharing introduction
5:45 False sharing code examples
11:23 @Contended Built-in Java Annotation

False sharing in Java - text:
https://jenkov.com/tutorials/java-con...

Java Concurrency Tutorials - text:
https://jenkov.com/tutorials/java-con...

Java Concurrency video playlist:
   • Java Concurrency and Multithreading  


Nesta página do site você pode assistir ao vídeo on-line False Sharing in Java duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Jakob Jenkov 25 July 2021, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 17,441 vezes e gostou 633 espectadores. Boa visualização!