Quantcast
Viewing latest article 4
Browse Latest Browse All 20

Answer by nybon for What is a race condition?

Many answers in this discussion explains what a race condition is. I try to provide an explaination why this term is called race condition in software industry.

Why is it called race condition?

Race condition is not only related with software but also related with hardware too. Actually the term was initially coined by the hardware industry.

According to wikipedia:

The term originates with the idea of two signals racing each other toinfluence the output first.

Race condition in a logic circuit:

Image may be NSFW.
Clik here to view.
enter image description here

Software industry took this term without modification, which makes it a little bit difficult to understand.

You need to do some replacement to map it to the software world:

  • "two signals" ==> "two threads"/"two processes"
  • "influence the output" ==> "influence some shared state"

So race condition in software industry means "two threads"/"two processes" racing each other to "influence some shared state", and the final result of the shared state will depend on some subtle timing difference, which could be caused by some specific thread/process launching order, thread/process scheduling, etc.


Viewing latest article 4
Browse Latest Browse All 20

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>