| August 28, 2010 8:30 AM PDT | |
This article suggests different ways in which co-ordination can be achieved between two or more threads using even and odd number generation as an example.
In all four ways are described:
1) First being the basic Thread.yield() method.
2) Second being the standard wait() and notify() methods.
3) Third being through the use of semaphores.
4) Fourth being through the use of an advanced two way latch, which is an extention of CountDownLatch, called as CountUpDownLatch
EvenOddVariants.java
CountUpDownLatch.java
In all four ways are described:
1) First being the basic Thread.yield() method.
2) Second being the standard wait() and notify() methods.
3) Third being through the use of semaphores.
4) Fourth being through the use of an advanced two way latch, which is an extention of CountDownLatch, called as CountUpDownLatch
EvenOddVariants.java
CountUpDownLatch.java
For more complete information about compiler optimizations, see our Optimization Notice.
Comments (0) 
Trackbacks (0)
Leave a comment 
To obtain technical support, please go to Software Support.
Author
MOHAMMED_IRFANULLA_S
|
Tags for this Page

