17.3
Rules about Variables
THREADS AND LOCKS
Most of the rules in the following sections further constrain the order in which
certain actions take place. A rule may state that one action must precede or follow
some other action. Note that this relationship is transitive: if action
A
 must precede
action
B
, and
B
 must precede
C
, then
A
 must precede
C
. The programmer must
remember that these rules are the
only
 constraints on the ordering of actions; if no
rule or combination of rules implies that action
A
 must precede action
B
, then a
Java implementation is free to perform action
B
 before action
A
, or to perform
action
B
 concurrently with action
A
. This freedom can be the key to good perfor 
mance. Conversely, an implementation is not required to take advantage of all the
freedoms given it.
In the rules that follow, the phrasing  
B
 must intervene between
A
 and
C
means that action
B
 must follow action
A
 and precede action
C
.
17.3   Rules about Variables
Let
T
 be a thread and
V
 be a variable. There are certain constraints on the actions
performed by
T
 with respect to
V
:
An
use
 or
assign
 by
T
 of
V
 is permitted only when dictated by execution by
T
of the Java program according to the standard Java execution model. For
example, an occurrence of
V
 as an operand of the
+
 operator requires that a
single
use
 action occur on
V
; an occurrence of
V
 as the left hand operand of
the assignment operator
=
 requires that a single
assign
 action occur. All
use
and
assign
 actions by a given thread must occur in the order specified by the
program being executed by the thread. If the following rules forbid
T
 to per 
form a required
use
 as its next action, it may be necessary for
T
 to perform a
load
first in order to make progress.
A
store
 action by
T
 on
V
 must intervene between an
assign
 by
T
 of
V
 and a
subsequent
load
 by
T
 of
V
. (Less formally: a thread is not permitted to lose its
most recent assign.)
An
assign
 action by
T
 on
V
 must intervene between a
load
 or
store
 by
T
 of
V
and a subsequent
store
 by
T
 of
V
. (Less formally: a thread is not permitted to
write data from its working memory back to main memory for no reason.)
After a thread is created, it must perform an
assign
 or
load
 action on a vari 
able before performing a
use
 or
store
 action on that variable. (Less formally: a
new thread starts with an empty working memory.)
404






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

java hosting

 

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