Atomicity(原子性)

Operations A and B are atomic with respect to each other if, from the perspective of a thread executing A, when another thread executes B, either all of B has executed or none of it has. An atomic operation is one that is atomic with respect to all operations, including itself, that operate on the same state.

什么是原子性?简单来讲就是两个线程同时对一个状态做操作。当线程A对这个状态进行操作时,线程B对于A的操作要么尚未开始,要么已经结束。这样就保证了这个状态的原子性,
同时也可以说线程A与线程B对这个状态的操作是原子性的。


摘自<Java Concurrency In Practise> 2.2. Atomicity





你可能感兴趣的:(java,thread,atomic)