STRUCTURE OF CONCURRENCY Ryszrd Jnicki Deprtment of Computing nd Softwre McMster University Hmilton, ON, L8S 4K1 Cnd jnicki@mcmster.c 1
Introduction Wht is concurrency? How it cn e modelled? Wht re the sic tools for modelling concurrency? Clssicl, or the most populr (top down) pproches to modelling concurrecy: 1. Find forml model for system (utomt, process lger, Petri nets, etc.). 2. Define semntics for the chosen model (sequences, prtil orders, steps, temporl logic, etc.). Cn we discuss concurrency without introducing the system level? 2
Voculry An OBSERVATION: system/progrm run sequence : c d step sequence : c d n INTERVAL order : c eginning of end of time An CONCURRENT BEHAVIOUR/CONCURRENT HISTORY: set of EQUIVALENT oservtions. 3
SIMULTANEITY: if two event occurrences nd re llowed, they cn e executed either IN SEQUENCE or SIMULTANEOUSLY A forml definition of simultneity is not ovious nd depends on the mening of events. We ssume tht it is somehow correctly defined or simply disllowed (impossile to oserve). time SIMULTANEOUS SIMULTANEOUS???? 4
CONCURRENCY PARADIGMS: A superposition or sttement out the structure of concurrent ehviour/history involving tretment of SIMULTANEITY. We hve 8 prdigms π 1,..., π 8, however from those eight only π 1, π 3, nd π 8 re importnt. π 8 : the most restrictive one: ( Δ. x o y) [( Δ. x o y) ( Δ. y o x)] where: Δ - concurrent ehviour/concurrent history (i.e. set of equivlent oservtions), x o y - in the oservtion o, x nd y re simultneous, x o y - in the oservtion o, x preceeds y. 5
π 3 : covers most cses tht re not covered y π 8 : [( Δ. x o y) ( Δ. y o x)] = ( Δ. x o y) where: Δ - concurrent ehviour/concurrent history (i.e. set of equivlent oservtions), x o y - in the oservtion o, x nd y re simultneous, x o y - in the oservtion o, x preceeds y. π 1 : no restrictions t ll. π 8 = π 3 = π 1 6
Remrk 1 : If simultneity is disllowed or unoservle, the concept of concurrency prdigms disppers, only sequentil oservtions do exist. Remrk 2 : If time is continuous nd events re instntenous, simultneity does not exist s one of the fundmentl principles of modern physics sttes: no two instntenous events cn e oserved exctly t the sme time. Such oservtion would require infinite energy. Remrk 3 : Ech non instntenous event, cn e modelled y two instntenous events B nd E, with B o E for ech oservtion, where B is the eginning of nd E is the end of. Do we need theory for ono instntenous events? YES. Complex numers cn e modelled y pirs of rels, frctions y pirs of integers, etc., ut this is not very prcticl wy of using them. 7
SETS OF PARTIAL ORDERS AND THEIR INVARIANTS Let Δ e set of prtil orders with common domin, nd let invrints(δ) e the sets of ll INVARIANTS generted y Δ, where n invrint of Δ is property (i.e. reltion) shred y ll memers of Δ. All invrints cn e derived from the three sic ones: <, nd <>, interpreted s CAUSALITY, WEAK CAUSALITY nd COMMUTATIVITY. Let inv,eninvrint, nd let extensions(inv) e the set of ll prtil orders tht re extensions of inv, i.e. they stisfy ll the properties of the reltion inv. 8
BASIC INVARIANTS CAUSALITY RELATION: < For ech oservtion, lwys PRECEEDS. WEAK CAUSALITY RELATION: For ech oservtion, is lwys NOT LATER THAN. COMMUTATIVITY RELATION: <> For ech oservtion, either lwys PRECEEDS, OR PRECEEDS, ut they re NEVER executed simultneously. NOTE THAT: < <> CAUSALITY is lwys PARTIAL ORDER, the xioms for WEAK CAUSALITY nd COMMUTATIVITY re much more complex. All invrints cn e derived from <, nd <>. 9
CONCURRENT HISTORIES Let Δ e set of prtil orders with common domin. The set of prtil orders Δ cl, invrint closure of Δ, is defined s: Δ cl = \ inv invrints(δ) extensions(inv). It cn e proved tht Δ cl = extenstions(<> Δ ) extensions( Δ ) or, if the prdigms π 3 holds: Δ cl = extenstions(< Δ ) extensions( Δ ) A set of prtil orders with common domin Δ is clled CONCURRENT HISTORY if Δ = Δ cl nd the elements of Δ re interpreted s oservtions. 10
A Simple Exmple Consider two events: nd. Let {,} denote simultneous execution of nd. Assume tht oth nd must e executed, ech of them exctly once. How mny (nonequivlent) trnsition systems cn we construct for this prolem? Three (or two or only one, dependently on interprettion) sequentil models: 11
Five (ut only four relly different) non-sequentil models: {,} {,} {,} {,} 12
CASE 1 Equivlent oservtions: o 1 =c o 2 =c o 3 ={,c} c o {,c} 1 = o 2 = c o 3 = c c c CAUSALITY: < is equl to c < is the intersection o 1 o 2 o 3, {o 1,o 2,o 3 } is the set of ll step sequence extensions of <, {o 1,o 2,o 3 } is lso the set of ll intervl order extensions of <, CONCLUSION: < is equivlent to/fully represented y the set {o 1,o 2,o 3 } π 8 is SATISFIED in this cse (lso π 3 nd π 1 ). 13
CASE 2 c {,c} Equivlent oservtions: o 1 =c o 1 = o 3 = c CAUSALITY: < is equl to c WEAK CAUSALITY: is equl to c o 3 ={,c} c 14
For ech reltion R, define R s R (R). Note tht if R is totl order then R = R. For the Cse 2 we hve: o 1 = ô 1 = c ut o 3 = c ô 3 = c < is the interesection o 1 o 3, is the interesection ô 1 ô 3, {o 1,o 3 } is the set of extensions of the pir (<, ) in the sense tht {o 1,o 3 } extends < nd {ô 1,ô 3 } extends. CONCLUSION: (<, ) is equivlent to/fully represented y the set {o 1,o 3 }. π 3 is stisfied here, ut π 8 is NOT. 15
CASE 3 {,c} o 3 = Equivlent oservtions: o 3 ={,c} c CAUSALITY: < is equl to c WEAK CAUSALITY: is equl to c CONCLUSION: (<, ) is equivlent to/fully represented y the set {o 3 }. π 3 is stisfied here, ut π 8 is NOT. 16
CASE 4 c c Equivlent oservtions: o 1 =c o 2 =c o 1 = c o 2 = c CAUSALITY: < is equl to c WEAK CAUSALITY: is equl to < COMMUTATIVITY: <> is equl to c 17
o 1 = ô 1 = c nd o 2 = ô 2 = c is the interesection ô 1 ô 2, <> is the interesection (o 1 o 1 1 ) (o 2 o 1 2 ) {o 1,o 2 } is the set of extensions of the pir (<>, ) in the sense tht {ô 1,ô 2 } extends nd {o 1 o 1 1,o 2 o 1 2 } extends <>. CONCLUSION: (<>, ) is equivlent to/fully represented y the set {o 1,o 2 }. Only π 1 is stisfied, π 3 nd π 8 re NOT! 18
AXIOMS FOR CAUSALITY (<), WEAK CAUSALITY ( ) nd COMMUTATIVITY (<>) If the prdigm π 3 holds then <>=< < 1. Oservtions re SEQUENCES (TOTAL ORDERS), i.e. Simultneity is not llowed: < is PARTIAL ORDER is equl to < nd <> is equl to < < 1 Oservtions re STEP-SEQUENCES (STRATIFIED ORDERS), i.e. Simultneity is n equivlence reltion: S1. S2. < = S3. c = c = c S4. < c < c = < c S5. < <> (needed only if π 3 does not hold). 19
Oservtions re INTERVAL ORDERS I1. I2. < = I3. < < c = < c I4. < c < c = c I5. < c < d = < d I6. < c d = d = d I7. < <> (needed only if π 3 does not hold). Oservtions re PARTIAL ORDERS P1. P2. < = P3. < < c = < c P4. < c < c = c P5. < <> (needed only if π 3 does not hold). 20
COCLUSION A cuncurrent history, i.e. set of prtil orders Δ such tht Δ = Δ cl,is lwys entirely defined y its invrints, {<>, }, i.e. commuttivity nd wek cuslity. Dependently on the restrictions on the kind of prtil orders in Δ, the reltions <, nd <>, stisfy xioms S1-S5, I1-I7, orp1-p5. If Δ conforms to the prdigm π 3, then Δ is entirely defined y its invrints, {<, }, i.e. cuslity nd wek cuslity. 21
THANK YOU! 22