PTIDES A Programming Model for Time Synchronized Distributed
PTIDES: A Programming Model for Time. Synchronized Distributed Real-time Systems Yang Zhao, EECS, UC Berkeley Edward A. Lee, EECS, UC Berkeley Jie Liu, Microsoft Research 7 th Biennial Ptolemy Miniconference Berkeley, CA February 13, 2007
Distributed Real-Time Systems ¢ Multiple computers, comprising of sensors and actuators, connected on a network that act and react on events to meet timing constraints. Ptolemy Miniconference, February 13, 2007 Zhao, Berkeley 2
Related Work ¢ ¢ RTOS: prioritize tasks and trigger computation. Languages: l l ¢ synchronous languages: Esterel, Scade, Luster, Signal time-triggered languages and the concept of logical execution time: Simulink (RTW), Giotto. Real-Time Networking l l l Time Triggered Protocol (MARS project) Flex. Ray (BMW, etc. ) SAFEbus (Honeywell) • deterministic message sending or guaranteed message latency • clock synchronization • requiring special bus-architecture Ptolemy Miniconference, February 13, 2007 Zhao, Berkeley 3
Related Work ¢ Time synchronization over standard network l l l ¢ ¢ NTP (~ms): internet RBS (~ms): wireless network IEEE 1588(~ns): Ethernet Provides a useful common notion of time for general distributed realtime systems. How to design such systems leveraging time synchronization? Event-triggered approach: more dynamic environment. PTIDES (Programming Time-Integrated Distributed Embedded Systems): l l Discrete-event semantics Carefully chosen relations between model time and real time. Efficient execution based on causality analysis that guarantees determinacy is preserved at runtime. Does not depends on domain specific network architectures Ptolemy Miniconference, February 13, 2007 Zhao, Berkeley 4
Discrete Event Modeling in Ptolemy II DE Director implements timed semantics to make sure ordering of time stamps be respected. Reactive actors Event source Signal Time line Ptolemy Miniconference, February 13, 2007 Zhao, Berkeley 5
Discrete Event Models ¢ DE models have been primarily used in performance modeling and simulation: l l l ¢ ¢ Hardware systems (VHDL, Verilog) Manufacturing systems Communication networks (OPNET, NS-2) Transportation systems Stock market DDE is usually to accelerate simulation, not to implement distributed real-time systems. PTIDES uses DE as a application specification language which serves as a semantic basis for obtaining determinism in distributed real-time systems. l l Applications are given as distributed DE models. Certain events have their model time mapped to real time. Ptolemy Miniconference, February 13, 2007 Zhao, Berkeley 6
Example: Networked Cameras ¢ ¢ ¢ Camera has computer-controlled zoom and focus capabilities. Zoom and focus take time to set up, and the camera should not take picture during this period. The video of each camera is synchronized and time stamped l l All the views of some interesting moment can be played back in sequence How often a camera takes picture is also controlled by the computer. e: zoom camera at t e’: take picture at t’ If t – t’ < , then e should be dropped. Ptolemy Miniconference, February 13, 2007 Zhao, Berkeley 7
DE Model for the Example Ptolemy Miniconference, February 13, 2007 Zhao, Berkeley 8
DE Model on the Central Computer 2 v v = 2: zoom in camera. 1 12 3 om in tm all zo tr = 2 Ptolemy Miniconference, February 13, 2007 Zhao, Berkeley 9
DE Model on the Central Computer 4 3 2 1 v v = 2: zoom in camera. v > 2: change period p to (v-2)*p. 12 34 5 6 tm d b ou le rio e p d tr = 5. 5 Ptolemy Miniconference, February 13, 2007 Zhao, Berkeley 10
DE Model for the Cameras 4 3 2 1 v v 1 1 2 3 4 5 6 7 8 9 10 12 34 5 6 tm tm Ptolemy Miniconference, February 13, 2007 Zhao, Berkeley 11
DE Model for the Cameras 4 3 2 1 v 12 34 5 6 tm Assume d = 1 Ptolemy Miniconference, February 13, 2007 Zhao, Berkeley 12
DE Model for the Cameras 4 3 2 1 v 12 34 5 6 tm 2 1 v 12 3 4 3 2 1 tm v 12 34 5 6 tm Assume d = 1 Ptolemy Miniconference, February 13, 2007 Zhao, Berkeley 13
DE Model for the Cameras v 1 1 2 3 4 5 6 7 8 9 10 2 1 tm v 12 3 tm 2 1 v 1 2 3 4 5 6 7 8 9 10 tm e: zoom camera at t e’: take picture at t’ If t – t’ < =1, then e should be dropped. Ptolemy Miniconference, February 13, 2007 Zhao, Berkeley 14
DE Model for the Cameras 2 1 v 1 2 3 4 5 6 7 8 9 10 tm Ex. v = 1, tm = 1: take a picture at tr = 1. v = 2, tm = 3: zoom in camera at tr = 3. Ptolemy Miniconference, February 13, 2007 Zhao, Berkeley 15
Actors bind model time to real time 4 3 2 1 v 12 34 5 6 tm producing an event with model time corresponding to the real time when the user input happens. d b ou le rio e p d tr = 5. 5 Ptolemy Miniconference, February 13, 2007 Zhao, Berkeley 16
Actors bind model time to real time 2 1 v 1 2 3 4 5 6 7 8 9 10 tm The Device actor producing an physical action at the real time corresponding to the model time of each input event. Input events must be made available for processing at real time strictly earlier than the model time. Ptolemy Miniconference, February 13, 2007 Zhao, Berkeley 17
Challenges in Executing the Model ¢ ¢ Not be practical nor efficient to use a centralized event queue to sort events in chronological order. Do the techniques developed for distributed DE simulation work? l l ¢ Conservative (Chandy and Misra) Optimistic (Time warp, Jefferson) Our approach: events only need to be processed in time-stamp order when they are causally related. Ptolemy Miniconference, February 13, 2007 Zhao, Berkeley 18
Conservative Execution of the Example v 1 12 3 tm Deadline missed! Received at real time tr > 3 Assure no event with time stamp tm <= 3 at tr = 3 Ptolemy Miniconference, February 13, 2007 Zhao, Berkeley 19
Challenges in Executing the Model ¢ ¢ Not be practical nor efficient to use a centralized event queue to sort events in chronological order. Do the techniques developed for distributed DE simulation work? l l ¢ Conservative (Chandy and Misra) Optimistic (Time warp, Jefferson) Our approach: events only need to be processed in time-stamp order when they are causally related. Ptolemy Miniconference, February 13, 2007 Zhao, Berkeley 20
Intuition on Out of Order Execution v 1 Received by real time 12 3 tm tr < 3 -d+D 1 ? 12 3 1 ? 1 3 -d tm tm If there is an event with time stamp tm <= 3 -d at tr <= 3 -d D : is the up bound of network delay; d > D Ptolemy Miniconference, February 13, 2007 Zhao, Berkeley 21
Intuition on Out of Order Execution We can always safely process an event e at the first input of Merge by tr > tm - d + D, no matter whethere are events received at s 1 or not! (If some sub-system fails, the rest of the system can continue without being blocked. ) v 1 12 3 tm D : is the up bound of network delay; d > D Ptolemy Miniconference, February 13, 2007 Zhao, Berkeley 22
Relevant Dependency Analysis ¢ ¢ ¢ Relevant dependency analysis gives a formal framework for analyzing causality relationships to determine the minimal ordering constraints on processing events. It capture the idea that events only need to be processed in time-stamp order when they are causally related. Can preserve the deterministic behaviors specified in DE models without paying the penalty of totally ordered executions. Yang Zhao, Jie Liu and Edward A. Lee, "A Programming Model for Time. Synchronized Distributed Real-Time Systems", in Proceedings of the 13 th IEEE Real-Time and Embedded Technology and Applications Symposium (RTAS 07), Bellevue, WA, United States, April 3 -6, 2007. Ptolemy Miniconference, February 13, 2007 Zhao, Berkeley 23
Causality Interface [Zhou--Lee] ¢ Causality interface of a component declares the dependency between input and output. Ptolemy Miniconference, February 13, 2007 Zhao, Berkeley 24
Causality Interface Composition Ptolemy Miniconference, February 13, 2007 Zhao, Berkeley 25
Relevant Dependency ¢ Relevant dependency on any pair of input ports p 1 and p 2 specifies whether an event at p 1 will affect an output signal that may also depend on an event at p 2. Ptolemy Miniconference, February 13, 2007 Zhao, Berkeley 26
Relevant Dependency ¢ d( p 1, p 6) = d means any event with time stamp t at p 2 can be processed when all events at p 1 are known up to time stamp t − d. Ptolemy Miniconference, February 13, 2007 Zhao, Berkeley 27
Relevant Order ¢ ¢ Relevant dependencies induce a partial order, called the relevant order, on events. e 1 <r e 2 means that e 1 must be processed before e 2. If neither e 1 <r e 2, nor e 2 <r e 1, i. e. e 1 ||r e 2, then e 1, e 2 can be processed in any order. This technique can be adapted to distributed execution. Ptolemy Miniconference, February 13, 2007 Zhao, Berkeley 28
Conclusion ¢ ¢ ¢ Time synchronization can greatly change the way distributed systems are designed. Discrete-event model can be used as a programming model to explicitly specify and manipulate time relations between events. It is challenging to design distributed systems to make sure they are executable. Causality analysis can be used to determine when events can be processed out of order to improve executability and reliability. Work in progress: l l statically check whether a system design is executable. Implementing a runtime environment on P 1000 by Agilent. Ptolemy Miniconference, February 13, 2007 Zhao, Berkeley 29
- Slides: 29