13- The volatile Keyword

6:33 2 Звуци 2 Поглавја 175 сегменти

Поглавја

  1. 0:03

    In Java, we have another tool for writing thread -safe code, but without the overhead of synchronization. It's the volatile keyword. It solves the visibility problem, but not the race condition. So it doesn't prevent two threads simultaneou…

  2. 5:05

    Now, we have two threads running by two different CPU cores. Each CPU has a cache, which is a small amount of memory available locally in that CPU. Reading the data from the cache is faster because the data is closer to the CPU. So it doesn…