Skip to content

Instantly share code, notes, and snippets.

@nojima
Last active August 29, 2015 13:56
Show Gist options
  • Save nojima/9166434 to your computer and use it in GitHub Desktop.
Save nojima/9166434 to your computer and use it in GitHub Desktop.

C++メモリモデル

1.10 Multi-thread executions and data aces

  • Thread of execution (or thread) は flow of control のひとつ.
    • 特定のトップレベル関数の呼び出しを含む.
    • そのスレッドが呼び出す関数をすべて含む.
    • どのスレッドも潜在的にはプログラム内のすべてのオブジェクトと関数にアクセスする可能性がある.
    • C++プログラムは複数のスレッドを並列に実行できる.
  • 処理系はすべての unblocked なスレッドが eventually make progress することを保証すべき.
  • ある時点においてスレッド T に対して visible なオブジェクトの値は以下のいずれか:
    • そのオブジェクトの初期値
    • T によってそのオブジェクトに代入された値
    • T 以外のスレッドによってそのオブジェクトに代入された値
  • 2つの expression evaluation が以下の条件を満たすとき conflict しているという.
    • 一方がある memory location を modify しており,かつ
    • 他方が同じ memory location に access または modify している.
  • ライブラリは atomic operations と operations on mutexes を定義する.
    • memory locations 上での synchronization operation は以下のいずれか:
      • consume operation
      • acquire operation
      • release operation
      • both an acquire and release operation
    • synchronization operation でない relaxed atomic operation というものもある.
    • memory location に関連付いていない synchronized operation は fence であり,以下のいずれか:
      • acquire fence
      • release fence
      • both an acquire and release fence
  • ある atomic object M に対する全ての modification は、ある全順序で起こる。その全順序を M の modification order と呼ぶ。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment