Basic HTML version of Foils prepared July 6 99

Foil 51 More about synchronization

From Use of Java Language in Computational Science DoD Modernization Users Group Conference Monterey -- June 7 99. by Nancy McCracken, Geoffrey C. Fox


1 Often, one thread is producing some data, while another thread wants to use it.
2 A flag variable is introduce that both threads can check.
3 If the data is not ready (flag is false), the consuming thread can call the method wait ( ), which causes it to be suspended until some other event occurs.
4 When the producing thread has some data, it can set the flag to be true and call the method notify ( ), which causes an event that will "wake up" one of the suspended threads.
5 If the user doesn't get the logic right, there are possibilities for deadlock or other forms of non-progress.

in Table To:


© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Tue Jul 6 1999