All other answers focused on actually testing the code, placing it in its ranks and actually launching it in one form or another or politely saying: “Do not do it yourself, use the existing library.”
That's great and all, but the IMO, the most important (practice tests are also important) test - is to look at the code on the line and for each line of code to ask, "what would happen if I was here interrupted by another thread Imagine another thread that performs almost any? another line / function during this interrupt, is something still consistent? When competing for resources, does another thread [s] block or rotate?
This is what we did at school in studying concurrency, and it is a surprisingly effective approach. In the end, I believe that the time to prove to yourself that everything is coordinated and works as expected in all states is the first method that you should use when working with this material.
source
share