Scheduling hard and soft real-time communication in a controller area network

Mohammad Ali Livani, Jörg Kaiser, Weijia JiaControl 1999

TL;DR

This paper introduces a novel hybrid scheduling mechanism for Controller Area Network (CAN) buses, designed to guarantee timely communication for critical "hard real-time" tasks while efficiently utilizing resources for less critical "soft real-time" tasks. The approach combines dynamic TDMA for hard real-time and Least-Laxity-First (LLF) scheduling for soft real-time, ensuring predictable performance even under heavy bus load.

What Problem Does This Paper Address?

In complex distributed real-time systems, such as those found in industrial automation or automotive applications, communication is paramount. These systems often involve a mix of tasks with different timing requirements:

  • Hard real-time tasks: Must meet their deadlines without fail. Missing a deadline can lead to catastrophic system failure.
  • Soft real-time tasks: Ideally should meet deadlines, but occasional misses are acceptable and do not cause system failure, though performance may degrade.
  • Non-real-time tasks: Have no defined deadlines.

The Controller Area Network (CAN) bus is a popular choice for these systems due to its robustness and priority-based arbitration. However, effectively scheduling a mix of hard and soft real-time traffic on a shared CAN bus, especially under dynamic conditions or potential overloads, is challenging. Existing approaches often struggle to guarantee hard real-time deadlines while also achieving high resource utilization. This paper aims to bridge this gap by proposing a unified scheduling framework that addresses both predictability for critical tasks and efficiency for less critical ones.

Methods

The core of the paper's contribution is a hybrid bus scheduling algorithm that merges two key scheduling strategies:

  1. Dynamic TDMA (Time Division Multiple Access) for Hard Real-Time Communication:
    • This approach reserves specific time slots on the CAN bus for hard real-time messages.
  2. These reservations are managed through a global calendar distributed across all nodes.
  3. The system ensures that hard real-time messages have exclusive access to their reserved slots, guaranteeing their timely transmission even during overload conditions.
  4. This mechanism accounts for potential communication errors and retransmissions by reserving sufficient time.
  5. Least-Laxity-First (LLF) Scheduling for Soft Real-Time Communication:
    • LLF is a dynamic priority scheduling algorithm where tasks with the least remaining time until their deadline (i.e., the smallest laxity) are given the highest priority.
  6. In this CAN implementation, the transmission laxity of a message is encoded into its CAN identifier, which directly influences its priority during bus arbitration.
  7. Crucially, soft real-time messages can utilize any unused reserved resources from the hard real-time TDMA slots. This significantly improves resource utilization.
  8. Non-real-time messages are assigned the lowest priorities.

The paper also details how the CAN identifier is partitioned to accommodate subject-based addressing, sender node identification, and the encoded laxity for dynamic priority assignment. It addresses the challenge of clock synchronization and defines rules for priority assignment to ensure hard real-time messages always preempt soft real-time messages when necessary.

Datasets

Not discussed in the paper. The paper focuses on a theoretical framework and simulation-based analysis rather than empirical evaluation on specific datasets.

Key Insights and Ideas

  • Hybrid Approach is Key: The most significant insight is that a combination of static reservation (TDMA) for hard real-time and dynamic scheduling (LLF) for soft real-time is highly effective. This allows for guaranteed performance for critical tasks while maximizing the use of available bandwidth.
  • Resource Re-use for Efficiency: Allowing soft real-time tasks to utilize idle hard real-time slots is a clever way to boost overall bus utilization, especially in systems where hard real-time tasks might not always operate at their peak load.
  • CAN Identifier as a Flexible Priority Field: The paper demonstrates how the CAN identifier, typically used for fixed priority, can be cleverly partitioned and utilized to implement dynamic priority scheduling based on message laxity.
  • Global Calendar for Predictability: Distributing a global calendar of reserved time slots across all nodes provides a shared understanding of the bus schedule, enabling fault detection and recovery.
  • Time Horizon for LLF: The paper highlights the importance of a sufficient "time horizon" for LLF schedulers to avoid failures, especially when dealing with multiple messages of similar laxity.

Key Results

The paper presents a theoretical framework and derives conditions for the correct scheduling of hard and soft real-time messages. While specific quantitative results from simulations or experiments are not detailed, the paper provides:

  • Formulas for calculating the required time-slot length for hard real-time messages, considering fault tolerance (e.g., ARh = (Lh + 18)f + Ln + 3 bit-times).
  • Conditions for ensuring that hard real-time messages win bus arbitration within their critical interval.
  • An estimation of the processing overhead for the dynamic priority updates, showing it to be around 4% at 1 Mbit/s bus rate, which is considered acceptable.
  • An example calculation showing that under certain assumptions (e.g., single fault tolerance, specific clock inaccuracy), up to 2754 hard real-time messages per second could be guaranteed.

Limitations and Future Work

  • Computational Overhead: While the overhead is estimated to be manageable (around 4%), it's still a factor, especially for resource-constrained microcontrollers. The paper notes this overhead is periodic and tied to the priority slot Atp.
  • Clock Synchronization Accuracy: The effectiveness of the TDMA approach relies heavily on accurate clock synchronization between nodes. The paper mentions this as a requirement and points to existing mechanisms but doesn't detail its implementation or its impact on scheduling guarantees.
  • Fault Model: The paper assumes a specific fault model for calculating time-slot lengths. The performance under different or more complex fault scenarios might require further investigation.
  • Future Work: The authors suggest that this low-level protocol can serve as a basis for a high-level atomic multicast protocol with bounded termination time, indicating a direction for further research in distributed real-time systems. They also mention the need for a global schedule to be enforced by all components based on local information, implying ongoing work in distributed consensus.

Summary updated

BibTeX
@inproceedings{livani1999scheduling,
  author = {Mohammad Ali Livani and Jörg Kaiser and Weijia Jia},
  title = {{Scheduling hard and soft real-time communication in a controller area network}},
  booktitle = {Control},
  year = {1999},
  doi = {10.1016/s0967-0661(99)00128-8},
}
Figure