A Brief Introduction to Threads and Race Conditions

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].

Get Quality Code: Software Testing Principles, Practices, and Patterns now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.