Memory overflow protection for embedded systems using run-time checks, reuse and compression

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 two serious consequences when an out-of-memory error occurs. First, there is no swap space for the application to grow into, and the system crashes. Second, since protection from virtual memory is usually absent, the fact that a segment has exceeded its bounds is not even detected and hence no pre-crash remedial action is possible.This work improves system reliability in two ways. First it proposes a low-overhead system of run-time checks by which the out-of-memory errors are detected just before they will happen, by using carefully optimized compiler-inserted run-time check code. Such error detection enables the designer to incorporate system-specific remedial action, such as transfer to manual control, shutting down of non-critical tasks, or other actions. Second, this work proposes five related techniques that can grow the stack or heap segment after it is out of memory, into previously un-utilized space such as dead variables and space freed by compressed live variables. These techniques can avoid the out-of-memory error if the extra space recovered is enough to complete execution.Results from our benchmarks show that the overheads from the system of run-time checks for detecting memory overflow are extremely low: the run-time and code-size overheads are 1.1% and 0.09% on average. When the reuse functionality is included, the run-time and code-size overheads increase to only 3.2%and 2.33%, but the method is able to grow the stack or heap beyond its overflow by an amount that ranges from 0.7% to 93.5% of the combined stack and heap size.

[1]  David Salomon,et al.  Data Compression: The Complete Reference , 2006 .

[2]  Manuvir Das,et al.  Unification-based pointer analysis with directional assignments , 2000, PLDI '00.

[3]  George Neville-Neil Programming Without a Net , 2003, ACM Queue.

[4]  Hans-Juergen Boehm,et al.  Garbage collection in an uncooperative environment , 1988, Softw. Pract. Exp..

[5]  Nihar R. Mahapatra,et al.  Code compression techniques for embedded systems and their effectiveness , 2003, IEEE Computer Society Annual Symposium on VLSI, 2003. Proceedings..

[6]  Andrew W. Appel,et al.  Modern Compiler Implementation in Java , 1997 .

[7]  Patrik Persson Live memory analysis for garbage collection in embedded systems , 1999, LCTES '99.

[8]  Trevor N. Mudge,et al.  Uniprocessor Virtual Memory without TLBs , 2001, IEEE Trans. Computers.

[9]  Yannis Smaragdakis,et al.  The Case for Compressed Caching in Virtual Memory Systems , 1999, USENIX Annual Technical Conference, General Track.

[10]  Trevor N. Mudge,et al.  Design Tradeoffs For Software-managed Tlbs , 1994, Proceedings of the 20th Annual International Symposium on Computer Architecture.

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

[12]  John Regehr,et al.  Eliminating stack overflow by abstract interpretation , 2003, TECS.

[13]  Thomas M. Conte,et al.  Compiler-driven cached code compression schemes for embedded ILP processors , 1999, MICRO-32. Proceedings of the 32nd Annual ACM/IEEE International Symposium on Microarchitecture.

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

[15]  Joel F. Bartlett,et al.  Compacting garbage collection with ambiguous roots , 1988, LIPO.

[16]  Jakob Engblom Static properties of commercial embedded real-time programs, and their implication for worst-case execution time analysis , 1999, Proceedings of the Fifth IEEE Real-Time Technology and Applications Symposium.

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

[18]  Amer Diwan,et al.  Simple and effective analysis of statically-typed object-oriented programs , 1996, OOPSLA '96.

[19]  G. Broll,et al.  Microsoft Corporation , 1999 .

[20]  Johannes G. Janzen Calculating Memory System Power for DDR SDRAM , 2001 .

[21]  L. Carro,et al.  A study on a garbage collector for embedded applications , 2002, Proceedings. 15th Symposium on Integrated Circuits and Systems Design.

[22]  Reinhold Heckmann,et al.  Verifying safety-critical timing and memory-usage properties of embedded software by abstract interpretation , 2005, Design, Automation and Test in Europe.

[23]  Gerard O'Regan Texas Instruments , 1964, Nature.

[24]  Mahmut T. Kandemir,et al.  Tuning garbage collection in an embedded Java environment , 2002, Proceedings Eighth International Symposium on High Performance Computer Architecture.

[25]  Rajiv Gupta,et al.  Data Compression Transformations for Dynamically Allocated Data Structures , 2002, CC.

[26]  Bruce Jacob,et al.  The Performance and Energy Consumption of Embedded Real-Time Operating Systems , 2003, IEEE Trans. Computers.

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

[28]  Bjarne Steensgaard,et al.  Points-to analysis in almost linear time , 1996, POPL '96.

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

[30]  Rajeev Barua,et al.  Segment protection for embedded systems using run-time checks , 2005, CASES '05.

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

[32]  Dan Chia-Tien Lo,et al.  The design of a self-maintained memory module for real-time systems , 2003, The 3rd IEEE International Workshop on System-on-Chip for Real-Time Applications, 2003. Proceedings..

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

[34]  Sumesh Udayakumaran,et al.  Compiler-decided dynamic memory allocation for scratch-pad based embedded systems , 2003, CASES '03.