THREADS AND LOCKS
Execution Order
17.2
Thus the interaction of a thread with a variable over time consists of a
sequence of
use
,
assign
,
load
, and
store
actions. Main memory performs a
read
action for every
load
and a
write
action for every
store
. A thread's interactions
with a lock over time consists of a sequence of
lock
and
unlock
actions. All the
globally visible behavior of a thread thus comprises all the thread's actions on
variables and locks.
17.2 Execution Order
The rules of execution order constrain the order in which certain events may
occur. There are four general constraints on the relationships among actions:
The actions performed by any one thread are totally ordered; that is, for any
two actions performed by a thread, one action precedes the other.
The actions performed by the main memory for any one variable are totally
ordered; that is, for any two actions performed by the main memory on the
same variable, one action precedes the other.
The actions performed by the main memory for any one lock are totally
ordered; that is, for any two actions performed by the main memory on the
same lock, one action precedes the other.
It is not permitted for an action to follow itself.
The last rule may seem trivial, but it does need to be stated separately and explic
itly for completeness. Without it, it would be possible to propose a set of actions
by two or more threads and precedence relationships among the actions that
would satisfy all the other rules but would require an action to follow itself.
Threads do not interact directly; they communicate only through the shared
main memory. The relationships between the actions of a thread and the actions of
main memory are constrained in three ways:
Each
lock
or
unlock
action is performed jointly by some thread and the main
memory.
Each
load
action by a thread is uniquely paired with a
read
action by the main
memory such that the
load
action follows the
read
action.
Each
store
action by a thread is uniquely paired with a
write
action by the
main memory such that the
write
action follows the
store
action.
403
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved