---
spec: JLS
title: "The Java Language Specification"
edition: "Java SE 15 Edition"
java_version: 15
chapter: "Chapter 17. Threads and Locks"
section: "17.4.7"
heading: "17.4.7. Well-Formed Executions"
parent: "17.4. Memory Model"
source: https://docs.oracle.com/javase/specs/jls/se15/html/jls-17.html#jls-17.4.7
id: "17.4.7"
url: https://jvm.obfuscated.software/jls/se15/17.4.7.html
raw: https://jvm.obfuscated.software/jls/se15/17.4.7.md
---

# 17.4.7. Well-Formed Executions

We only consider well-formed executions. An execution *E* = < *P, A, po, so, W, V, sw, hb* > is well formed if the following are true:

1. Each read sees a write to the same variable in the execution.

   All reads and writes of volatile variables are volatile actions. For all reads *r* in *A*, we have *W(r)* in *A* and *W(r).v* = *r.v*. The variable *r.v* is volatile if and only if *r* is a volatile read, and the variable *w.v* is volatile if and only if *w* is a volatile write.

2. The happens-before order is a partial order.

   The happens-before order is given by the transitive closure of synchronizes-with edges and program order. It must be a valid partial order: reflexive, transitive and antisymmetric.

3. The execution obeys intra-thread consistency.

   For each thread *t*, the actions performed by *t* in *A* are the same as would be generated by that thread in program-order in isolation, with each write *w* writing the value *V(w)*, given that each read *r* sees the value *V(W(r))*. Values seen by each read are determined by the memory model. The program order given must reflect the program order in which the actions would be performed according to the intra-thread semantics of *P*.

4. The execution is *happens-before consistent* ([§17.4.6](17.4.6.md)).

5. The execution obeys synchronization-order consistency.

   For all volatile reads *r* in *A*, it is not the case that either *so(r, W(r))* or that there exists a write *w* in *A* such that *w.v* = *r.v* and *so(W(r), w)* and *so(w, r)*.
