A ROS 2 Executor is the processing engine within a ROS 2 node that manages the execution of callbacks from its subscriptions, timers, services, and action servers. It spins in a loop, waiting for work from these entities and invoking the appropriate user-defined callback functions. The executor is responsible for the fundamental task scheduling within a node, determining when and in what order callbacks are processed, which directly impacts system responsiveness and real-time performance.
Glossary
ROS 2 Executor

What is a ROS 2 Executor?
A core processing engine within a ROS 2 node that manages the execution of callbacks from subscriptions, timers, services, and action servers.
Executors come in different types, primarily SingleThreadedExecutor and MultiThreadedExecutor, which define the concurrency model for callback execution. The executor's behavior is further refined by configurable callback groups, which allow developers to isolate callbacks for priority or mutual exclusion. This architecture provides fine-grained control over the node's computational resources, enabling the design of deterministic, low-latency control loops essential for real-time robotic control systems.
Key Features of a ROS 2 Executor
A ROS 2 Executor is the processing engine within a node that manages the execution of subscriptions, services, timers, and action servers. Its design directly impacts the determinism, performance, and resource utilization of a robotic system.
Callback Scheduling and Spin
The core function of an executor is to spin, which is the process of waiting for and then executing callbacks. It monitors all associated entities (e.g., subscriptions, timers) for readiness. When a timer fires or a message arrives on a subscription, the executor places the corresponding callback into a queue for execution. The spin() or spin_once() methods are called to process this queue, executing callbacks in a controlled, single-threaded loop. This centralizes the flow of control, preventing callback race conditions within a node.
Executor Types
ROS 2 provides several executor implementations, each with distinct concurrency models:
- SingleThreadedExecutor: The default. Processes all callbacks sequentially in a single thread. Simple and deterministic but can lead to callback latency if one callback blocks.
- MultiThreadedExecutor: Uses a thread pool to execute multiple ready callbacks concurrently. Increases throughput but introduces complexity from potential race conditions between callbacks.
- StaticSingleThreadedExecutor: An optimized version of the single-threaded executor with lower overhead, as it discovers all entities once at configuration time. Ideal for performance-critical, static node graphs.
Integration with the DDS Layer
The executor works in tandem with the underlying Data Distribution Service (DDS) middleware. The DDS layer is responsible for the actual network communication: discovery, message queuing, and delivery based on Quality of Service (QoS) policies. The executor's role is to pull these delivered messages from the DDS's local queues and invoke the user-provided callback functions. This separation allows the executor to focus on application-level scheduling while DDS handles reliable, real-time data distribution.
Determinism and Real-Time Considerations
For real-time robotic control, executor behavior must be predictable. Key factors include:
- Callback Priorities: Executors themselves do not implement priorities; priority is managed at the OS thread level using real-time scheduling policies (e.g.,
SCHED_FIFO). - Callback Duration: A long-running callback can starve other callbacks, breaking real-time guarantees. Callbacks must be designed to be non-blocking and short.
- Spin Behavior:
spin_once()allows explicit control over when callbacks are processed, enabling integration into custom, deterministic control loops.
Composition with Nodes and Components
An executor is not tied to a single node. A key architectural pattern is node composition, where one executor can spin multiple nodes. This is essential for ROS 2 Components, which are node-like objects compiled into shared libraries. A component container loads these libraries and spins them with an executor, allowing multiple functional units to run in a single process. This reduces inter-process communication overhead and is critical for high-performance, embedded systems.
Common Patterns and Best Practices
Effective use of executors follows established patterns:
- One Executor Per Process: Typically, a main thread creates and spins one executor for all nodes in that process.
- Separation of Concerns: Use separate executors (and often separate threads/processes) for distinct system parts: a high-frequency control loop on a real-time executor, and a slower planning node on a standard executor.
- Avoiding Blocking Calls: Never call long-running or blocking functions (e.g., network I/O, long sleeps) inside a callback. Use asynchronous operations or delegate work to separate threads.
- Using Timers for Periodic Work: For periodic tasks, use a ROS Timer callback instead of a
whileloop withsleep, as it integrates cleanly with the executor's scheduling.
How the ROS 2 Executor Works
The Executor is the processing engine at the heart of every ROS 2 node, responsible for scheduling and executing callbacks.
A ROS 2 Executor is a processing engine within a node that manages the execution of subscriptions, services, timers, and action servers by spinning callbacks in a single-threaded or multi-threaded manner. It continuously checks for ready work—like an incoming message on a topic or an expired timer—and dispatches the associated user-defined callback function. This abstraction decouples communication from computation, allowing developers to focus on task logic while the Executor handles concurrency and scheduling.
Executors are configurable, with the SingleThreadedExecutor processing all callbacks sequentially on one thread, and the MultiThreadedExecutor using a thread pool for parallel execution. The choice impacts determinism and performance. The Executor's core loop involves waiting on the underlying Data Distribution Service (DDS) middleware for notifications, then executing ready callbacks based on a scheduling policy like FIFO or priority. This design is central to building responsive, real-time robotic systems within the ROS 2 framework.
ROS 2 Executor Types: Comparison
A comparison of the primary executor types available in ROS 2, detailing their threading models, use cases, and key behavioral characteristics for deterministic system design.
| Feature / Characteristic | SingleThreadedExecutor | MultiThreadedExecutor | StaticSingleThreadedExecutor |
|---|---|---|---|
Primary Threading Model | Single-threaded, sequential | Thread pool (default size = number of CPU cores) | Single-threaded, static |
Callback Execution | Strictly sequential, FIFO order within priority levels | Concurrent across available threads | Strictly sequential, deterministic order |
Determinism & Predictability | High (explicit execution order) | Low (subject to OS thread scheduling) | Highest (compile-time static schedule) |
Use Case Archetype | Simple nodes, strict sequencing requirements | High-throughput nodes, independent callbacks | Hard real-time, safety-critical systems |
Inter-Callback Data Sharing | Safe (no concurrent access) | Requires explicit synchronization (e.g., mutexes) | Safe (no concurrent access) |
Default Availability | Core rclcpp & rclpy | Core rclcpp & rclpy | rclcpp only (as of Humble) |
Runtime Overhead | < 1 ms | 1-5 ms (thread management) | < 0.5 ms |
Priority-Based Scheduling | |||
Spin Behavior | Blocks until work is available | Blocks until work is available | Blocks until work is available |
Integration with Component Nodes | |||
Recommended for Real-Time Systems | Conditionally (with careful design) |
Frequently Asked Questions
The ROS 2 Executor is the core processing engine that manages the execution of callbacks within a node. This FAQ addresses common questions about its architecture, configuration, and best practices for building responsive robotic systems.
A ROS 2 Executor is a processing engine within a ROS 2 node that manages the execution of subscriptions, services, timers, and action servers by spinning their associated callbacks in a single-threaded or multi-threaded manner. It works by continuously checking for ready-to-execute entities (e.g., a new message on a subscribed topic, a timer firing, or a service request arriving) from a collection assigned to it. When an entity is ready, the executor retrieves it from its wait set, acquires a lock, and invokes the corresponding user-defined callback function. The executor's primary loop (spin) blocks until work is available, executes it, and then repeats, forming the fundamental event-driven execution model of a ROS 2 application. Its behavior is critical for deterministic real-time robotic control systems.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
The ROS 2 Executor operates within a broader architecture of real-time communication and node management. These related concepts define its operational context and complementary mechanisms.
ROS 2 Node
A ROS 2 Node is the fundamental executable process that contains the Executor. It is the primary unit of computation in a ROS 2 graph. The Executor's sole purpose is to manage the callbacks (for subscriptions, timers, services, etc.) owned by its node.
- Primary Container: The node provides the callbacks; the executor runs them.
- Single-Threaded Model: A default, single-threaded executor spins within the node's main thread.
- Multi-Node Executors: A MultiThreadedExecutor can be shared across multiple nodes to co-locate their processing.
ROS 2 Quality of Service (QoS)
ROS 2 Quality of Service (QoS) policies govern when and if messages are delivered between nodes. The Executor's scheduling is directly impacted by the QoS profiles of the subscriptions it manages.
- Deadline Policy: Defines the expected maximum period between messages. The executor must schedule callbacks fast enough to meet these deadlines.
- Liveliness Policy: Ensures publishers are active. The executor's responsiveness affects a node's ability to assert its liveliness.
- History & Depth: Determines how many messages are queued for a subscription before the executor processes them, directly affecting memory and latency.
ROS 2 Callback
A ROS 2 Callback is a user-defined function that the Executor invokes. It is the atomic unit of work scheduled by the executor. Different callback types have distinct scheduling characteristics.
- Subscription Callback: Triggered when a message arrives on a topic.
- Timer Callback: Triggered at a fixed frequency, independent of other node activity.
- Service Callback: Triggered by an incoming service request.
- Action Server Callbacks: Include goal, cancel, and result callbacks for long-running tasks.
- Callback Groups: Callbacks can be assigned to Mutually Exclusive or Reentrant groups to control executor concurrency.
Real-Time Robotic Control Systems
This broader architectural pillar encompasses the need for deterministic, low-latency execution loops—the core problem the Executor is designed to solve. Designing an effective executor strategy is critical for real-time performance.
- Deterministic Scheduling: Using a Static Single-Threaded Executor provides predictable, fixed-priority callback ordering.
- Latency Chains: The executor is the central scheduler in the perception-planning-actuation loop. Its design (e.g., spin period, callback group assignment) directly impacts end-to-end system latency.
- Integration with Control Loops: High-frequency control often bypasses the executor for hardware-timed interrupts, but the executor manages higher-level task coordination.
ROS 2 Component
A ROS 2 Component is a node packaged as a shared library. A Component Manager uses a specialized MultiThreadedExecutor to dynamically load and run multiple components within a single process.
- Process Composition: The Component Manager's executor allows co-locating multiple nodes (components) to reduce inter-process communication overhead.
- Resource Management: The executor manages the lifecycle and callbacks of all loaded components, providing a unified scheduling context.
- Performance: This model is key for performance-sensitive applications, as it minimizes serialization and context-switching costs.
Callback Group
A Callback Group is an executor-level mechanism to control concurrency among a node's callbacks. It defines whether callbacks can be executed in parallel.
- Mutually Exclusive Group: Callbacks in this group are never executed concurrently by the executor. This is the default and safe for shared data access.
- Reentrant Group: Callbacks in this group can be executed in parallel by a MultiThreadedExecutor, requiring explicit user synchronization (e.g., mutexes).
- Executor Binding: Callback groups are associated with an executor when a node is added to it, defining the thread pool available for those callbacks.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us