...
Wiki Markup |
---|
*data race* : "When a program contains two conflicting accesses (§17.4.1) that are not ordered by a happens-before relationship, it is said to contain a data race." \[[JLS 05|AA. Java References#JLS 05]\]. "A data race occurs in an execution of a program if there are conflicting actions in that execution that are not ordered by synchronization." \[[JSR-133 04|AA. Java References#JSR-133 04]\]. "
"Data races cause nonatomic execution of critical sections and are failures in (nondeterministic) programs that access and update shared data in critical sections." \[[Netzer 92|AA. Java References#Netzer 92]\]. |
Anchor |
---|
| happens-before order |
---|
| happens-before order |
---|
|
Wiki Markup |
---|
*happens-before order* : "Two actions can be ordered by a happens-before relationship. If one action happens-before another, then the first is visible to and ordered before the second |
Anchor |
---|
happens-before order | happens-before order | Wiki Markup |
---|
*happens-before order* : "Two actions can be ordered by a happens-before relationship. If one action happens-before another, then the first is visible to and ordered before the second. \[...\] It should be noted that the presence of a happens-before relationship between two actions does not necessarily imply that they have to take place in that order in an implementation. If the reordering produces results consistent with a legal execution, it is not illegal. \[...\] It should Morebe specifically,noted ifthat twothe actionspresence shareof a happens-before relationship, they do between two actions does not necessarily imply havethat tothey appearhave to havetake happenedplace in that order to any code with which they do not share a happens-before relationship. Writes in one thread that are in a data race with reads in another thread may, for example, appear to occur out of order to those reads." \[[JLS 05|AA. Java References#JLS 05]\]. |
Anchor |
---|
heap memory | heap memory | Wiki Markup |
---|
*heap memory* : "Memory that can be shared between threads is called shared memory or heap memory. All instance fields, static fields and array elements are stored in heap memory.\[...\] Local variables (§14.4), formal method parameters (§8.4.1) or exception handler parameters are never shared between threads and are unaffected by the memory model." \[[JLS 05|AA. Java References#JLS 05]\]. |
...
in an implementation. If the reordering produces results consistent with a legal execution, it is not illegal. \[...\] More specifically, if two actions share a happens-before relationship, they do not necessarily have to appear to have happened in that order to any code with which they do not share a happens-before relationship. Writes in one thread that are in a data race with reads in another thread may, for example, appear to occur out of order to those reads." \[[JLS 05|AA. Java References#JLS 05]\]. |
Wiki Markup |
---|
*heap memory* : "Memory that can be shared between threads is called shared memory or heap memory. All instance fields, static fields and array elements are stored in heap memory.\[...\] Local variables (§14.4), formal method parameters (§8.4.1) or exception handler parameters are never shared between threads and are unaffected by the memory model." \[[JLS 05|AA. Java References#JLS 05]\]. |
immutable : When applied to an object, this means that its state cannot be changed after being initialized. "An object is immutable if:
- Its state cannot be modified after construction;
Wiki Markup |
---|
All its fields are final;\[12\] and |
- It is properly constructed (the
this
reference does not escape during construction).
Wiki Markup |
---|
\[12\] It is technically possible to have an immutable object without all fields being {{final}}. {{String}} is such a class but this relies on delicate reasoning about benign data races that requires a deep understanding of the Java Memory Model. (For the curious: {{String}} lazily computes the hash code the first time {{hashCode}} is called and caches it in a nonfinal field, but this works only because that field can take on only one nondefault value that is the same every time it is computed because it is derived deterministically from immutable state." \[[Goetz 06|AA. Java References#Goetz 06]\]. |
Immutable objects are inherently thread-
...
immutable : When applied to an object, this means that its state cannot be changed after being initialized. "An object is immutable if:
- Its state cannot be modified after construction;
Wiki Markup |
---|
All its fields are final;\[12\] and |
- It is properly constructed (the
this
reference does not escape during construction).
Wiki Markup |
---|
\[12\] It is technically possible to have an immutable object without all fields being {{final}}. {{String}} is such a class but this relies on delicate reasoning about benign data races that requires a deep understanding of the Java Memory Model. (For the curious: {{String}} lazily computes the hash code the first time {{hashCode}} is called and caches it in a nonfinal field, but this works only because that field can take on only one nondefault value that is the same every time it is computed because it is derived deterministically from immutable state." \[[Goetz 06|AA. Java References#Goetz 06]\]. |
Immutable objects are inherently thread-safe; they may be shared between multiple threads or published without synchronization, though it is usually required to declare the fields containing their references volatile
to ensure visibility. An immutable object may contain mutable sub-objects, provided the state of the sub-objects cannot be modified after construction of the immutable object has concluded.
...
Wiki Markup |
---|
*partial order* : An order defined for some, but not necessarily all, pairs of items. For instance, the sets \{a, b\} and \{a, c, d\} are subsets of \{a, b, c, d\}, d\}, but neither is a subset of the other. So "subset of" is a partial order on sets. \[[Black 04|AA. Java References#Black 04]\] |
Anchor |
---|
program order | program order | program order is the order that inter-thread actions are performed by a thread according to the intra-thread semantics of the thread.
but neither is a subset of the other. So "subset of" is a partial order on sets. \[[Black 04|AA. Java References#Black 04]\] |
Anchor |
---|
| program order |
---|
| program order |
---|
|
program order is the order that inter-thread actions are performed by a thread according to the intra-thread semantics of the thread.
Anchor |
---|
| publishing objects |
---|
| publishing objects |
---|
|
Wiki Markup |
---|
*publishing objects* : "Publishing an object means making it available to code outside of its current scope, such as by storing a reference to it where other code can find it, returning it from a nonprivate method, or passing it to a method in another class." \[[Goetz 06|AA. Java References#Goetz 06]\]. |
Anchor |
---|
| race condition |
---|
| race condition |
---|
|
Wiki Markup |
---|
*race condition:* "General races cause nondeterministic execution and are failures in programs intended to be deterministic." \[[Netzer 92|AA. Java References#Netzer 92 |
Anchor |
---|
publishing objects | publishing objects | Wiki Markup |
---|
*publishing objects* : "Publishing an object means making it available to code outside of its current scope, such as by storing a reference to it where other code can find it, returning it from a nonprivate method, or passing it to a method in another class." \[[Goetz 06|AA. Java References#Goetz 06]\]. |
Anchor |
---|
| relativization (URI) |
---|
| relativization (URI) |
---|
|
...