Before we dive into how to test parallel code, let’s take a brief tour through the history of parallel programming1 and the anatomy of a race condition.
1. Consider this section a condensed and idealized history. Like most advances in knowledge and practice, the reality is not as linear or logical as presented here. For more detail on threads, Java concurrency libraries, principles of atomicity and immutability, and more, I highly recommend Java Concurrency in Practice [JCIP].