190 likes | 397 Views
Time Warp Operating System. Presenter: Munehiro Fukuda. Outline. Why Time Warp Optimistic Synchronization Local Control Mechanism Rollback and Anti Messages Example Code Applications Performance. Why Time Warp. Continuous Simulation Basis: mathematical equations
E N D
Time Warp Operating System Presenter: Munehiro Fukuda Time Warp OS
Outline • Why Time Warp • Optimistic Synchronization • Local Control Mechanism • Rollback and Anti Messages • Example Code • Applications • Performance Time Warp OS
Why Time Warp • Continuous Simulation • Basis: mathematical equations • Examples: Analog circuit simulation and toxicology models • Discrete Event Simulation • Basis: time-stepped status change of simulation entities • Conservative Synchronization – synchronous entities • Examples: Cellular automata and clocked logical circuits • Optimistic Synchronization – Asynchronous entities • Examples: Military simulation Time Warp OS
Clocked Logical Circuit War Game Process 0 Process 1 1cell/time unit 1cell/5 time units J Q K Q J Q K Q J Q K Q Process 2 Process 3 1cell/20 time units Examples of Synchronous and Asynchronous Simulation Entities D C B A J Q K Q Clock Time Warp OS
Optimistic Synchronization • Virtual Time • Global simulation time not necessarily synchronized to a wall clock • Each computing node ticks its local virtual time (LVT) independently • Rollback and Anti-Message • A node must ticks back the LVT (and thus rollback computation) if a stagnant message has come in. • If the node has previously sent out messages, it must send anti-messages to cancel them. • GVT Commitment • Each node must maintain a history of its computation which must be garbage-collected for memory saving. • All nodes must periodically agree at the bottom line of their LVTs that becomes GVT. Time Warp OS
LVT 130 120 140 Rollback Message LVT 185 125 155 Local Control Mechanism • LVT • Advanced from one to another local event (including a message send). • Visible only to a local processor • Ticked back upon a delayed or anti message • Computation • Check-pointed upon every event • Rolled back in accordance with LVT • Sending anti-messages to cancel previously send messages Process A Process B Time Warp OS
Local Control Mechanism: A War Game Example Discrete event simulation with optimistic synchronization Old event history kept so as to rollback computation. Process 0 e2 e4 e3 e1 attack Process 1 e5 e7 e6 e3 e1 e2 Rollback attack Process 2 e1 e9 e12 e8 e11 e10 Rollback Process 3 e14 e13 Time Warp OS
132 125 135 141 E E A A + – Delayed message Anti message Send anti-messages To cancel them Discarded Rollback Mechanism and Anti-Messages Sending time Cancelled Current State Receiving time Sender Receiver LVT Sign Text Sending time Receiving time Sender Receiver Sign Text LVT of State Saved State Time Warp OS
Rollback and Anti-Messages Example 1 Rollback 141 121 142 162 p1 Anti-message p2 152 142 120 122 141 Arrived late p3 120 135 Time Warp OS
136 141 142 162 GVT = 141 Discard all states < 141 166 Rollback and Anti-Messages Example 1 So far, it went well. Then, how to garbage-collect old states? 121 p1 p2 120 122 141 Use Samadi’s algoirthm p3 120 135 Time Warp OS
Example Code begin { Logical process A } var seed : integer; { State variables } r : real; Initialization Section: begin seed := 123; r := 1.0; end; EventMessage Section: begin var i : integer; { Loop counter } n : integer; { # of event msgs arriving at same virtual time } current : VirtualTime; VirtualTime( current ); Mcount( n ); for I := 1 to n do begin ReadEventMessage( I, Type ); SendEventMessage( Current + ExpRandom( Seed, r ), ‘B’, type ); end end end Termination Section: begin print( ‘Program completed’ ); end; end. { of logical process A } Time Warp OS
Applications • Distributed Discrete Event Simulation • Distributed Database Concurrency Control • If reading at timestamp 10 occurs before writing at timestamp 5, rollback the transactions. • Virtual Circuit Communication • They focused on TCP when writing this paper in 1985. Time Warp OS
Performance: Game of Life(Paul Irwin, a CSS graduate created this graph from the original paper.) Sequential Execution (1364 s) Time (s) Optimal Configuration (166 s) Speedup of 8.22 Processors Time Warp OS
Contributions • The first implementation of optimistic synchronization • Application suggestions • Performance analysis Time Warp OS
Drawbacks • Many restrictions: • No dynamic process creation or migration once simulation is running. • No user level I/O during simulation execution. • Processes must be deterministic. • No heap storage (new() or malloc()). • Performance problems: • Little detail of GVT computation, (i.e., global state capturing). • Domino effect and large check-pointing cost. Time Warp OS
Questions? Time Warp OS