Top "Volatile" questions

Volatile is a qualifier used to define a data storage area (object, field, variable, parameter) that "can change on its own", thus disallowing some code generator optimizations.

Is volatile expensive?

After reading The JSR-133 Cookbook for Compiler Writers about the implementation of volatile, especially section "Interactions with Atomic Instructions" I …

java memory-management concurrency volatile
c# - Volatile keyword usage vs lock

I've used volatile where I'm not sure it is necessary. I was pretty sure a lock would be overkill in …

c# multithreading performance dispatcher volatile
why using volatile with synchronized block?

I saw some examples in java where they do synchronization on a block of code to change some variable while …

java multithreading volatile synchronized double-checked-locking
AtomicInteger and volatile

I know volatile allows for visibility, AtomicInteger allows for atomicity. So if I use a volatile AtomicInteger, does it mean …

java multithreading thread-safety atomic volatile
Volatile or synchronized for primitive type?

In Java, assignment is atomic if the size of the variable is less than or equal to 32 bits but is …

java multithreading atomic volatile synchronized
Is volatile bool for thread control considered wrong?

As a result of my answer to this question, I started reading about the keyword volatile and what the consensus …

c++ multithreading multicore volatile
How does "Compare And Set" in AtomicInteger works

AtomicInteger works with two concepts : CAS and volatile variable. Using volatile variable insures that the current value will be visible …

java multithreading concurrency volatile
Is there any point in using a volatile long?

I occasionally use a volatile instance variable in cases where I have two threads reading from / writing to it and …

java multithreading concurrency volatile
Volatile variable in Java

So I am reading this book titled Java Concurrency in Practice and I am stuck on this one explanation which …

java multithreading concurrency volatile
What does—or did—"volatile void function( ... )" do?

I've seen How many usage does "volatile" keyword have in C++ function, from grammar perspective? about use of the volatile …

c function aes volatile void