1 / 68

Atomicity and Structured Concurrency

David Kitchin. Atomicity and Structured Concurrency. The University of Texas at Austin. The Orc programming language Adding transactions to Orc Traceless semantics Atomic choice. Overview. A structured concurrent programming language Based on a simple calculus with four combinators

lainey
Download Presentation

Atomicity and Structured Concurrency

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. David Kitchin Atomicity and Structured Concurrency The University of Texas at Austin

  2. The Orc programming language Adding transactions to Orc Traceless semantics Atomic choice Overview

  3. A structured concurrent programming language Based on a simple calculus with four combinators See for yourself: http://orc.csres.utexas.edu/ What is Orc?

  4. SITES + - * / Ref Channel if Rwait ( , ) [ , , ] Google

  5. PARALLEL F | G SITES + - * / Ref Channel if Rwait ( , ) [ , , ] Google

  6. PARALLEL SEQUENTIAL F >x> G F | G SITES + - * / Ref Channel if Rwait ( , ) [ , , ] Google

  7. PARALLEL SEQUENTIAL F >x> G F | G SITES + - * / Ref Channel if Rwait ( , ) [ , , ] Google PRUNING F <x< G val x = G F

  8. PARALLEL SEQUENTIAL F >x> G F | G SITES + - * / Ref Channel if Rwait ( , ) [ , , ] Google PRUNING OTHERWISE F <x< G F ; G val x = G F

  9. PARALLEL SEQUENTIAL F >x> G F | G SITES + - * / Ref Channel if Rwait ( , ) [ , , ] Google PRUNING OTHERWISE F <x< G F ; G FUNCTIONS val x = G F def f(x) = ...

  10. Two essential differences in Orc: Parallelism is recursive and pervasive Services are shared and external Towards Transactions

  11. ATOMIC atomic F

  12. atomic F executes expression F within a transaction Two important observations: F could use any combinator (including atomic) F could call any site atomic

  13. Sites must cooperate with Orc to maintain atomicity A very challenging mix of resources: TM with nested parallelism Objects with interesting semantics (channels, sets, etc) Web services, etc. I can’t solve all of these problems on my own; I am simply searching for a more uniform API to others’ solutions. Transactional Sites

  14. Some sites are pure, ignoring transactions entirely (+, if, ...) Some sites are nontransactional (fire the missiles!) Some sites are transaction-only (a la Haskell STM) Some sites support only depth 1 (TxOS, etc) Some sites support nesting but not parallel nesting (MySQL) Static analysis may be able to reveal misuses of sites Taxonomy

  15. Increment atomic ( ctr? >y> ctr := y+1 )

  16. Swap def swap(x,y) = atomic ( (x?, y?) >(a,b)> (x := b, y := a) )

  17. Rotation def rotate(x,y,z) = atomic ( swap(x,y) >> swap(y,z) )

  18. The execution of F is transactional if the following two properties hold:

  19. Consider a causal relation ≺ : Event × Event If x ≺ y (“x precedes y”), then any effects of x are seen by y ≺ is a strict partial order (antisymmetric and transitive)

  20. Notation • a ≺ S ≡ ∀s ∈ S :: a ≺ s • S ≺ a ≡ ∀s ∈ S :: s ≺ a

  21. A set of events E is transactional iff,

  22. A set of events E is transactional iff, for all e ∈ E and x ∉ E,

  23. A set of events E is transactional iff, for all e ∈ E and x ∉ E, x ≺ e ⇒ x ≺ E and e ≺ x ⇒ E ≺ x

  24. A set of events E is transactional iff, for all e ∈ E and x ∉ E, Isolation x ≺ e ⇒ x ≺ E Atomicity e ≺ x ⇒ E ≺ x

  25. a b Notation • ≡ a≺b

  26. x e E x≺e

  27. x e E x≺e Isolation ⇒ x≺E

  28. y e e ≺ y E

  29. y e ≺ y E ⇒ e Atomicity E ≺ y

  30. x y E

  31. x y E

  32. x y E

  33. x y E

  34. E

  35. E E’

  36. E E’

  37. atomic ( • z := x • x := z+1 • ) • atomic ( • y := x • x := y+1 • )

  38. z := x y := x x := z+1 x := y+1

  39. z := x y := x x := z+1 x := y+1

  40. z := x y := x x := z+1 x := y+1

  41. y := x x := y+1

  42. z := x y := x x := z+1 x := y+1

  43. z := x y := x x := z+1 x := y+1

  44. z := x x := z+1 y := x x := y+1 CYCLIC CAUSALITY

  45. Atomic Choice

  46. The π-calculus has guarded choice: a?(x).c!(x) + b?(x).c!(x) Can we do this in Orc?

  47. Does this work? val x = a.get() | b.get() c.put(x)

  48. val x = 3 | b.get() c.put(x)

  49. val x = 3 | 4 c.put(x)

More Related