Grokking Java Interview Questions
Vote

0% completed

​

Find the Bug: Concurrency

A concurrency bug can be present in code that gives the correct result in every test. The failure often needs one particular order of steps, and a test on an idle computer may never produce that order. Such a bug is found more reliably by reading the code with a fixed method. Mark the data that several threads share, and then ask after each step what another thread could do before the next one.

Each of the five programs below has one concurrency bug. Read the code, write down the steps that lead to the failure, and then open the answer. The repaired program after each answer can be run.

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content