mczarnek
mczarnek

Reputation: 1383

Are there different types of race conditions?

I know there are data races, can other race conditions be broken down into distinct categories?

Ultimately all race conditions are due to data being accessed in the wrong order, therefore leading threads to misbehave, but data races are a very specific case where data is read, changed, and written all at once, correct?

What else can cause a race condition?

Upvotes: 0

Views: 682

Answers (1)

pveentjer
pveentjer

Reputation: 11307

Threading problems can be categorized like this:

Correctness (nothing bad happens)

  • race condition

Liveness (something good happens eventually)

  • deadlock
  • starvation
  • livelock

I do not know of a further categorization of race conditions.

A data race is a more lower level problem and happens if you have conflicting memory accesses (so at least one of them is a write) on the same memory location and these are not ordered by a happens before relation. Data races are part of memory models like the Java Memory Model and that of C++ 11. A race condition and a data race are different types of problems.

Upvotes: 2

Related Questions