# Presentation: 101663

## Design of Very Lightweight Agents for Reactive Embedded Systems

- Jae C. Oh
- Madhura S. Tamhankar
- Syracuse University

- Daniel Mosse
- University of Pittsburgh

- April 8, 2003
- ECBS 2003
- Huntsville, Alabama

## Overview

-   Very Lightweight Agent Definition
-   Motivating Application
-   VLA Design Criteria
-   Subsumption Architecture and Modified Subsumption
-    Architecture
-   VLA Hierarchy and Rule Example
-   Virtual Sensor Idea
-   When to run VLAs?
-   Conclusion

## Very Lightweight Agents(VLAs)

-   Simple software entities, implemented in a few dozen lines of code, taking advantage of the exception-signaling and interrupt-handling mechanisms present in most DSP kernels
-   Subsumption Architecture[Brook’s Architecture] as the basis.
-   Widely used in Robot control applications. It is a good fit for RTES too!

## Motivating Application

- Large scale Data Acquisition system for BTeV, a particle accelerator based physics
- experiment to study matter – antimatter asymmetries in the decays of particle containing bottom quarks.

## Slide 5

## RunTime System Requirements

-  Must support real time scheduling and fault tolerance of L1 trigger
-  Soft real time support at L2 and L3 levels
-  Ability to store large amount of event data
-  Adaptive to changing load conditions
-  Adaptive to changes in operating(environmental) conditions
-  Should be able to actively monitor hardware, detect errors,
- carry out/start recovery procedures, send reports

## “Agents” Vs “Daemons”

- VLAs are *proactive* as well as *reactive* in nature.
- They exhibit agent properties like
-       Rationality
-      Ability to learn
-      Autonomy.
- In traditional AI, agents are known to be “heavyweight” and slow
- processes and were seldom used in systems where guaranteed
- response time is desired.

## Design Criteria for Very Lightweight Agents

-   Should have small footprint (to fit in the DSP memory).This
-    requirement is more stringent at L1 level compared to L2/3.
-   Should be able to be accommodated in the spare cycles left
-    over by the HEP application
-   Should be scalable
-   Fast error detection

## Design Criteria for Very Lightweight Agents

-   Should be adaptive(should be able to change rules in real time)
-   Monitor Hardware
-   Monitor Software
-   Platform Independence
-   Error Reporting
-   (Efficient)Communication with higher level software entity

## Possible Hardware Checks by VLA

- CPU temperature monitoring (lm_Sensors package under Linux)
- Network interface testing
- Motherboards will be tested not only during POST (Pre Operation Self Test), but also batteries that supply energy to the CMOS clock and ROM.
- Memory checking will be carried out in addition to error
-       correction through rules in higher layers.
- Sensor Failure (dealt with Virtual Sensor)

## Possible Software checks by VLA

-    CPU load monitoring.
-    Not-so-critical error conditions can prompt checking for more
- critical symptoms more often.
-    Correlation and aggregation of data and errors detected.

## Subsumption Architecture

- Level 3

- Level 2

- Level 1

- Level 0

- Sensors

- Actuators

## Why Subsumption Architecture for VLAs?

- Salient Features :
- No explicit knowledge representation
- Layered reactive architecture consisting of finite state machines implemented as a very simple Condition-**>**Action rule
- Many rules can fire at the same time
- Rules in the higher layer can inhibit rules in lower layer
- Steels’ Hierarchy :
-  Rules in higher layers can represent less urgent and abstract behaviors
-  Rules in lower layers can represent more urgent and concrete behaviors

## Weakness of Subsumption Architecture

-   Higher-level layers always “subsumes" control lower-level layers.
-   But Lower layers are closer to the hardware and have more accurate information.
-  Higher level may be unaware of those problems.

## Modification to Subsumption Architecture

-  Make the division between layers more flexible.
-  Blackboard architecture for VLA communication
-  Introduce proactivness in the subsumption architecture.

## VLA Hierarchy in RTES

## L1 Low Level VLA Rules

| Rule # | Condition | Action |
| --- | --- | --- |
| L1R1 | Event data are corrupted (noticed from the physics application).
 | Report to the Farmlet manager. Investigate if it is a hardware problem. |
| L1R2 | Too much event data. (noticed from the physics application.) | Report to Farmlet manager. |
| L1R3 | Too little data. (noticed from the physics application.) | Report to Farmlet manager.Note that the Farmlet manager may activate corresponding virtual sensor. |
| L1R4 | No input from sensors (noticed from the physics application.) | Report to the Farmlet manager. Test hardware integrity. |

## The subsumption hierarchy for the L1-level VLAs is: 

| Rule # | Condition | Action |
| --- | --- | --- |
| L1R5 | Overloaded DSP | Report to the Farmlet manager |
| L1R6 | Timer interrupt for periodic testing task
has been received. | Perform the test.
 |
| L1R7 | Certain additional CPU cycles can be spared for the VLA | Run additional diagnostic procedure, communicate with other VLAs, perform preventive actions, check not-so-critical conditions, etc |
| L1R8 | None. | Check DSP CPU load.
 |

- The subsumption hierarchy for the L1-level VLAs is:
- L1R4 < L1R5  < L1R1 < (L1R3 = L1R2) < L1R6 < L1R7 <L1R8.
- L1R2 and L1R3 are mutually exclusive

## Virtual Sensor in RTES

-  Can be part of VLA in actual implementation.
-  Block arrows represent data paths.
-  Line arrows represent control paths.
-  Shaded arrows not activated in normal operation.
-  Shaded data paths are enabled when there is a need for extrapolating data.

## When to run VLAs? 

- CPU time is distributed to HEP, kernel and VLAs
- Priority based scheduling, kernel>HEP>VLAs
- In terms of clock cycles, HEP>VLAs>Kernel
- Scheduling should be adaptable to change in operating/
-       environmental conditions.
- Working on a new scheduling algorithm to effectively schedule
- Proactive VLA component, by exploiting a data pattern noticed in
- BTeV. Paper to be submitted to EMSOFT.

## Conclusion

-  Described an agent-based architecture for fault-tolerant, adaptive, very large-scale, real time, embedded computer systems.
-  Software agents based on Subsumption architecture with modifications suitable for the BTeV environment.
-  An individual VLA is simple. Multiple VLAs interact, we expect to see more complicated and sophisticated intelligent behaviors to emerge.

## Conclusion Cont..

-   Modified subsumption architecture seems to be a good theoretical basis for designing VLAs as they directly deal with hardware.

## Acknowledgements

-  John Gross – University of Pittsburgh
-  Supported through an NSF-ITR medium grant,
-     award number 0121658.