Time warp simulation

What Is Time Warp Simulation?

Time warp simulation is a method for parallel discrete-event simulation in which multiple processors execute simulation events without waiting for explicit synchronization from other processors, then roll back and re-execute if they discover they have processed an event out of causal order. Introduced by David Jefferson in a foundational 1985 paper and elaborated in the Time Warp Operating System (TWOS), the approach belongs to the class of optimistic synchronization protocols: it assumes that out-of-order events are rare and pays the cost of rollback only when they do occur, rather than imposing conservative synchronization barriers on every process at every step. The result is a protocol that can extract substantial parallelism from simulations with sparse event dependencies, at the cost of more complex state management and the need to handle rollback correctly.

Parallel discrete-event simulation addresses the fundamental problem of executing a discrete-event simulation model on multiple processors to reduce wall-clock run time. The difficulty is causality: events in a discrete-event model must be processed in nondecreasing order of their simulation timestamps, but different processors have no automatic mechanism to ensure that a low-timestamp event waiting on one processor will be discovered before a high-timestamp event is processed on another.

Optimistic Parallel Discrete-Event Simulation

The time warp protocol assigns each logical process its own local virtual time and allows it to process events in timestamp order without coordinating with other processes. When a logical process sends a message to another, the message carries the sender's virtual time as a timestamp. If a receiving process later discovers an incoming message with a timestamp earlier than events it has already processed, it must roll back to the point just before that message's timestamp and re-execute from there. This optimistic approach, in contrast to conservative Chandy-Misra protocols that require each process to prove it is safe to advance before doing so, eliminates the need for lookahead, a constraint that is difficult to compute for many real simulation models. The ACM Transactions paper studying time warp rollback mechanisms analyzes the practical cost of rollback under different event distributions and workload patterns.

Rollback and State Recovery

Rollback requires each logical process to maintain a history of its past states and the output messages it has sent, so that state can be restored and erroneous messages can be cancelled. State saving can be achieved by periodic checkpointing, in which a copy of the full process state is stored at regular intervals, or by incremental state saving, which records only the changes made since the last checkpoint. When a rollback is triggered, the process restores the most recent saved state with a timestamp earlier than the straggler message, cancels all messages it sent with timestamps at or after the rollback point by transmitting antimessages that annihilate the original messages when received, and resumes forward execution. The interaction between rollback depth, state saving overhead, and antimessage traffic determines much of the practical performance of a time warp implementation, and there is substantial literature on strategies for minimizing total overhead.

Global Virtual Time

Global virtual time (GVT) is the minimum of all unprocessed event timestamps and all in-transit message timestamps across the entire simulation. Because no process can ever roll back to a virtual time earlier than GVT, events whose timestamps are below GVT are permanently committed and the state they produced can be discarded from the rollback history. GVT computation serves as the memory reclamation mechanism for time warp: without it, state and message histories would grow without bound. GVT also provides the simulation clock that external observers can read to track overall progress. The ACM Transactions on Modeling and Computer Simulation work on unified virtual time extends the framework to unify conservative and optimistic synchronization within a single protocol, allowing individual events to choose their synchronization mode based on local conditions. A classic exposition of GVT and its computation appears in Jefferson's 1987 paper on the Time Warp Operating System.

Applications

Time warp simulation has applications across a range of computationally demanding simulation domains, including:

  • Military and defense logistics simulations, where large agent populations and sparse interactions favor optimistic methods
  • Telecommunications network simulation, modeling routing, congestion, and protocol behavior at scale
  • Parallel execution of agent-based social and economic models
  • High-energy physics event simulation, where independent particle trajectories can proceed in parallel
  • Real-time and accelerated simulation for training and mission rehearsal systems
Loading…