Atomicity An action is atomic if it happens all at once from the point of view of other threads That is, the action either has happened or it hasn't; it's not in the middle of happening Few actions are actually atomic For example, x++ consists of three parts: get the value of x, add 1 to the value, put the new value back in x If another thread access x during the operation, the results are unpredictable If a spacecraft moves from point (x, y, z) to point (x , y , z ), these values must be updated simultaneously The spacecraft is never at point (x , y, z) In Java, the approach is to lock the variables being updated, thus denying access to other threads It is extremely difficult, with this model, to write correct programs Efficiency isn't all that easy, either
{}