Skip to content

Instantly share code, notes, and snippets.

@nbhusare
Last active November 19, 2019 07:00
Show Gist options
  • Save nbhusare/58dac744fd9c873675e7f0c0dcbb8d7d to your computer and use it in GitHub Desktop.
Save nbhusare/58dac744fd9c873675e7f0c0dcbb8d7d to your computer and use it in GitHub Desktop.
Data Race Vs Race condition
Data race: It occurs when synchronization is not used to coordinate access to the shared state. You risk data race whenever you write to a shared variable that might next be read by another thread, or read a variable that might have last been written by another thread, if both threads do not use synchronization
Race condition: It occurs when the correctness of a computation depends on the relative timing of interlaving of multiple threads by the runtime; in other words, when getting the right answer relies on the lucky timing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment