aspose file tools
The moose likes Threads and Synchronization and the fly likes Advatages of volatile variables Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Reply Bookmark "Advatages of volatile variables " Watch "Advatages of volatile variables " New topic
Author

Advatages of volatile variables

ragi singh
Ranch Hand

Joined: Mar 10, 2010
Posts: 198

Hi ,
can anyone explain the advantages of using volatile variable
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

When using multiple processors, the value of a variable may be altered but not visible to other cores that may require the same variable.
Marking a variable as volatile allows the compiler and runtime to prevent optimisations and improve the variable visibility so that errors are not introduced at runtime caused by this.
Note that the restrictions caused by the volatile keyword can reduce the performance of the application when utilising this variable so some care should be taken.
siddhu Math
Ranch Hand

Joined: Aug 10, 2006
Posts: 46
hi,

Hope the link should help you , has quite a lot of information on volatile....volatile....

 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Advatages of volatile variables
 
Similar Threads
volatile keyword
volatile and transient Details
another thread question
volatile
Volatile