Upcoming SlideShare
×

# Csr2011 june17 12_00_morin

314 views

Published on

• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

### Csr2011 june17 12_00_morin

1. 1. Shared-Memory Systems and Charts Remi MORIN ´ Universite de la M´diterran´e ´ e e Laboratoire d’Informatique Fondamentale de MarseilleCSR 2011 June 2011
2. 2. Peterson’s mutual exclusion protocolProcess 1 Process 2 repeat: repeat: f[1] ← true; f[2] ← true; Turn ← 2; Turn ← 1; wait (f[2] = false wait (f[1] = false or Turn = 1); or Turn = 2); Critical Section(1); Critical Section(2); f[1] ← false; f[2] ← false; 1
3. 3. Executions as partial orders (pomsets) Process 1 Process 2 f[1]←true f[2]←true Turn←1 Turn←2 Turn=2Time C.S.(2) f[2]←false f[2]=false C.S.(1) 2
4. 4. Foreword Model and semantics Expressive power MSO logic Speciﬁcations with automata Checking SMC speciﬁcations 2
5. 5. A simple model for shared-memory systemsLet Σ be a ﬁxed alphabet.A shared-memory system consists of • a set of registers R, a set of data D, • a set of processes P • for each action a ∈ Σ: a non-empty subset Loc(a) ⊆ P • an initial conﬁguration ı ∈ Q • some ﬁnal conﬁgurations F ⊆ Q. • and for each action a ∈ Σ: a set of rules ∆a • A conﬁguration is a mapping q : R → D • A rule is a triple ρ = (ν, a, ν′ ) where ν, ν′ : R ⇀ D Guard Update 3
6. 6. Sequential operational semanticsFor any two states q, q′ ∈ Q and any rule ρ = (ν, a, ν′ ) ∈ ∆a ,we denote by • aρ = a the action performed by ρ • Rρ = dom(ν) the subset of registers read by ρ • Wρ = dom(ν′ ) the subset of registers modiﬁed by ρ ρWe put q→q′ if • q|Rρ = ν (the rule is enabled in q) • q′ |Wρ = ν′ (the rule is applied in q′ ) • q′ (r) = q(r) for all r ∈ R Wρ (nothing else happens inbetween) 4
7. 7. Special case [Zielonka, RAIRO, 1987]An asynchronous automaton is an SMS such that • P = R and • for all rules ρ ∈ ∆a , Rρ = Loc(a) = Wρ . 5
8. 8. May-Occur-Concurrently relationLet ρ, ρ′ ∈ ∆ be two rules.We put ρ ρ′ if • Loc(aρ ) ∩ Loc(aρ′ ) = ∅, • Wρ ∩ (Rρ′ ∪ Wρ′ ) = ∅ and • Wρ′ ∩ (Rρ ∪ Wρ ) = ∅.Intuitively, two rules may occur concurrently if they correspond toactions occurring on disjoint sets of processes and if each rule doesnot modify the registers read or written by the other. 6
9. 9. Partial-order semantics (1/2)Let t = (E, , η) be a labeled partial order, i.e. a partiallyordered multiset (for short: a pomset) over Σ.A run of t is a mapping ρ : E → ∆ such thatR0 : For all e ∈ E, aρ(e) = η(e) (rule action matches event action)R1 : For all e1 , e2 ∈ E with ρ(e1 ) ρ(e2 ), e1 e2 or e2 e1 (dependent rules cannot occur concurrently)R2 : For all e1 , e2 ∈ E with e1 — 2 , ρ(e1 ) ρ(e2 ) ≺e (waiting means rule dependency)where x— means: x ≺ y and x ≺ z ≺y y implies z = y. 7
10. 10. Partial-order semantics (2/2)Let H be a downward-closed subset of events (a preﬁx of t).The configuration qρ,H reached after H with run ρ is such that  ν′ (r) if e = max{f ∈ H | r ∈ Wρ(e) } ρ(e) qρ,H (r) = qρ,H (r) = ı(r) if there is no such eventA run ρ of t is applicable if the rule ρ(e) is enabled in qρ,↓e{e}for all events e ∈ E.An applicable run of t = (E, , η) is accepting if qρ,E ∈ F.DeﬁnitionThe language L(S) recognized by S collects all pomsets whichadmit some accepting run. 8
11. 11. Foreword Model and semantics Expressive power MSO logic Speciﬁcations with automata Checking SMC speciﬁcations 8
12. 12. Question!Let Σ = {p, c} and L be the set of all ladders. p c p c p c Does any SMS recognize this language? 9
13. 13. MSO logicThe language of all ladders is MSO-deﬁnable by the conjunc-tion of the following sentences: ∀y : Pc (y) → ∃x.(Pp (x) ∧ x—≺y) ∀x, z : Pp (x) → ∃y.(Pc (y) ∧ x—≺y)) ∀x, y : (Pp (y) ∧ x y) → Pp (x) 10
14. 14. Cut-bounded languagesThe (universal) cut-width of t = (E, , η) isCW(t) = max #{ (h, e) ∈ H x (E H) | h—≺e } p c H preﬁx of tDeﬁnitionThe cut-bound B ∈ N ∪ {∞} of L is sup{ CW(t) | t ∈ L }L is cut-bounded if its cut-bound is ∞.ExampleThe language of all ladders is not cut-bounded. 11
15. 15. First result MSO-deﬁnable languages ¢ Cut-bounded languages ¢Pomset languagesTheorem (Expressive power of shared-memory systems)A pomset language is recognized by some ﬁnite SMS iffit is MSO-deﬁnable and cut-bounded . 12
16. 16. Deterministic rules and weak unambiguityA shared-memory system has deterministic rules if for allactions a ∈ Σ and all valuations ν ∈ V there exists at mostone rule (ν, a, ν′ ) ∈ ∆.A shared-memory system is weakly-unambiguous if eachpomset from L(S) admits a unique accepting run.Theorem (Expressive power equivalence)The language of any ﬁnite shared-memory system is thelanguage of a weakly-unambiguous ﬁnite shared-memorysystem with deterministic rules. 13
17. 17. Unambiguous case MSO-deﬁnable languages ¢ Media-bounded languages ¢ Cut-bounded languages ¢Pomset languagesTheorem ≃ [M., IJFCS, 2010]A pomset language is recognized by some unambiguous ﬁniteSMS iff it is MSO-deﬁnable and media-bounded . 14
18. 18. Deterministic case MSO-deﬁnable languages ¢ Media-bounded languages ¢ Cut-bounded languages ¢Pomset languages Consistent and coherent languagesTheorem ≃ [M., CONCUR’08]A pomset language is recognized by some deterministic ﬁniteSMS iff it is MSO-deﬁnable, media-bounded, coherent andconsistent . 15
19. 19. Foreword Model and semantics Expressive power MSO logic Speciﬁcations with automata Checking SMC speciﬁcations 15
20. 20. How to concatenate two pomsets? a a ?b x = a b a We have to distinguish between a’s 16
21. 21. How to concatenate two pomsets?a a a ? a aa a b ; a a a b aa a We have to distinguish between a’s 17
22. 22. Pomsets with gatesLet G be a ﬁnite and non-empty set of gates .We consider the extended alphabet Γ = Σ x 2G {∅}.We put (a, H) Γ (a′ , H′ ) if H ∩ H′ ≠ ∅ or a = a′ .Deﬁnition (Pomsets with gates)A shared-memory chart (an SMC) is a pomset t = (E, , η) overΓ such that we have either e1 e2 or e2 e1 for any twoevents e1 and e2 with η(e1 ) Γ η(e2 ).We denote by SMC the set of all SMCs. 18
23. 23. Product of SMCs a, {x} a, {x} b, {x} x = a, {y} b, {x} a, {y}Deﬁnition (Product of pomsets with gates)Given two SMCs t1 = (E1 , 1 , η1 ) and t2 = (E2 , 2 , η2 ) theasynchronous product t1 · t2 is the pomset t = (E, , η) whereE = E1 ∪ E2 , η = η1 ∪ η2 , and is the transitive closure of 1 ∪ 2 ∪{(e1 , e2 ) ∈ E1 x E2 | η(e1 ) Γ η(e2 )} 19
24. 24. Rational SMC languages a a, {x} a a, {x, y} a a a, {x} a, {x} b, {y} ; a a b a a, {x} aDeﬁnition (Automata over pomsets with gates)An SMC specification is an automaton A = (Q, ı, →, F) where Qis a ﬁnite set of states, with initial state ı, → ⊆ Q x SMC x Qis a ﬁnite set of transitions labeled by SMCs, and F ⊆ Q is asubset of ﬁnal states. 20
25. 25. SMCs vs. Mazurkiewicz traces and MSCsAny Mazurkiewicz trace can be regarded as an SMC whereeach action is a gate and each event labeled by a is associatedwith the set of actions dependent with a.Similarly any message sequence chart can be regarded as anSMC where gates are processes and each event is associatedwith the (single) process where it occurs.Moreover these identiﬁcations preserve the product oftraces and MSCsIn that way, SMCs appear as a formal generalizationof both Mazurkiewicz traces and message sequencecharts. 21
26. 26. Foreword Model and semantics Expressive power MSO logic Speciﬁcations with automata Checking SMC speciﬁcations 21
27. 27. How to detect unbounded speciﬁcations?DeﬁnitionLet t = (E, , η) be an SMC. The communication graph of t is thedirected graph CG(t) = (V, →) over the set V = e∈E π2 (η(e))of active gates in t such that g → g′ if there are e, e′ ∈ E forwhich g ∈ π2 (η(e)), g′ ∈ π2 (η(e′ )) and • either η(e) Γ η(e′ ) • or e— ′ . ≺e 22
28. 28. Checking unboundednessTheoremThe pomset language LΣ (A) of an SMC speciﬁcation A is t1 tncut-bounded iff for any loop q0 →...→qn = q0 , all connectedcomponents of the communication graph CG(t1 · ... · tn ) arestrongly connected.Consequently checking for cut-boundedness of a given SMC speciﬁcation isdecidable. It is actually easy to show that this problem is co-NP-complete. 23
29. 29. How to detect non-implementable speciﬁcations? We cannot decide whether an SMC speciﬁcation describes an implementable language, since this question is already undecidable for Mazurkiewicz traces. Deﬁnition An SMC speciﬁcation is loop-connected if for all loops t1 tn q0 →...→qn = q0 the communication graph of the SMC t1 · ... · tn is connected. Theorem A cut-bounded language is MSO-deﬁnable if and only if it is the language of a loop-connected SMC speciﬁcation. 24
30. 30. Conclusion• We have presented a characterization of the expressive power of shared-memory systems 1. in terms of logic deﬁnability and cut-boundedness 2. in terms of automata over pomsets with gates.• This model of concurrency and this algebraic framework generalize the theory of Mazurkiewicz traces and message sequence charts.• These results should be extended soon to systems with autoconcurrency .• A simpler notion of communication graph may be designed. 25
31. 31. Questions?
32. 32. Unambiguity determinismAn SMS is unambiguous if each pomset admits at most oneapplicable run.An SMS is deterministic if for each a ∈ Σ and each reachableconﬁguration q, there exists at most one rule ρ ∈ ∆a such that ρq→q′ .Clearly: Any deterministic SMS is unambiguous. 26