13- The volatile Keyword
6:33
2 ໄມໂຄຣໂຟນ
2 ບົດ
175 ចម្រៀក
ໄມໂຄຣໂຟນ
ບົດ
-
0:03ບົດ 1: In Java, we have another tool for writing thread -safe code, but without the overhead of synchronization. 301s · Speaker 2
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…
-
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…