Is it a data-race when several thread *read* the same memory at the same time?

986 views Asked by At

cppreference.com says:

Threads and data races

When an evaluation of an expression modifies to a memory location and another evaluation reads or modifies the same memory location, the expressions are said to conflict. A program that has two conflicting evaluations has a data race unless...

This speaks about the scenario of 'thread1-modify thread2-read' (M-R) and about the scenario of 'thread1-modify thread2-modify' (M-M).

What about 'thread1-read thread2-read' (R-R)?

1

There are 1 answers

0
eerorika On BEST ANSWER

No. Multiple threads reading memory sequenced is not a data race as long as no thread is writing unsequenced in that memory location.

That scenario was probably left out of that description of data races, because that scenario is not a data race.