Atomic

What Does Atomic Mean?

Atomic is a toolkit of variable java.util.concurrent.atomic package classes, which assist in writing lock and wait-free algorithms with the Java language. An algorithm requiring only partial threads for constant progress is lock-free. In a wait-free algorithm, all threads make progress continuously, even in cases of thread failure or delay. Lock and wait-free algorithms are also known as nonblocking algorithms. Nonblocking algorithms are used for process and thread scheduling at the operating system and Java virtual machine levels.

Advertisements

Techopedia Explains Atomic

All java.util.concurrent.atomic package classes have the “atomic” prefix in their names. There are different types of atomic variables available in the java.util.concurrent.atomic package, including:

  • AtomicBoolean
  • AtomicInteger
  • AtomicIntegerArray
  • AtomicIntegerFieldUpdater
  • AtomicLong
  • AtomicLongArray
  • AtomicLongFieldUpdater
  • AtomicReference

In the Java language, synchronization coordinates access to shared thread fields and only allows threads holding locks to access and modify variables protected by the lock. This thread’s modifications are visible to the thread that follows, but only after the thread releases the lock.
An example is a scenario where thread A holds a lock. A is only able to access and make changes to variables protected by this lock. If thread B holds this lock after A, then only B can view A’s changes on the variables protected by that particular lock. The main problem with locking occurs when B attempts to acquire a lock held by A. In this case, B is blocked to wait until the lock is available. Nonblocking algorithms resolve this problem.

The main purpose behind building atomic classes is to implement nonblocking data structures and their related infrastructure classes. Atomic classes do not serve as replacements for java.lang.Integer and related classes. Most java.util.concurrent package classes use atomic variables instead of synchronization, either directly or indirectly. Atomic variables also are used to achieve higher throughput, which means higher application server performance.

Advertisements

Related Terms

Latest Database Terms

Related Reading

Margaret Rouse

Margaret Rouse is an award-winning technical writer and teacher known for her ability to explain complex technical subjects to a non-technical, business audience. Over the past twenty years her explanations have appeared on TechTarget websites and she's been cited as an authority in articles by the New York Times, Time Magazine, USA Today, ZDNet, PC Magazine and Discovery Magazine.Margaret's idea of a fun day is helping IT and business professionals learn to speak each other’s highly specialized languages. If you have a suggestion for a new definition or how to improve a technical explanation, please email Margaret or contact her…