Friday, June 25, 2004

Atomicity

Concurrent Programming in Java (Doug Lea) is really a gem of a book - its been a good few years since I last picked it up.

Atomicity (page 93) is a worth while read - access and updates to the memory cells corresponding to fields of any type except long or double are guaranteed to be atomic. volatile long and volatile double are also atomic.

volatile (page 97) could possible be cheaper than synchronization, or at least no more expensive.

synchronized has a double meaning: it locks permitting higher-level synchronization protocols, plus deals with the memory system (sometimes via memory barriers) to values in sync across threads.

0 Comments:

Post a Comment

<< Home