user19551894
user19551894

Reputation:

parallelism and accessing memory locations

http://eel.is/c++draft/basic#intro.races-2

Two expression evaluations conflict if one of them modifies a memory location ([intro.memory]) and the other one reads or modifies the same memory location.

Does the conflict mentioned in the quote refer to when it occurs literally at the same time (parallel) or when it occurs concurrently (i.e., because of the context switching) or both cases?

I can only see it as a problem when it happens literally at the same time.

Upvotes: 0

Views: 62

Answers (1)

Nicol Bolas
Nicol Bolas

Reputation: 473272

As far as the definition of "conflict" is concerned, the standard does not care one way or another. Technically, ++i; ++i; are "conflicting" expression evaluations, as they both modify the same memory location.

The definition of "data race" only cares about particular kinds of conflicting actions. Specifically, "potentially concurrent conflicting actions."

Upvotes: 1

Related Questions