Embedded System Design Framework for Minimizing Code Size and Guaranteeing Real-Time Requirements Insik Shin, Insup Lee, & Sang Lyul Min CIS, Penn, USACSE, SNU, KOREA The 23rd IEEE International Real-Time Systems Symposium December 3-5 Austin, TX. (USA)
2 Outline Design problem in real-time embedded systems motivation problem statement Solution – design framework overview problem formulation heuristic solutions and evaluations Conclusion
3 Code Size Reduction in Embedded Systems Code size is a critical design factor For many embedded systems, code size reduction can affect their design and manufacturing cost. Code size reduction technique at ISA level a subset of normal 32-bit instructions can be compressed into a 16-bit format as in ARM Thumb and MIPS 16. code size can be reduced by 30%, while the number of instructions can increase by 40%.
4 Code Size vs Execution Time Tradeoff Code size (s) / execution time (e) tradeoff Program 32 bit a program unit (function or basic block) can be compiled into 16 or 32 bit instructions. 16 bit s e then, we can obtain a list of possible (s, e) pairs for each program 32 bit program unit
5 Tradeoff Function Discrete tradeoff function for each task i with the list of possible (s, e) pairs for each program (task), we can define a discrete tradeoff function s = f i (e) for each task. s e
6 Tradeoff Function Linear approximated tradeoff function we can safely approximate the discrete tradeoff function with a linear tradeoff function. s e
7 Given the code size vs. execution time tradeoff of each task in a real-time embedded system, Challenging Problem Task Tradeoff Task 1Task 2Task n … Real-time embedded system a natural problem is minimizing the total code size of the system while guaranteeing all the temporal requirements imposed on the system.
8 Much work on the real-time system design framework guaranteeing the system temporal requirements. Traditional design frameworks are for minimizing the system utilization, while our problem aims at minimizing the system code size. Instead of solving the problem from the scratch, we chose to extend a traditional real-time design framework considering code size minimization. Our Approach
9 Period Calibration Method (PCM) A popular design framework that transforms real-time system requirements into real-time task scheduling parameters while guaranteeing the system timing requirements minimizing the system utilization R. Gerber et al. “Guaranteeing End-to-End Timing Constraints by Calibrating Intermediate Processes”, RTSS ’94.
10 Period Calibration Method (PCM) X1 X2 Y1 11 22 d1 33 d2 44 Task Precedence End-to-End Timing Requirements System Requirements Task Parameters Period, Offset, Deadline, Fixed Priority System Requirements Task Parameters Guaranteeing the system end-to-end timing requirements Minimizing the utilization Task Execution Time PCM
11 Design Framework Overview of Our Approach System Requirements Task Tradeoff Task 1Task 2Task n … Task Precedence End-to-End Timing Requirements Task Parameters Period, Offset, Deadline, Execution Time, Code Size System Requirements & Task Tradeoff Task Parameters Guaranteeing the system end-to-end timing requirements Minimizing the total code size
12 Design Framework Overview Design Framework System Requirements Task Tradeoff Task Execution Time PCM Period, Offset, Deadline Execution Time, Code Size Optimization Framework Feasibility Analysis Feasibility Constraint Task Parameters
13 t2t2 t1t1 Feasibility Analysis for all time intervals [t1,t2], the amount of execution to be done within the interval is no greater than the interval length, Design Framework : Feasibility Analysis this feasibility analysis is NP-hard [Baruah ’90]. Task model asynchronous periodic tasks with pre-period deadlines under EDF scheduling 11 22 3
14 t2t2 t1t1 “Synchronous” time interval starts at the release time of a job and ends at the deadline of a job. Design Framework : Feasibility Analysis 11 22 3 for all possible time intervals for all synchronous time intervals Feasibility Analysis
15 Optimization problem objective: minimizing constraint: feasibility for all synchronous time intervals [t1, t2] Design Framework : Optimization Framework We want to determine task execution time to minimize the total code size while guaranteeing feasibility. it is a form of a LP problem with linear tradeoff regardless of feasibility analysis complexity, it is NP-hard with discrete tradeoff
16 Heuristics for solving the optimization problem Highest Best Reduction-Ratio First (HBRF) favors a task that reduces its code size the most with the same amount of execution time increase Longest Period First (LPF) favors a task with the longest period Highest Best Weighted-Reduction-Ratio First (HBWF) combines HBRF and LPF Complexity HBRF & HBWF – O(n·h), LPF – O(n) n: # of tasks, h: # of tradeoff values Performance evaluation through simulation Design Framework : Optimization Framework
17 Simulation parameters period : 10, 20, 25, 50, or 100 ms offset & deadline : randomly chosen according to period 5 pairs of code size/execution time tradeoff are randomly chosen according to offset, deadline, and period 4, 6, 8, 10, and 12 tasks (more than 100 times each) Simulation measure - closeness to OPT “RA” = the reduced amount of total code size closeness to OPT = Simulation RA by optimal solution RA by heuristic solution
18 Performance of algorithms with 8 tasks Closeness to OPT (%)
19 Performance of BEST with various task numbers Closeness to OPT (%)
20 Conclusion Design framework taking advantage of the code size vs. execution time tradeoff Future work To develop an integrated approach and to evaluate the complexity and effectiveness. To extend this framework so as to utilize tradeoffs among code size, execution time, and energy consumption.