Volatile Variable

Definition - What does Volatile Variable mean?

A volatile variable is a variable that is marked or cast with the keyword "volatile" so that it is established that the variable can be changed by some outside factor, such as the operating system or other software. A volatile variable is useful in multithreaded applications or in other situations where programmers must anticipate changes to the variable other than those that are common within the code module.

Techopedia explains Volatile Variable

The volatile variable is useful in different programming languages, including parts of the "C suite" (C++, C, and C#) and in Java, a common programming language for the Web. The exact use of a volatile keyword or variable changes with regard to a particular programming language syntax, but generally, variables can be created as volatile, or conditionally declared volatile within code.

One popular use of the volatile keyword for a variable is in writing code to end a loop or terminate a thread. A programmer can write a simple function that will take in the volatile variable value and end the loop based on a given value. The volatile keyword ensures that the program gets a current value for a Boolean or other variable, instead of an obsolete one.
Share this:

Connect with us

Email Newsletter

Join thousands of others with our weekly newsletter

The 4th Era of IT Infrastructure: Superconverged Systems
The 4th Era of IT Infrastructure: Superconverged Systems:
Learn the benefits and limitations of the 3 generations of IT infrastructure – siloed, converged and hyperconverged – and discover how the 4th...
Approaches and Benefits of Network Virtualization
Approaches and Benefits of Network Virtualization:
Businesses today aspire to achieve a software-defined datacenter (SDDC) to enhance business agility and reduce operational complexity. However, the...
Free E-Book: Public Cloud Guide
Free E-Book: Public Cloud Guide:
This white paper is for leaders of Operations, Engineering, or Infrastructure teams who are creating or executing an IT roadmap.
Free Tool: Virtual Health Monitor
Free Tool: Virtual Health Monitor:
Virtual Health Monitor is a free virtualization monitoring and reporting tool for VMware, Hyper-V, RHEV, and XenServer environments.
Free 30 Day Trial – Turbonomic
Free 30 Day Trial – Turbonomic:
Turbonomic delivers an autonomic platform where virtual and cloud environments self-manage in real-time to assure application performance.