MTSS: Multitask stack sharing for embedded systems

Out-of-memory errors are a serious source of unreliability in most embedded systems. Applications run out of main memory because of the frequent difficulty of estimating the memory requirement before deployment, either because it depends on input data, or because certain language features prevent estimation. The typical lack of disks and virtual memory in embedded systems has a serious consequence when an out-of-memory error occurs. Without swap space, the system crashes if its memory footprint exceeds the available memory by even 1 byte. This work improves reliability for multitasking embedded systems by proposing MTSS, a multitask stack sharing technique. If a task attempts to overflow the bounds of its allocated stack space, MTSS grows its stack into the stack memory space allocated for other tasks. This technique can avoid the out-of-memory error if the extra space recovered is sufficient to complete execution. Experiments show that MTSS is able to recover an average of 54p of the stack space allocated to the overflowing task in the free space of other tasks. In addition, unlike conventional systems, MTSS detects memory overflows, allowing the possibility of remedial action or a graceful exit if the recovered space is not enough. Alternatively, MTSS can be used for decreasing the required physical memory of an embedded system by reducing the initial memory allocated to each of the tasks and recovering the deficit by sharing stack with other tasks. The overheads of MTSS are low: the runtime and energy overheads are 3.1p and 3.2p, on average. These are tolerable given that reliability is the most important concern in virtually all systems, ahead of other concerns, such as runtime and energy.

[1]  Emery D. Berger,et al.  Quantifying the performance of garbage collection vs. explicit memory management , 2005, OOPSLA '05.

[2]  Markus Pizka,et al.  Thread Segment Stacks , 1999, PDPTA.

[3]  Trevor Mudge,et al.  MiBench: A free, commercially representative embedded benchmark suite , 2001 .

[4]  Manas Saksena,et al.  Scheduling fixed-priority tasks with preemption threshold , 1999, Proceedings Sixth International Conference on Real-Time Computing Systems and Applications. RTCSA'99 (Cat. No.PR00306).

[5]  Abraham Silberschatz,et al.  Operating Systems Concepts with Java: Wiley Plus Stand-alone , 2007 .

[6]  Krste Asanovic,et al.  Mondrian memory protection , 2002, ASPLOS X.

[7]  Rajeev Barua,et al.  MTSS: multi task stack sharing for embedded systems , 2005, CASES '05.

[8]  Theodore P. Baker,et al.  A stack-based resource allocation policy for realtime processes , 1990, [1990] Proceedings 11th Real-Time Systems Symposium.

[9]  Neil C. Audsley,et al.  Predictable and efficient virtual addressing for safety-critical real-time systems , 2001, Proceedings 13th Euromicro Conference on Real-Time Systems.

[10]  George C. Necula,et al.  Capriccio: scalable threads for internet services , 2003, SOSP '03.

[11]  Rita Loogen,et al.  Stack Management of Runtime Structures in Distributed Implementations , 1993, PLILP.

[12]  John Regehr,et al.  Eliminating Stack Overflow by Abstract Interpretation , 2003, EMSOFT.

[13]  Jens Palsberg,et al.  Static checking of interrupt-driven software , 2001, Proceedings of the 23rd International Conference on Software Engineering. ICSE 2001.

[14]  Sharad Malik,et al.  Power analysis of embedded software: a first step towards software power minimization , 1994, IEEE Trans. Very Large Scale Integr. Syst..

[15]  Anantha Chandrakasan,et al.  JouleTrack: a web based tool for software energy profiling , 2001, DAC '01.

[16]  Kam-Fai Wong,et al.  Supporting thousands of threads using a hybrid stack sharing scheme , 1994, SAC '94.

[17]  Andrew W. Appel,et al.  Modern Compiler Implementation in ML , 1997 .

[18]  Abraham Silberschatz,et al.  Operating Systems Concepts , 2005 .

[19]  David Seal,et al.  ARM Architecture Reference Manual , 2001 .

[20]  Richard T. Witek,et al.  A 160 MHz 32 b 0.5 W CMOS RISC microprocessor , 1996, 1996 IEEE International Solid-State Circuits Conference. Digest of TEchnical Papers, ISSCC.

[21]  Rajeev Barua,et al.  Memory overflow protection for embedded systems using run-time checks, reuse, and compression , 2006, TECS.

[22]  Daniel G. Bobrow,et al.  A model and stack implementation of multiple environments , 1973, CACM.

[23]  Andrew W. Appel,et al.  Garbage Collection can be Faster than Stack Allocation , 1987, Inf. Process. Lett..

[24]  R. Stephany,et al.  A 200MHz 32b 0.5W CMOS RISC Microprocessor , 1998 .

[25]  Erik Brockmeyer,et al.  Data and memory optimization techniques for embedded systems , 2001, TODE.

[26]  Dirk Grunwald,et al.  Whole-program optimization for time and space efficient threads , 1996, ASPLOS VII.

[27]  David A. Patterson,et al.  Computer Architecture: A Quantitative Approach , 1969 .