Even-Odd Variants

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


Для получения подробной информации о возможностях оптимизации компилятора обратитесь к нашему Уведомлению об оптимизации.