17.10
Example: Possible Swap
THREADS AND LOCKS
The total set of actions may be pictured as follows:
hither
 thread
main memory
yon
 thread
lock
 class
SynchSample
lock
 class
SynchSample
read
b
read
a
load
b
load
a
use
b
use
a
assign
a
assign
b
store
a
store
b
write
a
write
b
unlock
 class
SynchSample
unlock
 class
SynchSample
The
lock
 and
unlock
 actions provide further constraints on the order of actions
by the main memory; the
lock
 action by one thread cannot occur between the
lock
and
unlock
 actions of the other thread. Moreover, the
unlock
 actions require that
the
store
 and
write
 actions occur. It follows that only two sequences are possible:
write
a
read
a
,
read
b
write
b
 (then
ha=2
,
hb=2
,
ma=2
,
mb=2
,
ya=2
,
yb=2
)
read
a
write
a
,
write
b
read
b
 (then
ha=1
,
hb=1
,
ma=1
,
mb=1
,
ya=1
,
yb=1
)
While the resulting state is timing dependent, it can be seen that the two threads
will necessarily agree on the values of
a
 and
b
.
412






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