Does a correctly synchronized program still allow data race?(Part I)

后端 未结 3 549
栀梦
栀梦 2020-12-10 17:54

There are two conclusions from JLS:

  • C1: If a program is free of data races, then all executions of the program will appear to be sequentially consistent:
3条回答
  •  醉酒成梦
    2020-12-10 18:26

    http://rsim.cs.illinois.edu/Pubs/popl05.pdf

    The proof seems to go this way:

    Suppose an execution of a correctly synchronized program contains data race, we can find a sequential execution that contains data race, violating the definition of "correctly synchronized program" [C1]

    Therefore the execution must not contain data race. [C3] From there, the execution can be proven to be sequentially consistent. [C2]

    So C3 is true, and it is used to prove C2.

提交回复
热议问题