90 Introduction to Concurrency in Programming Languages
Trivial as it may seem to start with expressions, even this most fundamen-
tal of language abstractions has consequences in the context of concurrent
programming. Expressions are not necessarily atomic. In the example above,
we see that the single expression is actually implemented as a sequence of
simpler subexpressions that are generated by the compiler. Clearly if atomic-
ity of an expression is important, then we must take care to protect complex
expressions just as carefully as we would a large critical region. If one writes
an expression such as
x = a[1] + (a[0] * (b[1] / a[1]))
which is ultimately compiled to a sequence of operations, what happens if the
subexpression for b[1] / a[1] executes, ...