Scenario-Based RTOS Optimization (SBRO): An Engineering-Oriented Enhancement for Hard Real-Time Firmware

2026, Mar 04    

Author: Liangxiao Li

Abstract

This article proposes the Scenario-Based RTOS Optimization (SBRO) architecture as a deterministic complement to traditional task-based scheduling. Rather than replacing existing real-time scheduling theory, SBRO introduces a scenario-aware execution layer that clusters interdependent tasks into atomic, interrupt-masked blocks to mitigate stochastic jitter. This approach provides a practical framework for ensuring the deterministic execution of critical control loops under resource scarcity, while maintaining formal schedulability compatibility with standard Rate Monotonic Scheduling (RMS) frameworks.

1. Introduction

In hard real-time systems, correctness is defined by both functional accuracy and temporal determinism (Stankovic, 1988). While traditional scheduling theories, such as RMS and Deadline Monotonic Scheduling (DMS) (Liu & Layland, 1973), efficiently manage concurrency, they often introduce non-deterministic jitter in high-frequency control loops due to context-switching overhead and preemptive scheduling interference. To bridge the gap between abstract mathematical scheduling and physical hardware requirements, we propose the SBRO framework, which shifts the paradigm from managing isolated tasks to managing unified “scenarios”—clusters of interdependent tasks that execute as a single deterministic block.

2. The Engineering Context of SBRO

SBRO addresses the limitations of standard preemptive RTOS kernels in handling high-frequency, jitter-sensitive control loops. Unlike Mixed-Criticality Systems (MCS) (Vestal, 2007), which manage resource scarcity by dynamically dropping low-criticality tasks, SBRO maintains system integrity by preserving the task set while minimizing execution variance. By bypassing the scheduler’s preemptive logic during critical windows, SBRO eliminates the context-switching overhead that typically compromises Worst-Case Execution Time (WCET) in resource-constrained environments.

3. The SBRO Methodology

The SBRO framework integrates with existing RTOS environments through three core mechanisms:

  • Synchronous Task Clustering: SBRO groups tasks that share identical execution frequencies and functional dependencies. This ensures the clustered scenario operates as a single, unified control loop.
  • Atomic Sequential Execution: Upon triggering a scenario, clustered tasks are elevated to a pseudo-highest priority and executed sequentially in an uninterrupted block. This structurally eliminates intra-scenario context-switching latency.
  • Deterministic Interrupt Control: To suppress external preemptive jitter, SBRO employs selective interrupt masking during the scenario execution phase, transforming unpredictable hardware-level preemptions into a bounded, deterministic execution delay.

4. Architecture and Reliability

SBRO mandates strict operational constraints to ensure architectural safety and integration with standard kernels:

  • MPU-Enforced Spatial Isolation: To ensure safety, memory boundaries between scenarios and background tasks are enforced via a Memory Protection Unit (MPU). Boundary configurations are pre-loaded during initialization to eliminate reconfiguration overhead during the critical window.
  • Non-Blocking Data Exchange: Communication between high-priority SBRO scenarios and background tasks must utilize lock-free data structures or asynchronous buffers. This preserves WCET by ensuring the scenario never experiences blocking waits for low-priority resource access.
  • Strict WCET Bounding: The framework enforces a sub-millisecond execution constraint (WCET $< \text{SysTick Period}$). By limiting the duration of interrupt masking to a fraction of the system tick, the RTOS scheduler maintains system-wide task progression, and pending interrupts are serviced immediately upon scenario completion.

5. Formal Schedulability Impact

SBRO maintains compatibility with RMS theory by incorporating the scenario execution time as a blocking factor ($B_i$). The system-wide schedulability is validated using the following utilization bound:

$U = \sum_{i=1}^{n} \frac{C_i}{T_i} + \frac{B_i}{T_i} \leq n(2^{1/n}-1)$

Where $C_i$ is the computation time, $T_i$ is the period, and $B_i$ represents the Worst-Case Execution Time of the highest-priority SBRO scenario that can block task $i$. By establishing $B_i$ as a mathematically verifiable constant, SBRO replaces stochastic jitter with a predictable, bounded latency, allowing for formal validation within established scheduling frameworks.

6. Conclusion

Scenario-Based RTOS Optimization (SBRO) provides a robust engineering enhancement for high-frequency hard real-time firmware. By introducing a context-aware execution layer, it enables systems to handle performance bottlenecks while retaining the flexibility of existing RTOS architectures. SBRO effectively bridges the gap between abstract scheduling theory and physical implementation, ensuring that critical timing contracts are satisfied even under demanding resource constraints.

References

[1] Stankovic, J. A. (1988). Misconceptions About Real-Time Computing. IEEE Computer.

[2] Liu, C. L., & Layland, J. W. (1973). Scheduling Algorithms for Multiprogramming. JACM.

[3] Vestal, S. (2007). Preemptive Scheduling of Multi-Criticality Systems. IEEE RTSS.