Race conditions: a case study

Since detecting race conditions in a multithreaded or multiprocess program is an NP-complete problem, there is no efficient algorithm that can help detect race conditions in a program. As such, there are no easy-to-use pedagogical tools. Most operating systems and concurrent programming textbooks only provide a formal definition and some trivial examples. This is insufficient for students to learn how to detect race conditions. This paper attempts to fill this gap by presenting a set of well-organized examples, each of which contains one or more race conditions, for instructors to use in the classroom. This set of materials has been classroom tested for two years and the student's reaction has been very positive.