WorksComputer Science
One Behavior, Out of Order: Deterministic Execution and Parallel Simulation of ROS 2 Applications
Abstract
System-level simulation is widely used to validate robotic applications before hardware deployment. However, Robot Operating System 2 (ROS 2), a popular middleware for such applications, uses asynchronous publish-subscribe communication, which can make application behavior depend on scheduling and the platform. The behavior can then vary across runs and machines even with the same inputs. This nondeterminism makes faults hard to reproduce and tests unreliable. In this paper, we first give ROS 2 applications a lightweight coordination scheme in which every component, including event-driven ones, reads its inputs and writes its outputs at predefined time instants. By decoupling computation and communication, the scheme makes an application deterministic, that is, it always has one behavior for given inputs. Tests are thus repeatable, but for large applications they still take a long time. To speed up these tests, we then present an out-of-order parallel simulation algorithm. From the predefined read and write instants, it knows before the run which activations of components depend on which. It starts each activation as soon as those it depends on have finished. Finally, we implement the algorithm in a simulator that runs existing ROS 2 applications without any change to them or to ROS 2. We evaluate the simulator on industrial use cases and synthetic graphs. On the industrial use cases, it is up to 2.6 times faster than synchronous parallel simulation and needs an order of magnitude less memory for messages than asynchronous parallel simulation.
Introduction
Robot Operating System 2 (ROS 2) [1] is widely used in research and industry to build robotic systems, from mobile robots to automated vehicles. System-level simulation plays a pivotal role in their development, since developers can validate a whole application across many scenarios without the costly target hardware. However, the components of a ROS 2 application execute asynchronously and communicate with each other. The behavior of the application therefore depends on the execution times of its components, the communication delays and the scheduling. Their variation makes simulation results differ across runs, even when the application code and inputs remain unchanged [2, 3]. In the example of Figure 1, Planner computes a command every 20 ms from the latest objects that Detector found in the camera images. In run 2, a variation in the execution time of Detector leads Planner to compute the command at 40 ms from image 2 instead of image 3. If the command computed from image 2 causes a fault, the fault may not appear when the test is repeated, which makes it hard to reproduce. Developers may therefore need to rerun the same test many times to reproduce and diagnose the fault. This additional debugging effort slows development.

Figure 1. Running example. Detector’s execution time changes the behavior.
AUTOSAR solves this problem for automotive software with a rule by which every component reads its inputs and writes its outputs at predefined time instants, no matter when the computations run in between [4]. This separates computation from communication [5, 6], and the behavior of an application becomes independent of the scheduling and the platform. Following the same principle, our first step gives ROS 2 a lightweight coordination scheme that fixes when each component reads and writes, including event-driven components. Whenever a time-triggered or event-driven component is activated, it reads its inputs at that instant and writes its outputs after a fixed computation delay, even if they are empty. Every output arrives after a fixed transport delay. Since time-triggered components run periodically and the delays are fixed, all reads and writes happen at predefined time instants, as in AUTOSAR. The application therefore becomes deterministic and exhibits one behavior. Tests become repeatable, and application behavior can be validated independently of the target hardware.
However, system-level simulation still becomes time-consuming as applications and scenarios grow, slowing design iteration [7]. Even with one behavior, a recent simulator for ROS 2 applications runs all activations on a single thread, which its authors note increases the run time of complex simulations [8]. To further reduce the validation time, we therefore aim to exploit parallelism within a single simulation while preserving the application’s deterministic behavior. Yet general parallel discrete-event simulation cannot assume that event dependencies are known in advance, so it must preserve causality during the run, either synchronously or asynchronously. Synchronous parallel simulation stops all workers at a global barrier after each time instant or window [9], forcing fast workers to wait for the slowest one. Asynchronous parallel simulation avoids global barriers, either through optimistic execution, which needs state saving and rollback [10], or through conservative execution with null messages [11]. When fast producers run far ahead of their consumers, it can accumulate large buffers of unconsumed messages.
Out-of-order simulation needs none of these mechanisms if the dependencies between events are known. Existing out-of-order simulators derive them from a static analysis of the model or track them during the run [12, 13, 14]. Our key observation is that the coordination scheme already makes these dependencies known in advance, without any such analysis or tracking. The predefined read and write instants determine which outputs each activation reads. An activation therefore need not wait for all earlier activations. Its computation depends only on the activations whose outputs it reads and on the previous activation of the same component, whose updated state it needs. This allows activations of different components to run out of order and in parallel while preserving the one behavior of the application. Building on this observation, we present an out-of-order parallel simulation algorithm for ROS 2 applications. It computes the dependencies on demand from the application graph and the timing parameters, without constructing the full dependency graph. Because a producer may run ahead of its consumers, several outputs may need to be retained at the same time. To bound output buffering, the algorithm uses cyclic storage and allows a slot to be reused only after all readers of its previous contents have finished.
Together, the coordination scheme and the simulator make simulation-based validation of ROS 2 applications both repeatable and fast, which shortens each design iteration. The main contributions of this paper are as follows.
A lightweight coordination scheme that makes ROS 2 applications deterministic, so that their behavior does not depend on the scheduling or the platform (§ 2).
An efficient out-of-order parallel simulation algorithm that still computes the one deterministic behavior of an application (Section III). We show how to integrate it into ROS 2 so that it simulates existing applications without changing their source code or the libraries of ROS 2 (§ 4).
We evaluate our simulator on industrial use cases and synthetic graphs. On 256 cores, it is up to 228× faster than sequential simulation, which is 91 % of the theoretical speedup bound. Compared with synchronous parallel simulation, it is up to 2.6× faster on the industrial use cases and about 2× faster on the synthetic graphs. Its message buffers stay much smaller than those of asynchronous parallel simulation (§ 5).
System Model and Execution Semantics
We model a ROS 2 application as a graph and define our coordination scheme for deterministic execution.
System Model
From a logical perspective, a ROS 2 application is a set of nodes that communicate using the publish-subscribe paradigm [1]. Nodes publish messages on named topics and subscribe to topics to receive messages. A node maintains state in member variables and may have timers and subscriptions, each associated with a callback, a function invoked in response to an event. Timer callbacks are time-triggered, activated periodically, whereas subscription callbacks are event-driven, activated by incoming messages. Callbacks may update node state and publish messages that activate other callbacks, forming a network of topics and callbacks.1 In Figure 1(a), capture and plan are time-triggered, and detect and store are event-driven.
We model an application as a finite directed graph . Each vertex is a callback, and each edge is a communication channel. An event-driven callback has one input topic, the topic of its subscription. Every callback has a fixed finite output set , which contains the topics on which may publish. A pair is in if and only if is event-driven and its input topic is in .
The callbacks of one node form a task. Each task has a state with initial value , a list of time-triggered callbacks and a list of event-driven callbacks. The state models the member variables of the node, and only the callbacks of this task can read and update it. Each time-triggered callback has a period and an offset , and it is activated at the instants for . A callback of computes a function . Its inputs are the state , the current time and, if is event-driven, the incoming message. Its outputs are the new value of and the messages that publishes on the topics in . We assume that is deterministic, that is, its outputs depend only on its inputs.
Execution Semantics
To make the behavior of an application independent of the scheduling and the platform, we separate computation from communication by fixing the instants at which callbacks read their input messages and write their output messages. For this, every task has a computation delay and every channel has a transport delay , both predefined and fixed. Channels from callbacks of the same task to the same callback have the same transport delay.
Every callback releases a sequence of jobs. A job of a callback of , which we also call a job of , has a release instant and a write instant, which is later. It reads its input messages at its release instant and writes its output messages at its write instant, no matter when it runs in between. It writes them in records, one on every topic in the output set of its callback. A record holds the messages that the job publishes on its topic, in the order in which it publishes them. It is empty if the job publishes nothing on the topic, for example because its callback publishes only for some inputs.
A time-triggered callback releases a job at every instant at which it is activated. A record that a job of writes on the input topic of enters the channel when it is written and arrives at at its arrival instant, which is later. At this instant it releases a job of , and only this job consumes its contents, that is, removes it from the channel and reads its messages. Since is fixed, every channel is a first-in first-out queue of records. An empty record releases a job like any other record, so whether a job is released does not depend on what the callbacks compute.
In ROS 2, the executor decides in which order the ready callbacks of a node run, and the default executor runs timer callbacks first [16, 17]. We fix this order by a rule of our own. All jobs of form one sequence in the order of their release instants, and denotes the -th of them. For jobs with the same release instant, jobs of time-triggered callbacks come first, in the order of , and jobs of event-driven callbacks follow, in the order of . Jobs of the same event-driven callback are ordered by the jobs that wrote their records, first by the index of the task and then by the index of the job.
The jobs of run one after the other in this sequence. Each job starts from the state that the previous job left, even if it is released before the previous job writes, and the first job starts from . Whenever a job reads the current time, it gets its release instant. A job of a time-triggered callback calls once. A job of an event-driven callback calls once for each message of the record that it consumes, in the order of the messages. If this record is empty, the job is skipped, that is, it calls nothing, keeps the state and writes only empty records. So, an empty record comes from a job that publishes nothing on a topic or from a skipped job.
Example 1. Figure 2(a) shows the graph of the application of Figure 1(a), with , , and for capture, detect, store and plan. The output sets are , , and . The input topics of and are /img and /obj, so has only and . The state holds latest, which writes and reads. ◇

Figure 2. Graph model, execution timeline and job dependencies of the running example. (a) Circles are callbacks, with a double line if they are time-triggered. Arrows are channels, boxes are tasks, and the grey box is the state of . (b) A light bar spans from the release instant to the write instant of a job, and an arrow goes from the write of a record to its arrival. Darker boxes show when the jobs run in one run. The dashed record is empty and releases the skipped job . (c) Grey arrows are state dependencies and black arrows are record dependencies.
Example 2. Figure 2(b) shows the jobs of the running example with the parameters of Figure 2(a). Job , released at 30 ms, runs in two pieces but still writes its record on /obj at $30 + D_2 = 55$ ms. This record arrives at ms and releases , which stores the detection in . The next job of is released at 60 ms, so it computes its command from this detection in every run. Job $J_{2,3} finds no object, so its record is empty and the job that it releases is skipped. ⋄
Determinism
Theorem 1. The jobs, their release and write instants, their order in each task and which record each job reads depend only on the application graph model, the tasks, the periods, the offsets and the delays. The states and the records depend in addition only on the initial states and the functions . So the behavior of the application, that is, its non-empty records with their write instants, depends neither on the scheduling nor on the platform.
Proof. Jobs are released only at predefined instants, so we use induction on the release instant . Since , a job released at is released by a time-triggered callback or by a record of a job released before , and this record is written whether it is empty or not. So the jobs released at , their order and the records that they read do not depend on what the callbacks compute. We take the jobs of each task in the order of its sequence. Their inputs then depend only on the initial states and on the outputs of jobs that come before them, and so do their outputs, since every is deterministic. □
Discussion
The main benefit of empty records is that the jobs and their dependencies are known before the run, as Theorem 1 states. Without them, a callback that publishes only for some inputs would release jobs of other callbacks only for these inputs, so the jobs would depend on the computed values. With them, every job depends only on the previous job of its task and on the job that wrote the record that it consumes, and both come before it. So the dependencies form a directed acyclic graph, even if the application graph model has cycles. Figure 2(c) shows this graph for the running example. Section III shows how to run jobs out of order and in parallel by computing their dependencies from the parameters, without building the graph.
Out-of-Order Parallel Simulation
As discussed in Section II-D, the dependencies between jobs form a directed acyclic graph. A simulation that runs the jobs in a topological order of this graph is correct, that is, every job writes the same records as in the semantics of Section II-B. So a simulator can run jobs out of the order of their release instants and in parallel, as long as every job starts only after the jobs that it depends on have finished.
Example 3. In Figure 2(c), depends, directly or through other jobs, only on , , , and . So the simulator can run in parallel with , or even finish it before starts, although is released at 60 ms and at 30 ms. ⋄
Activation Streams
To execute jobs in a topological order, the simulator needs to identify their dependencies. We can compute these dependencies on demand using only the application graph model parameters, without constructing or storing the full job dependency graph. To this end, we group the jobs into periodic sequences, in which the record and state dependencies of a job (Fig. 2(c)}) follow from its position.
A time-triggered callback releases a job in every period. Each of these jobs writes a record on every topic in its output set, empty or not, and after fixed delays each record releases one job of every callback that receives it. These jobs are periodic as well, with the same period and a later offset, and so are the jobs that their records release. We call such a periodic sequence of jobs an activation stream. A stream has a period and an offset , and its -th job , with , is released at . Every time-triggered callback has a root stream with period and offset . For each channel , every stream of callback in task has a child stream of callback . The child stream has period and offset . We call the parent of . Job consumes the record written by , so is its record dependency.
Assume that we simulate the jobs released in the interval , for a given . Since , a child stream has a later offset than its parent, so only finitely many streams have an offset before . Such a stream has jobs in .
The state dependency of a job is the previous job in the sequence of its task. This sequence merges the jobs of all streams of the task and orders them by release instant, which gives. Jobs of a task with the same release instant belong to different streams. To order them, we give every stream of with an offset before a rank , its position in the following order, which follows the rule of Section II-B. Root streams come first, in the order of . Child streams follow, ordered by the position of their callback in , then by the index of the task of their parent, and then by the rank of their parent. This is not circular, since a parent has an earlier offset than its child. The key of is , compared first by release instant and then by rank. By the following lemma, the keys give the sequence of the task, so the state dependency of a job is the job of the same task with the next smaller key.
Lemma 1. Every job released in is the job of one stream and one . In the order of their keys, the jobs of released in are the first jobs of its sequence.
Proof. By induction on the release instant, every job is in one stream, since it is released by a time-triggered callback or by the record of one earlier job. The ranks follow the rule of Section II-B, with the parents of two streams in place of the jobs that wrote the records. When these jobs are in the same task, their channels have the same transport delay, so they have the same release instant, and by induction their order is the order of the ranks of the parents.
Example 4. With ms, the running example has four streams. The root stream of has period and offset 10 ms, and its child is a stream of with offset 20 ms. The child of is a stream of with offset ms. The root stream of has period and offset 20 ms. In , has rank 1 and has rank 2, so the keys , , , , , give . ◇
Bounded Record Storage
With the dependencies of Section III-A, the simulator can run jobs out of order. The remaining issue is storage. A stream can then run far ahead of its children, that is, many of its jobs finish before the jobs that consume their records start. The simulator must store these records in the meantime, and their number is bounded only by the number of jobs of the stream, which grows with . To bound it, every stream keeps its records in a ring with a fixed number of slots, which its jobs reuse in turn. A job that reuses a slot must then wait until the records in it have been consumed. This adds a third kind of dependency. If the dependencies had a cycle, the jobs on it would wait for each other, and none of them could start. So we first define the rings and then choose their size such that the dependencies still form a directed acyclic graph.
Let the ring of a stream have slots. Each slot holds the records of one job. Job writes its records into slot . For , it replaces the records of . These records are consumed by the jobs of the children of , which we call the slot dependencies of . So can start only after its slot dependencies have finished.
The dependencies stay acyclic if every slot dependency of a job is released before the job. Let be a stream of a callback of , and let be the largest transport delay of the channels to its children, or 0 if it has no children. The records of arrive at most after its release, and they release the slot dependencies of when they arrive. Job is released after , so we need and choose
The second term is the smallest such number, and the term 2 lets a stream run at least one job ahead of its children.
Lemma 2. Every slot dependency of a job is released before the job.
Proof. The slot dependency of , with on a channel , is released at , which is before by (1). □
So every dependency of a job is released before it or comes before it in its task, and the dependencies still form a directed acyclic graph.
Example 5. In Example 4, and . So , released at 50 ms, reuses the slot of , and its slot dependency is , released at 49 ms. Job , also released at 50 ms, waits for no job of , directly or through other jobs, so it can run before , which is released at 20 ms. ◇
The Simulation Algorithm
By Sections III-A and III-B, a job can start when its state, record and slot dependencies have finished. Algorithm 1 runs the jobs in this way on a pool of worker threads. It has to find the jobs that can start and to make sure that each of them runs only once. It does both without a list of jobs.
Every child stream has one parent, so the streams form trees whose roots are the root streams. Before the run, the simulator searches these trees breadth first and keeps the streams with an offset before . It skips the children of all other streams, so the search always ends. The simulator then computes the ranks and the ring sizes. To find the next job of each task efficiently during the run, each task keeps the next job of each of its streams in a heap ordered by key. By Lemma 1, the first job in the heap is the next job of the task. The heap has at most one entry per stream, so no list of jobs is stored.
Each task also has three values. Workers read and write them and the next job of the task atomically, in total order. The completion count is the number of its finished jobs, and the completion key is the key of its last finished job. The jobs of a task finish in the order of their keys, so a job of has finished if and only if its key is at most . One can compare completion keys to tell whether a dependency has finished. To run every job only once, a worker must claim a job before it runs it, and the claim count is the number of claimed jobs of . TRYENQUEUE looks only at the next job of , since the jobs of a task run in the order of its sequence. If , no job of is claimed and unfinished, so the state dependency of has finished (line 3). Lines 5 and 6 check its record dependency and its slot dependencies . If all have finished, the worker claims by a compare-and-swap (CAS) that changes from to and fails if another worker has claimed a job of in the meantime (line 7). It then pushes the job onto its local double-ended queue (deque).
Each worker takes the jobs from its local deque one at a time. When its deque is empty, it steals a job from the deque of another worker, which balances the load among the workers (work stealing [18]). It runs a job of in the semantics, with its release instant as the current time, and writes its records into slot . It then replaces in the heap by if , sets the next job of , sets to and increases , in this order, so that a worker that reads the new also reads the new next job. After that, the next job of , a job that consumes a record of , or a job that reuses a slot whose records consumed start and to make sure that each of them runs only once. It does both without a list of jobs.
Algorithm 1: Out-of-order parallel simulation.
procedure TRYENQUEUE
if or has no next job then return
the next job of
if has a parent in and then return
if and has a child in with then return
if CAS then push onto the local deque
procedure WORKER()
while some task has a next job do
a job from the local deque or a stolen job
if there is no such job then continue
run of and write its records into slot
replace in the heap of by , or remove it if
set the next job of to the first job in its heap, if any
if , then
for and every with a parent or a child of a stream of do TRYENQUEUE
initialize , , the heaps and the next jobs
call TRYENQUEUE for every task
run WORKER on every worker in parallel
may be able to start. So the worker calls TRYENQUEUE for and for every task that has a child or a parent of a stream of . Because of the total order, the worker that finishes the last dependency of a job sees that all of them have finished, so no job is missed. The dependencies form a directed acyclic graph, so every job then runs once, and the simulation cannot deadlock.
Complexity. Let be the number of streams of , and let be the largest number of channels that enter or leave the callbacks of one task. After a job of has run, the worker performs one heap operation in time and calls TRYENQUEUE for at most tasks. Each call compares one pair of keys per dependency of the next job, in time.
ROS 2 Integration
We implemented the simulator of Section III as a lightweight layer for ROS 2 Jazzy.2
ROS 2 is organized in layers [1]. Figure 3 shows them together with our simulator. The nodes are written with a client library, which is rclcpp for C++ [17]. It provides the timers, the subscriptions, the publishers and the ROS clock of a node, and its executors decide when the callbacks run [16]. Below it, the C library rcl passes a published message through the interface rmw to the middleware, which delivers it to the subscriptions of the topic [19]. The middleware is usually an implementation of the Data Distribution Service (DDS) [20].

Figure 3. Our simulator with ROS 2.
Our simulator is directly below rclcpp. To simulate the application as in the semantics of § 2-B, it runs the callbacks, carries the messages and gives the time itself. To run a job, a worker of Algorithm 1 calls its callback through the timer, or through the subscription once for every message of the consumed record, so no executor is started. To take the published messages and to give the time, the simulator defines its own versions of the functions of rcl that publish a message and that read the ROS clock. They are part of the executable that loads the nodes, so rclcpp calls them in place of the ones in rcl, which stays unchanged. A published message is then stored in serialized form in the slot of the running job, and the ROS clock returns the release instant of this job. The simulator also turns off the direct delivery of messages inside one process, so that every message goes through a record. The rest of ROS 2 is used as it is, without any change.
Using the simulator takes little effort. The user does not write the application graph model of § 2-A, because the simulator reads it from the nodes themselves. It finds the timers and subscriptions of every node and connects publishers and subscriptions by topic name and message type. It loads the nodes from their existing shared libraries, so they need no recompilation, or it creates them by the functions that construct them. Besides the application, the simulator only needs the delays, which the user gives in files.
Evaluation
Setup
Workloads and simulators. We evaluate our simulator on three industrial use cases, the Autoware reference system (RS) [21], fleets of vehicles built from RS (Fleet-), and a stereo vision pipeline (Stereo) [22, 23]. RS is a ROS 2 benchmark modeled on the autonomous driving software Autoware. Fleet- runs copies of RS as vehicles that exchange detected objects, with different timer offsets. Stereo runs the stereo vision nodes of image pipeline on recorded camera frames. We also evaluate 1385 synthetic graphs, including randomly generated ROS 2 graphs and those derived from automotive benchmarks [6, 24].
We compare our simulator with sequential simulation, with the synchronous parallel simulations Sync-I and Sync-W, and with the asynchronous parallel simulation Async. Sequential simulation runs one job at a time. Sync-I and Sync-W run the jobs released in a time window in parallel and wait at a global barrier at its end [9]. Sync-I runs in parallel only the jobs released at the same instant, and waits at a barrier before the next instant. Sync-W has windows as long as the smallest computation delay, so that the jobs of different tasks in a window do not depend on each other. Async is a conservative simulation with null messages and without global barriers [11, 25]. In Async, a task runs its next job as soon as it knows all records that the job reads, and an optional lead bounds how far a task may run ahead of its readers.
Parameters and measurements. We ran all simulators on ROS 2 Jazzy on a machine with two AMD EPYC 9755 processors and 256 cores, with each worker pinned to one core. The computation delay of a node is its smallest timer period, or, if it has no timers, the smallest computation delay of the nodes that publish to it.
We measure how fast each simulator is and how many messages it holds. The speedup of a simulator is the time of sequential simulation divided by its time. To see how much of the parallelism of a workload a simulator uses, we compare its speedup with a bound that depends only on the workload. Let be the total computation time of all jobs and that of the longest chain of jobs in which each job needs the state or a record of the job before it, both measured in sequential simulation. The jobs of such a chain run one after another, so any simulator takes at least , and workers take at least . The speedup on workers is therefore at most , which we call the bound. The ratio is the average number of jobs that the workload can run at the same time. This ratio is 3.7 for RS and 7.9 for Stereo, and it grows in proportion to the number of vehicles in the fleets, up to 252 for Fleet-64. The message bytes of a simulator are the most bytes of messages that it holds at one time.
Results
Speedup. On Fleet-8, our simulator follows the bound and is 29.1 times faster than sequential simulation on 32 workers, which is 93 % of the bound (Figure 4(a)). Sync-W reaches 14.6, and Sync-I stays below 3, because the vehicles have different offsets and few jobs share an instant. When all vehicles have offset 0, Sync-I and Sync-W reach speedups of 15.1 and 18.0, and our simulator reaches 28.9. Aligning the release instants therefore improves the speedup of synchronous simulation, while the speedup of our simulator stays almost the same. With transport delays of 0 to 100 ms between the vehicles of Fleet-8, our simulator stays between 29.0 and 30.9 times faster than sequential simulation on 32 workers. RS and Stereo have bounds of only 3.7 and 7.9 (Figure 4(b)). Our simulator reaches the bound of RS on 4 workers, where Async and Sync-W reach 2.8 and 2.5. On Stereo, it reaches 6.7, and Async reaches 7.4.

Figure 4. Speedup over sequential simulation and message bytes on the industrial use cases.
Scaling. On the whole machine, Fleet-64, with 1600 nodes and 566 353 jobs in 10 s, takes 228 s in sequential simulation (Figure 4(c)). Our simulator takes 1.0 s on 256 workers, so it is 228 times faster, which is 91 % of the bound of 252. Sync-W reaches 89, so our simulator is 2.6 times faster. In every window, Sync-W waits for the task with the most work, and our simulator does not.
Message bytes. Sync-W holds as many message bytes as our simulator, or 1.5 times as many on Stereo, but Async holds 12 to 42 times as many, since a task of Async can run far ahead of its readers and its records then wait in queues (Figure 4(d)). On Stereo, Async is about as fast, but it holds up to 6.3 GB of messages at one time, while our simulator holds at most 0.5 GB. A lead bounds the queues, but it has to be chosen for each workload (Figure 5(b)). On Fleet-8, Async without a lead is 1.4 times slower and holds 35 times as many message bytes, while leads from 25 to 200 ms make it as fast as our simulator with 1.4 to 2.9 times its message bytes.

Figure 5. (a) Speedup of the synthetic graphs, with medians as lines. (b) Time and message bytes of Async with leads, relative to ours. Both on 32 workers.
Synthetic graphs. Figure 5(a) shows the speedups of our simulator and Sync-W on the synthetic graphs with 32 workers, plotted against the average number of jobs in a nonempty window of Sync-W. If all jobs take the same time, the speedup of Sync-W is at most . Across all 1385 synthetic graphs, our simulator is 1.98 times as fast as Sync-W on average (geometric mean). Async is about as fast as our simulator but holds 45 times as many message bytes. With leads of 0.25 to 8 times the longest timer period, Async still holds 2.2 to 27 times as many message bytes (Figure 5(b)).
Related Work
Safety-critical embedded systems need behavior that is deterministic and predictable [3]. The time-triggered architecture was designed for this, with computation and communication at predefined time instants [26]. Henzinger et al. developed this idea into the logical execution time (LET) [27], which our coordination scheme follows. AUTOSAR supports LET [4]. LET fixes the instants of reads and writes on one machine, but messages between machines take a varying time. System-level LET [28] therefore gives the communication between machines a fixed delay, as our transport delays do. The Adaptive Platform of AUTOSAR [29] comes closest to ROS 2, since its applications also run on POSIX and communicate by publish and subscribe. Menard et al. show that it is not deterministic by itself and add a coordination layer to it [30]. Bellassai et al. instead bring system-level LET to it [31] and to its publish-subscribe communication [32]. In both works, LET applies only to time-triggered tasks. Our scheme also applies to event-driven callbacks. An empty record tells such a callback that no message comes. In this way, the absence of a message also carries information, as Lamport observed for bounded message delays and synchronized clocks [33].
Three recent approaches make the simulation or the execution of ROS 2 applications deterministic. Sagmeister et al. run the callbacks of all nodes sequentially on a single thread with a simulated clock [8]. Otto uses an orchestrator that forwards the messages between nodes in an order that it builds during the run [34]. Teper et al. map a ROS 2 application to Lingua Franca [35], a coordination language based on the deterministic reactor model [36]. Each node becomes a reactor, a component that reacts to timestamped events, and each callback becomes one of its reactions. The runtime of Lingua Franca then calls the unmodified callbacks in timestamp order. Kwok et al. instead build a robotic middleware on Lingua Franca to replace ROS 2, and show how to move ROS 2 programs to it [37]. Although Lingua Franca can also express LET [38], its runtime is synchronous by default and completes all reactions at one timestamp before it advances to the next. By default, none of the three runs callbacks of different timestamps in parallel, since a callback may or may not publish and which callback runs next is known only during the run. With empty records, the jobs and their dependencies are known before the run, so our simulator runs jobs out of order and in parallel. An empty record plays the role of a null message in conservative parallel simulation [11, 25], but it is part of our coordination scheme and not an extra message of the simulator.
Henzinger and Kirsch describe semantics-preserving compilation of LET programs for a single processor [39]. Biondi and Di Natale implement LET on multicore platforms [40]. We use LET to coordinate ROS 2 callbacks, defining the application behavior that our simulator reproduces. The final step would be to generate code that preserves validated behavior on the target platform.
Conclusion
We have shown that fixing when every callback reads and writes makes a ROS 2 application deterministic. With empty records, it also fixes the jobs and their dependencies before the run. Based on this, our simulator runs the jobs out of release order and in parallel. It reached 91 % of the theoretical speedup bound on 256 cores. Our coordination scheme currently does not support several publishers of one node on the same topic or applications whose structure changes during a run, and both are worth addressing in the future.
References
- [1]S. Macenski, T. Foote, B. Gerkey, C. Lalancette, and W. Woodall, “Robot Operating System 2: Design, architecture, and uses in the wild,” Sci. Robot., vol. 7, no. 66, p. eabm6074, 2022.DOI
- [2]E. A. Lee, “The problem with threads,” Computer, vol. 39, no. 5, pp. 33–42, 2006.DOI
- [3]———, “Determinism,” ACM Trans. Embedded Comput. Syst., vol. 20, no. 5, pp. 38:1–38:34, 2021.
- [4]AUTOSAR, “Specification of timing extensions,” Classic Platform, Release R22-11, 2022. [Online]. Available: https://www.autosar.org/fileadmin/standards/R22-11/CP/AUTOSAR_TPS_TimingExtensions.pdf
- [5]K. Keutzer, S. Malik, A. R. Newton, J. M. Rabaey, and A. Sangiovanni-Vincentelli, “System-level design: Orthogonalization of concerns and platform-based design,” IEEE Trans. Comput.-Aided Design Integr. Circuits Syst., vol. 19, no. 12, pp. 1523–1543, 2000.DOI
- [6]A. Hamann, D. Dasari, S. Kramer, M. Pressler, and F. Wurst, “Communication centric design in complex automotive embedded systems,” in Proc. Euromicro Conf. Real-Time Systems (ECRTS), 2017.DOI
- [7]V. Antinyan, “Revealing the complexity of automotive software,” in Proc. ACM Joint European Software Engineering Conf. and Symp. Foundations of Software Engineering (ESEC/FSE), 2020.DOI
- [8]S. Sagmeister, M. Weinmann, P. Pitschi, and M. Lienkamp, “RSLCPP—Deterministic simulations using ROS 2,” IEEE Robot. Autom. Pract., vol. 1, pp. 118–122, 2026.DOI
- [9]R. M. Fujimoto, Parallel and Distributed Simulation Systems. Wiley, 2000.
- [10]D. R. Jefferson, “Virtual time,” ACM Trans. Program. Lang. Syst., vol. 7, no. 3, pp. 404–425, 1985.DOI
- [11]K. M. Chandy and J. Misra, “Distributed simulation: A case study in design and verification of distributed programs,” IEEE Trans. Softw. Eng., vol. SE-5, no. 5, pp. 440–452, 1979.DOI
- [12]W. Chen, X. Han, C.-W. Chang, G. Liu, and R. Dömer, “Out-of-order parallel discrete event simulation for transaction level models,” IEEE Trans. Comput.-Aided Design Integr. Circuits Syst., vol. 33, no. 12, pp. 1859–1872, 2014.DOI
- [13]J. E. Jansen, J. Leathrum, Jr., C. Lynch, K. Smith, and R. Gore, “Out of order and causally correct: Ready-event discovery through data-dependence analysis,” in Proc. ACM SIGSIM Conf. Principles of Advanced Discrete Simulation (SIGSIM-PADS), 2025.DOI
- [14]Z. Xie, H. Kang, Y. Sheng, T. Krishna, K. Fathalian, and C. Koykrizis, “AI Metropolis: Scaling large language model-based multi-agent simulation with out-of-order execution,” in Proc. Conf. Machine Learning and Systems (MLSys), 2025.arxiv.org/abs/2411.03519
- [15]Open Robotics, “Using callback groups,” ROS 2 Jazzy documentation, accessed: Nov. 18, 2026. [Online]. Available: https://docs.ros.org/en/jazzy/How-To-Guides/Using-callback-groups.html
- [16]———, “Executors,” ROS 2 Jazzy documentation, accessed: Nov. 18, 2026. [Online]. Available: https://docs.ros.org/en/jazzy/Concepts/Intermediate/About-Executors.html
- [17]———, “rclcpp,” GitHub repository, branch jazzy, accessed: Nov. 18, 2026. [Online]. Available: https://github.com/ros2/rclcpp/tree/jazzy
- [18]R. D. Blumofe and C. E. Leiserson, “Scheduling multithreaded computations by work stealing,” J. ACM, vol. 46, no. 5, pp. 720–748, 1999.
- [19]Open Robotics, “rcl,” GitHub repository, branch jazzy, accessed: Nov. 18, 2026. [Online]. Available: https://github.com/ros2/rcl/tree/jazzy
- [20]Object Management Group, “Data Distribution Service (DDS), version 1.4,” OMG document formal/15-04-10, 2015. [Online]. Available: https://www.omg.org/spec/DDS/1.4
- [21]ROS 2 Real-Time Working Group, “reference-system,” GitHub repository, commit de8f3bc, accessed: Nov. 18, 2026. [Online]. Available: https://github.com/ros-realtime/reference-system
- [22]ROS Perception, “image_pipeline,” GitHub repository, accessed: Nov. 18, 2026. [Online]. Available: https://github.com/ros-perception/image_pipeline
- [23]NVIDIA, “r2b dataset 2024,” NGC catalog, accessed: Nov. 18, 2026. [Online]. Available: https://catalog.ngc.nvidia.com/orgs/nvidia/teams/isaac/resources/r2bdataset2024
- [24]S. Kramer, D. Ziegenbein, and A. Hamann, “Real world automotive benchmarks for free,” in Proc. Int. Workshop Analysis Tools and Methodologies for Embedded and Real-Time Systems (WATERS), 2015.
- [25]R. M. Fujimoto, “Parallel discrete event simulation,” Commun. ACM, vol. 33, no. 10, pp. 30–53, 1990.
- [26]H. Kopetz and G. Bauer, “The time-triggered architecture,” Proc. IEEE, vol. 91, no. 1, pp. 112–126, 2003.
- [27]T. A. Henzinger, B. Horowitz, and C. M. Kirsch, “Giotto: A time-triggered language for embedded programming,” Proc. IEEE, vol. 91, no. 1, pp. 84–99, 2003.
- [28]K.-B. Gemlau, L. Köhler, R. Ernst, and S. Quinton, “System-level logical execution time: Augmenting the logical execution time paradigm for distributed real-time automotive software,” ACM Trans. Cyber-Phys. Syst., vol. 5, no. 2, pp. 14:1–14:27, 2021.DOI
- [29]AUTOSAR, “Explanation of Adaptive Platform design,” Adaptive Platform, Release R24-11, 2024. [Online]. Available: https://www.autosar.org/fileadmin/standards/R24-11/AP/AUTOSAR_AP_EXP_PlatformDesign.pdf
- [30]C. Menard, A. Goens, M. Lohstroh, and J. Castrillon, “Achieving determinism in Adaptive AUTOSAR,” in Proc. Design, Automation and Test in Europe Conf. (DATE), 2020.arxiv.org/abs/1912.01367
- [31]D. Bellassai, G. Sciangula, C. Scordino, D. Casini, and A. Biondi, “Modeling the SL-LET paradigm in AUTOSAR Adaptive,” in Proc. Design, Automation and Test in Europe Conf. (DATE), 2025.DOI
- [32]D. Bellassai, C. Scordino, D. Casini, and A. Biondi, “AP-LET: Enabling deterministic pub/sub communication in AUTOSAR Adaptive,” J. Syst. Archit., vol. 162, p. 103390, 2025.DOI
- [33]L. Lamport, “Using time instead of timeout for fault-tolerant distributed systems,” ACM Trans. Program. Lang. Syst., vol. 6, no. 2, pp. 254–280, 1984.DOI
- [34]J. Otto, “Enabling reproducibility in ROS 2 by ensuring sequence deterministic callback execution,” Master’s thesis, Ulm University, 2023.
- [35]H. Teper, S. Lin, S. Li, E. A. Lee, and J.-J. Chen, “Deterministic execution of ROS 2 applications via Lingua Franca,” arXiv:2606.09203, 2026.arxiv.org/abs/2606.09203
- [36]M. Lohstroh, C. Menard, S. Bateni, and E. A. Lee, “Toward a Lingua Franca for deterministic concurrent systems,” ACM Trans. Embedded Comput. Syst., vol. 20, no. 4, pp. 36:1–36:27, 2021.DOI
- [37]J. Kwok, S. Li, M. Lohstroh, and E. A. Lee, “HPRM: High-performance robotic middleware for intelligent autonomous systems,” in Proc. IEEE Int. Conf. Robotics and Automation (ICRA), 2025.arxiv.org/abs/2412.01799
- [38]E. A. Lee and M. Lohstroh, “Generalizing logical execution time,” in Principles of Systems Design, ser. LNCS. Springer, 2022, vol. 13660, pp. 160–181.DOI
- [39]T. A. Henzinger and C. M. Kirsch, “The embedded machine: Predictable, portable real-time code,” in Proc. ACM SIGPLAN Conf. Programming Language Design and Implementation (PLDI), 2002.
- [40]A. Biondi and M. Di Natale, “Achieving predictable multicore execution of automotive applications using the LET paradigm,” in Proc. IEEE Real-Time and Embedded Technology and Applications Symp. (RTAS), 2018.DOI