There are given 3 threads that have to be synchronized , with the sole purpose of creating H2O molecules.
- Thread-1: produces a Hydrogen atom
- Thread-2: produces an Oxygen atom
- Thread-3: produces a Water Molecule
We have to synchronize these 3 threads and when 100 molecules of water are formed, the program can exit.