DEPARTMENT OF COMPUTER SCIENCES A Language for Task Orchestration and its Semantic Properties David Kitchin, William Cook and Jayadev Misra Department of Computer Science University of Texas at Austin Email: dkitchin,wcook,misra@cs.utexas.edu web: http://www.cs.utexas.edu/users/wcook/projects/orc/ UNIVERSITY OF TEXAS AT AUSTIN 0
DEPARTMENT OF COMPUTER SCIENCES Overview of Orc Orchestration language. Invoke services by calling sites Manage time-outs, priorities, and failures Structured concurrent programming. A Program execution calls sites, publishes values. Simple calculus, with only 3 combinators. Semantics described by labeled transition system and traces Easy to create and terminate processes Prototype implementation available. UNIVERSITY OF TEXAS AT AUSTIN 1
DEPARTMENT OF COMPUTER SCIENCES Structure of Orc Expression Simple: just a site call, ÆÆ µ Publishes the value returned by the site. composition of two Orc expressions: do and in parallel Symmetric composition for all Ü from do Ü Piping for some Ü from do ÛÖ Ü¾ Asymmetric composition UNIVERSITY OF TEXAS AT AUSTIN 2
DEPARTMENT OF COMPUTER SCIENCES Symmetric composition: ÆÆ : calls both ÆÆ and simultaneously. Publishes values returned by both sites. ( ¼, ½ or ¾ values) Evaluate and independently. Publish all values from both. No direct communication or interaction between and. They may communicate only through sites. UNIVERSITY OF TEXAS AT AUSTIN 3
Ü µ Ý Ùµ DEPARTMENT OF COMPUTER SCIENCES Pipe: Ü For all values published by do. Publish only the values from. ÆÆ Ü ÑÐ Ö Üµ ÆÆ Call. Bind result (if any) to Ü. ÑÐ Ö Call ܵ. Publish the value, if any, returned by ÑÐ. ÆÆ µ Ü ÑÐ Ö Üµ May ÑÐ call twice. Publishes up to two values from ÑÐ. Notation: Write for Ü if Ü unused in. Precedence: Ü Ý Ù UNIVERSITY OF TEXAS AT AUSTIN 4
DEPARTMENT OF COMPUTER SCIENCES Schematic of piping f g0 g1 g2 Figure 1: Schematic of Ü UNIVERSITY OF TEXAS AT AUSTIN 5
DEPARTMENT OF COMPUTER SCIENCES Asymmetric parallel composition: ÛÖ Ü¾ µ For some value published by do. Publish only the values from. ܵ ÛÖ Ü¾ ÆÆ µ ÑÐ Ö Ü Binds to the first value ÆÆ from. Evaluate and in parallel. Site calls that Ü need are suspended; other site calls proceed. Å Æ Üµµ ÛÖ Ü¾ When returns a value, assign it to Ü and terminate. Resume suspended calls. Values published by are the values of ÛÖ Ü¾ µ. UNIVERSITY OF TEXAS AT AUSTIN 6
DEPARTMENT OF COMPUTER SCIENCES Some Fundamental Sites ¼: never responds. ÐØ Ü Ý µ: returns a tuple of its argument values. µ: boolean, returns a signal if is true; remains silent if is false. ËÒÐ returns a signal immediately. Same as trueµ. ÊØÑÖ Øµ: integer Ø, Ø ¼, returns a signal Ø time units later. UNIVERSITY OF TEXAS AT AUSTIN 7
ÅÐÇÒ µ ѵ ÛÖ Ñ¾ ÆÆ µ ÑРص ÅÐÄÓÓÔ ÊØÑÖ Øµ ÅÐÄÓÓÔ Øµ ÅÐÇÒ µ DEPARTMENT OF COMPUTER SCIENCES Expression Definition Expression is called like a procedure. May publish many ÅÐÄÓÓÔ values. does not publish a value. Site calls are strict; expression calls non-strict. UNIVERSITY OF TEXAS AT AUSTIN 8
DEPARTMENT OF COMPUTER SCIENCES Metronome Publish a signal at every time unit. ÅØÖÓÒÓÑ ËÒÐ ÊØÑÖ ½µ ÅØÖÓÒÓÑ S R S R Publish Ò signals. Å ¼µ ¼ Å Òµ ËÒÐ ÊØÑÖ ½µ Å Ò ½µ UNIVERSITY OF TEXAS AT AUSTIN 9
ØÐÐÝ Å Å˵ Å ÐØ ½µ ÊØÑÖ ½¼µ ÐØ ¼µ Ù¾ ØÐÐÝ Å˵ Ú¾ DEPARTMENT OF COMPUTER SCIENCES Recursive definition with time-out Call a list of sites. Count the number of responses received within 10 time units. ØÐÐÝ µ ÐØ ¼µ Ú Ù where UNIVERSITY OF TEXAS AT AUSTIN 10
DEPARTMENT OF COMPUTER SCIENCES Time-out Return Ü trueµ if Å returns Ü before Ø, and falseµ otherwise. µ ÐØ Þ where µ¾ Þ Ü ÐØ Ü trueµ Å ÊØÑÖ Øµ Ü ÐØ Ü falseµ UNIVERSITY OF TEXAS AT AUSTIN 11
DEPARTMENT OF COMPUTER SCIENCES Fork-join parallelism Call Å and Æ in parallel. Return their values as a tuple after both respond. Úµ ÐØ Ù Ù¾ Å where Ú¾ Æ UNIVERSITY OF TEXAS AT AUSTIN 12
µ DEPARTMENT OF COMPUTER SCIENCES Barrier Synchronization in Å Æ and start only after both Å and Æ complete. ( ÐØ Ù Úµ where Ù¾ Å Ú¾ Æ ) UNIVERSITY OF TEXAS AT AUSTIN 13
DEPARTMENT OF COMPUTER SCIENCES Arbitration In CCS: «È É In Orc: µ È µ É where ÐÔ ÐØ trueµ Ø ÐØ falseµ ¾ Orc does not permit non-deterministic internal choice. UNIVERSITY OF TEXAS AT AUSTIN 14
DEPARTMENT OF COMPUTER SCIENCES Priority Publish Æ s response asap, but no earlier than 1 unit from now. ÐÝ ÊØÑÖ ½µ ÐØ Ùµµ ÛÖ Ù¾ Æ Call Å, Æ together. Å If responds within one unit, take its response. Else, pick the first response. ÐØ Üµ ÛÖ Ü¾ Å Ðݵ UNIVERSITY OF TEXAS AT AUSTIN 15
Ø Üµ Ø Ýµ ÓÖ Ü Ýµ Þ¾ Šܾ DEPARTMENT OF COMPUTER SCIENCES Parallel or Sites Å and Æ return booleans. Compute their parallel or. Ø µ µ ÐØ trueµ: returns true if is true; silent otherwise. Ø Ýµ ÓÖ Ü Ýµ Ø Üµ where ܾ Šݾ Æ To return just one value: ÐØ Þµ where ݾ Æ UNIVERSITY OF TEXAS AT AUSTIN 16
DEPARTMENT OF COMPUTER SCIENCES Formal Syntax ¾ ÜÔÖ ::= Å Ôµ Site call Ôµ Expression call Ü Sequential composition Symmetric composition ÛÖ Ü¾ Asymmetric composition Ô ¾ ØÙÐ ::= Ü Ú Å Ò ::= ܵ UNIVERSITY OF TEXAS AT AUSTIN 17
DEPARTMENT OF COMPUTER SCIENCES Transitions, Events ¼ : may engage in event and transit to ¼. Base events ::= Ú publish ÚÒØ internal event Å Úµ Site call with handle Ú Response Response is outside the control of Orc. UNIVERSITY OF TEXAS AT AUSTIN 18
Úµ Å Úµ Å Ú ÐØ Úµ DEPARTMENT OF COMPUTER SCIENCES Rules for Site Call fresh Ú ¼ ÐØ Úµ UNIVERSITY OF TEXAS AT AUSTIN 19
¼ ¼ ¼ ¼ DEPARTMENT OF COMPUTER SCIENCES Symmetric Composition UNIVERSITY OF TEXAS AT AUSTIN 20
Ú ¼ DEPARTMENT OF COMPUTER SCIENCES Piping ¼ Ú Ü ¼ Ü Ü ¼ Ü µ ÚÜ UNIVERSITY OF TEXAS AT AUSTIN 21
¼ Ú ¼ ÚÜ ÛÖ Ü¾ ¼ DEPARTMENT OF COMPUTER SCIENCES Asymmetric Composition ÛÖ Ü¾ ¼ ÛÖ Ü¾ ÛÖ Ü¾ ¼ Ú ÛÖ Ü¾ UNIVERSITY OF TEXAS AT AUSTIN 22
DEPARTMENT OF COMPUTER SCIENCES Expression Call ܵ ¾ ÔÜ Ôµ UNIVERSITY OF TEXAS AT AUSTIN 23
Úµ Å Úµ Å Ú ÐØ Úµ ¼ ¼ ¼ ¼ Ú ¼ Ú ¼ ¼ ÚÜ ÛÖ Ü¾ ¼ DEPARTMENT OF COMPUTER SCIENCES Rules ¼ Ú fresh Ü ¼ Ü Ü ¼ Ü µ ÚÜ Ú ¼ ÐØ Úµ ÛÖ Ü¾ ¼ ÛÖ Ü¾ ÛÖ Ü¾ ܵ ¾ ¼ Ú ÔÜ ÛÖ Ü¾ Ôµ UNIVERSITY OF TEXAS AT AUSTIN 24
Šܵ ÐØ Üµµ Ý Ê Ýµµ ÛÖ Ü¾ Æ Ëµ Šܵ ÐØ Üµµ Ý Ê Ýµµ ÛÖ Ü¾ Æ µ Šܵ ÐØ Üµµ Ý Ê Ýµµ ÛÖ Ü¾ Ð µ Ð Ð Ð ÐØ µ; Ð Ð ÐØ µ Šܵ ÐØ Üµµ Ý Ê Ýµµ ÛÖ Ü¾ ÐØ µ µ DEPARTMENT OF COMPUTER SCIENCES Example Ë Call Ë : ; Æ Ë Ë Æ Ë Ë Ð Æ Æ Call UNIVERSITY OF TEXAS AT AUSTIN 25
Šܵ ÐØ Üµµ Ý Ê Ýµµ ÛÖ Ü¾ ÐØ µ µ ¼; ÐØ µ Å µ ÐØ µµ Ý Ê Ýµ Å µ ¼µ Ý Ê Ýµµ Ê µ ¼ DEPARTMENT OF COMPUTER SCIENCES Example ÐØ µ ¼; Å µ ÐØ µ Å µ ¼; ÐØ µ Ú ¼ implies Ý ¼ Ý µ ÚÝ Ò µ Ê Ê call with (5) argument Å µ ¼µ Ý Ê Ýµµ Ò UNIVERSITY OF TEXAS AT AUSTIN 26
Ò Ò Ò ÐØ µ Å µ ¼µ Ý Ê Ýµµ ÐØ µ ÐØ µ ¼ Å µ ¼µ Ý Ê Ýµµ ¼ DEPARTMENT OF COMPUTER SCIENCES Example Å µ ¼µ Ý Ê Ýµµ Ò The sequence of events: Ë Æ Ð Ð Ê Ò µ Ò The sequence minus events: Ë Æ Ð Ð Ê Ò µ Ò UNIVERSITY OF TEXAS AT AUSTIN 27
µ ¼ DEPARTMENT OF COMPUTER SCIENCES Executions and Traces Define µ ¼¼ ¼¼ µ ¼, ¼ is an execution of. µ Given A trace is an execution minus events. The set of executions of (and traces) are prefix-closed. UNIVERSITY OF TEXAS AT AUSTIN 28
¼ Ü ¼ DEPARTMENT OF COMPUTER SCIENCES Laws, using strong bisimulation ¼ µ µ Ü Ý µ Ü µ Ý, if is Ü-free. µ Ü Ü Ü µ ÛÖ Ü¾ ÛÖ Ü¾ µ, if is Ü-free. Ý µ ÛÖ Ü¾ ÛÖ Ü¾ µ Ý, if is Ü-free. ÛÖ Ü¾ µ ÛÖ Ý¾ ÛÖ Ý¾ µ ÛÖ Ü¾, if is Ý -free, is Ü-free. UNIVERSITY OF TEXAS AT AUSTIN 29
1. Ü Ü 2. Ü Ü ÛÖ Ü¾ ÛÖ Ü¾ 3. ÛÖ Ü¾ ÛÖ Ü¾ DEPARTMENT OF COMPUTER SCIENCES Relation is an equality Given, show UNIVERSITY OF TEXAS AT AUSTIN 30
Then we can t show ÐØ Üµ ÐØ Ýµ ÐØ Ýµ ÐØ Üµ DEPARTMENT OF COMPUTER SCIENCES Treatment of Free Variables Closed Open expression: No free variable. expression: Has free variable. Law holds only if both and are closed. ÐØ Üµ ¼ Otherwise: But ÐØ ½µ Ü ¼ ÐØ ½µ Ü ÐØ Üµ UNIVERSITY OF TEXAS AT AUSTIN 31
ÚÜ DEPARTMENT OF COMPUTER SCIENCES Substitution Event ÚÜ ÚÜ (SUBST) Now, ½Ü ÐØ Üµ ÐØ ½µ. So, ÐØ Üµ ¼ From ÚÜ ÚÜ, we can not conclude: Earlier rules apply to base events only. ÚÜ UNIVERSITY OF TEXAS AT AUSTIN 32
DEPARTMENT OF COMPUTER SCIENCES Traces as Denotations Define Orc combinators over trace sets, Ë and Ì. Define: Ë Ì, Ë Ü Ì, Ë ÛÖ Ü¾ Ì. Notation: is the set of traces of. Theorem Ü Ü ÛÖ Ü¾ ÛÖ Ü¾ UNIVERSITY OF TEXAS AT AUSTIN 33
1. Ü 2. Ü Ü Ü ÛÖ Ü¾ 3. ÛÖ Ü¾ ÛÖ Ü¾ ÛÖ Ü¾ DEPARTMENT OF COMPUTER SCIENCES Expressions are equal if their trace sets are equal Define: if. Theorem (Combinators preserve ) Given and any combinator :, Specifically, given UNIVERSITY OF TEXAS AT AUSTIN 34
DEPARTMENT OF COMPUTER SCIENCES Monotonicity, Continuity Define: Ú if. Theorem (Monotonicity) Ú Given and any combinator Ú, Ú Chain : ¼ Ú ½ Ú ½. Ø Theorem: µ Ø µ. Theorem: Ø µ Ø µ. UNIVERSITY OF TEXAS AT AUSTIN 35
¼ Å ½ Å ¼ Ë Ê Å, ¼ DEPARTMENT OF COMPUTER SCIENCES Least Fixed Point Å Ë Ê Å Å is the least upper bound of the chain Å ¼ Ú Å ½ Ú UNIVERSITY OF TEXAS AT AUSTIN 36
DEPARTMENT OF COMPUTER SCIENCES Weak Bisimulation ÒÐ Ü ÐØ Üµ UNIVERSITY OF TEXAS AT AUSTIN 37
DEPARTMENT OF COMPUTER SCIENCES Theoretical Justification for Simplicity of Orc Simple trace semantics. Monotonicity, continuity of the combinators. Least fixed point characterizations of recursive definitions. Enjoys properties of functional programs, yet highly non-detrministic. UNIVERSITY OF TEXAS AT AUSTIN 38
DEPARTMENT OF COMPUTER SCIENCES Extensions Time Synchrony Immediate sites UNIVERSITY OF TEXAS AT AUSTIN 39