Java Thread Synchronization

During week 4 of my class in Operating Systems, I learned about thread synchronization. Since this whole class is based in Java, we've been implementing all of the OS ideas in Java.

I've taken a Java class before where we dealt with threads but it was quite a while ago. We used things like and Thread.sleep(). I've now learned that both of those are quite outdated ways to deal with threads.

Anyway, I learned about CyclicBarriers [] and CountDownLatches [] . A CyclicBarrier works in a similar manner to a CountDownLatch except that a CyclicBarrier can be reset and waited on several times. In practice, I couldn't get my threads to synchronize after resetting the CyclicBarrier so I had to use both the CountDownLatch and CyclicBarrier.