Data Races

  • Count example
  • Discuss semaphores
    • Locks
  • Second count example

Conditions for a data race:

  • Concurrent execution of two processes / threads.
  • Shared data that both processes access (read or write)
  • At least one process writes

Barriers and data races:

  • Review the barrier code.
  • Figure out how it stops data races.


  • Real work example

Conditions for a deadlock:

  • Circular wait.