communicating state transition systems for fine grained
play

Communicating State Transition Systems for Fine-Grained Concurrent - PowerPoint PPT Presentation

Communicating State Transition Systems for Fine-Grained Concurrent Resources Aleksandar Nanevski Ruy Ley-Wild Ilya Sergey Germn Delbianco HOPE 2013 Reasoning about shared-memory concurrency How to model shared-memory


  1. Acquire Transitions Intuition: the lock obtains back ownership over the heap and increments the service counter ( owner )

  2. Acquire Transitions Intuition: the lock obtains back ownership over the heap and increments the service counter ( owner ) owner 7! n 1 ∗ next 7! n 2 ∗ ( a o , t o ) ` ⇣ ( a s , t s ∪ { n 1 } ) emp h true i ⇓ acq h 1 owner 7! n 1 + 1 ∗ next 7! n 2 ∗ ( a o , t o ) ( a s , t s ) ` ⇣ h h false i

  3. Acquire Transitions Intuition: the lock obtains back ownership over the heap and increments the service counter ( owner ) owner 7! n 1 ∗ next 7! n 2 ∗ ( a o , t o ) ` ⇣ ( a s , t s ∪ { n 1 } ) emp h true i ⇓ acq h 1 owner 7! n 1 + 1 ∗ next 7! n 2 ∗ ( a o , t o ) ( a s , t s ) ` ⇣ h h false i

  4. Acquire Transitions Intuition: the lock obtains back ownership over the heap and increments the service counter ( owner ) owner 7! n 1 ∗ next 7! n 2 ∗ ( a o , t o ) ` ⇣ ( a s , t s ∪ { n 1 } ) emp h true i ⇓ acq h 1 owner 7! n 1 + 1 ∗ next 7! n 2 ∗ ( a o , t o ) ( a s , t s ) ` ⇣ h h false i

  5. Release Transitions Intuition: the lock gave up ownership over the heap

  6. Release Transitions Intuition: the lock gave up ownership over the heap owner 7! n 1 ∗ next 7! n 2 ∗ ( a o , t o ) ` ⇣ ( a s , t s ∪ { n 1 } ) h h false i ⇓ rel h 1 owner 7! n 1 ∗ next 7! n 2 ∗ ( a o , t o ) ` ⇣ ( a s , t s ∪ { n 1 } ) emp h true i

  7. Release Transitions Intuition: the lock gave up ownership over the heap owner 7! n 1 ∗ next 7! n 2 ∗ ( a o , t o ) ` ⇣ ( a s , t s ∪ { n 1 } ) h h false i ⇓ rel h 1 owner 7! n 1 ∗ next 7! n 2 ∗ ( a o , t o ) ` ⇣ ( a s , t s ∪ { n 1 } ) emp h true i

  8. Release Transitions Intuition: the lock gave up ownership over the heap owner 7! n 1 ∗ next 7! n 2 ∗ ( a o , t o ) ` ⇣ ( a s , t s ∪ { n 1 } ) h h false i ⇓ rel h 1 owner 7! n 1 ∗ next 7! n 2 ∗ ( a o , t o ) ` ⇣ ( a s , t s ∪ { n 1 } ) emp h true i

  9. Transitions don’t change the other part!

  10. Transitions don’t change the other part! Transitions = Guarantee

  11. Transposing the Concurroid owner 7! n 1 ∗ next 7! n 2 ( a s , t s ) ∗ ( a o , t o ) ` ⇣ h h b i

  12. Transposing the Concurroid owner 7! n 1 ∗ next 7! n 2 ( a o , t o ) ∗ ( a s , t s ) ` ⇣ h h b i

  13. Transposing the Concurroid owner 7! n 1 ∗ next 7! n 2 ( a o , t o ) ∗ ( a s , t s ) ` ⇣ h h b i Transitions of transposed = Rely

  14. Transposing the Concurroid owner 7! n 1 ∗ next 7! n 2 ( a o , t o ) ∗ ( a s , t s ) ` ⇣ h h b i Transitions of transposed = Rely reminiscent to tokens by Turon et al. [POPL’13, ICFP’13]

  15. Composing Concurroids

  16. Intuition: Connect communication channels with right polarity

  17. Intuition: Connect communication channels with right polarity ` ⇣ p ⇣

  18. Intuition: Connect communication channels with right polarity rel acq ` ⇣ p ⇣ rel rel acq rel acq acq • Some channels might be left loose • Same channels might be connected several times • Some channels might be shut down

  19. Entanglement Operators ⋈ , ⋊ , ⋉ , × ... Connect two concurroids by connecting some of their acquire/release transitions.

  20. Entanglement Operators ⋈ , ⋊ , ⋉ , × ... Connect two concurroids by connecting some of their acquire/release transitions. Connected A/R transitions become internal for the entanglement.

  21. Useful Entanglement Operators × - “apart”, doesn’t connect channels, leaves all loose. - connects all channels pair-wise, ⋊ shuts channels of the right operand, leaves left one’s loose

  22. Useful Entanglement Operators × - “apart”, doesn’t connect channels, leaves all loose. - connects all channels pair-wise, ⋊ shuts channels of the right operand, leaves left one’s loose Lemma : U ⋊ (V 1 × V 2 ) = ( U ⋊ V 1 ) ⋊ V 2

  23. Programming with Concurroids

  24. Transitions are not yet commands!

  25. Transitions are not yet commands! They only describe some correct behavior.

  26. Atomic Actions • Defined as subsets of internal transitions • Specify the result • Operational meaning: READ , WRITE , SKIP and various RMW-commands • Synchronize ownership transfer and manipulation with auxiliaries

  27. Recap: TLock Implementation lock = { x := DRAW; while (!TRY(x)) SKIP; } unlock = { INCR_OWN; }

Recommend


More recommend