Stack Space Measurement in Multitask Electronic Units
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Conventional electronic control units face challenges in accurately estimating the stack space required for software modules in microcomputers, leading to potential stack overflow issues, especially in real-time control systems where precise memory allocation is critical.
Innovation Solution
An electronic unit with a scheduling system that measures stack space usage during suspended tasks, using a stack check task to determine the maximum space required for each stack region, allowing for efficient memory allocation and preventing overflow.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Measurement precision
If a conventional electronic control unit uses desk calculation to estimate stack space for software modules, then the memory allocation process is simple and quick, but the estimation accuracy is insufficient leading to potential stack overflow
Solution Approach 1:
The patent applies preliminary action by measuring and recording the maximum stack space usage of each task during the system initialization phase, before actual multitask execution begins. This pre-measurement allows the system to allocate stack space accurately without needing to monitor stack usage dynamically during task execution, thus improving measurement precision while avoiding the complexity of continuous monitoring mechanisms.
2Measurement precision
If the system monitors stack pointer movement to estimate stack space usage, then the measurement accuracy improves, but the operation rate decreases due to increased overhead
Solution Approach 1:
The system performs stack space measurement during the initialization phase before multitask execution begins, rather than continuously monitoring during operation. This preliminary measurement captures the maximum stack usage requirements without imposing ongoing overhead on task execution, thus maintaining high operation rates while achieving accurate measurement.
Solution Approach 2:
The patent implements periodic action by having the system measure stack space usage at specific intervals - specifically during task suspension points in the multitask execution cycle. This periodic measurement approach ensures accurate capture of maximum stack usage while minimizing interference with continuous task execution, as measurements are taken only when tasks are suspended and not actively consuming CPU resources.
3Measurement precision
If the system updates maximum stack space estimation frequently, then the accuracy of memory allocation improves, but the resource overhead increases
Solution Approach 1:
The system performs comprehensive stack space measurement and updates the maximum estimation values during the initialization phase before multitask execution begins. This preliminary action ensures that accurate maximum stack space requirements are captured for all tasks without requiring frequent updates during operation, thus minimizing resource overhead while maintaining measurement precision.
Solution Approach 2:
The patent applies self-service by having the system automatically measure and record its own stack space usage characteristics during initialization, without requiring external intervention or continuous monitoring. This self-measurement capability allows the system to establish accurate maximum stack space estimates for all tasks while minimizing resource consumption, as the measurement process leverages the system's existing task suspension mechanisms rather than requiring separate monitoring infrastructure.
Data Source
AI summary
In an electronic unit having a stack in memory and adapted to run a plurality of tasks in accordance with a multitask operating system and to save context data in the stack, a scheduling unit schedules the plurality of tasks for wakeup so as to execute the plurality of tasks. Each of the plurality of tasks stays in at least one of a suspended state, a ready state, and a running state. A measurement unit measures an amount of space to be used in the stack during the at least one of the tasks staying in neither the running state nor the ready state.


