3.3. Classic Synchronization ProblemsΒΆ

Some synchronization problems, such as the Shared Buffer Problem are fairly simple to solve using reliable synchronization facilities such as Dijkstra’s Semaphore. Other problems that programmers must solve are more complex, in fact, some of them are just down right tricky to solve correctly such that there is never a problem with Starvation, Deadlock or Data Inconsistency. Fortunately, there are a lot of really smart people who have already tackled these problems and we have known solutions to them. These problems are ones that frequently arise, so we discuss them and their solutions in fairly generic terms and refer to them as the Classic Synchronization Problems. One of the biggest challenges that the programmer must solve is to correctly identify their problem as an instance of one of the classic problems. It may require thinking about the problem or framing it in a less than obvious way, so that a known solution may be used. The advantage to using a using known solution is assurance that it is correct. Some instances of deadlock, can occur only in rare conditions and are difficult to detect. So for any programming task using synchronization, it is best to reference a known solution to one of the classic problems.