Skip to content

Instantly share code, notes, and snippets.

@anushshukla
Created October 18, 2021 14:28
Show Gist options
  • Select an option

  • Save anushshukla/e9d3af02d64fd4bcad164a1fe2d8a221 to your computer and use it in GitHub Desktop.

Select an option

Save anushshukla/e9d3af02d64fd4bcad164a1fe2d8a221 to your computer and use it in GitHub Desktop.
Race Condition Problem Statement with Solution

Q: What is a race condition?

A: This is the condition which arises when there is race between multiple requests from client to server try to modify or fetch the same resource in the same time of execution

Q: When does race condition arise?

A: When a system is multi-threaded or/and multi-process to handle concurrency or/and parallelism for performance optimisation.

Q: How can race conditions be avoided?

A: By introducing locks or inter-threads / intra-process synchronisation race conditions be avoided as they would sequential handle requests which are trying to modify the same resource

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment