Code examples from the chapter about concurrency problems.
Type make
to build all examples.
atomicity.c
: Shows how uncareful check-then-use can crash codeatomicity_fixed.c
: Shows how to fix the problem with a lock
ordering.c
: Shows the ordering problem from the book chapterordering_fixed.c
: Shows how to fix the problem with a condition variable
deadlock.c
: Shows simple two-cycle deadlockdeadlock_run.sh
: Script to run the above program many times, until you hit a deadlock and are convinced deadlock can occur