
Optimizing Scoped and Immortal Memory Management in Real-Time Java A Thesis submitted for the degree of Doctor of Philosophy By HAMZA HAMZA Department of Information Systems and Computing, Brunel University October 2013 ABSTRACT The Real-Time Specification for Java (RTSJ) introduces a new memory management model which avoids interfering with the garbage collection process and achieves better deterministic behaviour. In addition to the heap memory, two types of memory areas are provided - immortal and scoped. The research presented in this Thesis aims to optimize the use of the scoped and immortal memory model in RTSJ applications. Firstly, it provides an empirical study of the impact of scoped memory on execution time and memory consumption with different data objects allocated in scoped memory areas. It highlights different characteristics for the scoped memory model related to one of the RTSJ implementations (SUN RTS 2.2). Secondly, a new RTSJ case study which integrates scoped and immortal memory techniques to apply different memory models is presented. A simulation tool for a real-time Java application is developed which is the first in the literature that shows scoped memory and immortal memory consumption of an RTSJ application over a period of time. The simulation tool helps developers to choose the most appropriate scoped memory model by monitoring memory consumption and application execution time. The simulation demonstrates that a developer is able to compare and choose the most appropriate scoped memory design model that achieves the least memory footprint. Results showed that the memory design model with a higher number of scopes achieved the least memory footprint. However, the number of scopes per se does not always indicate a satisfactory memory footprint; choosing the right objects/threads to be allocated into scopes is an important factor to be considered. Recommendations and guidelines for developing RTSJ applications which use a scoped memory model are also provided. Finally, monitoring scoped and immortal memory at runtime may help in catching possible memory leaks. The case study with the simulation tool ii developed showed a space overhead incurred by immortal memory. In this research, dynamic code slicing is also employed as a debugging technique to explore constant increases in immortal memory. Two programming design patterns are presented for decreasing immortal memory overheads generated by specific data structures. Experimental results showed a significant decrease in immortal memory consumption at runtime. iii AKNOWLEDGMENTS I would not have been able to provide and complete this Thesis without the sincere support and help of many people. Foremost, I would like to thank my supervisor Dr. Steve Counsell for his patience, motivation, advice, and continuous help and support. He made my PhD journey an excellent experience with his knowledge, kindness, thoughtfulness and encouragement. I would like to dedicate my deep thanks for my mother, for the encouragement she provided, her unlimited patience, prayers and the sacrifices she made to help me after my father passed away, which without, I would not be able to achieve my goals and survive difficult times. I am greatly indebted to my sincere wife Dalia and my daughter Julie, without their hopeful smiles, emotional support, patience, understanding and infinite love I would not have been able to stand during the difficult moments in my PhD. I would like to convey my sincerest gratitude to my uncle Wahid Hamza who has been supportive through all my life stages. His sympathy and understanding were enormous and significantly appreciated. I am very grateful to all people in the Department of Information Systems and Computing at Brunel University who helped me during my study and provided such a friendly and comfortable environment. Last, but by no means least, I would like to thank all my friends and colleagues who have been my other family in the UK. iv LIST OF PUBLICATIONS Journal Papers: H. Hamza, S. Counsell, Region-Based RTSJ Memory Management: State of the art, Science of Computer Programming, Volume 77, Issue 5, 1 May 2012, Pages 644- 659, (http://www.sciencedirect.com/science/article/pii/S0167642312000032) H. Hamza, S. Counsell, Simulation of safety-critical, real-time Java: A case study of dynamic analysis of scoped memory consumption, Simulation Modelling Practice and Theory, Volume 25, June 2012, Pages 172-189. Cited by: (Singh et al., 2012 ) ( Hamza, Counsell, 2013) Conference Papers: Hamza Hamza and Steve Counsell. 2013. Exploiting slicing and patterns for RTSJ immortal memory optimization. In Proceedings of the 2013 International Conference on Principles and Practices of Programming on the Java Platform: Virtual Machines, Languages, and Tools (PPPJ '13). ACM, New York, NY, USA, pp. 159-164 Hamza, H. and Counsell, S., Simulation of a Railway Control System: Dynamic Analysis of Scoped Memory Consumption, the13th International Conference on Modelling and Simulation, Cambridge, Cambridgeshire United Kingdom, 2011. IEEE, pp. 287 - 292 Hamza, H. and Counsell, S., Using scoped memory in RTSJ applications: Dynamic analysis of memory consumption, 37th EUROMICRO Conference on Software Engineering and Advanced Applications, Proceedings of the 37th Euromicro Conference on SEAA 2011. IEEE, pp. 221-225 Hamza, H. and Counsell, S., The impact of varying memory region numbers and nesting on RTSJ execution time. Proceedings of the 3rd International Conference on Computer and Electrical Engineering (ICCEE 2010). pp. p.90-96 H. Hamza, S. Counsell, Improving the performance of scoped memory in RTSJ applications, work-in-progress session, in: SEAA Euromicro Lille, France,September 2010. v DECLARATION This thesis is the result of my own investigations, except where otherwise stated. Other sources are acknowledged by explicit references. Some of the material presented in this thesis has previously been published as follows: Chapter 2 is extension to the material previously published in Science of Computer Programming Journal, 2012. The name of the article is Region-Based RTSJ Memory Management: State of the art. Chapter 3 is an extension on the work presented in 3rd International Conference on Computer and Electrical Engineering (ICCEE 2010). The name of the article is “The impact of varying memory region numbers and nesting on RTSJ execution time”. Chapter 4 is based on the work published in the Simulation Modelling Practice and Theory Journal, 2012. The name of the article is: “Simulation of safety-critical, real- time Java: A case study of dynamic analysis of scoped memory consumption”. Chapter 5 is based on the work published in proceedings of the 2013 International Conference on Principles and Practices of Programming on the Java Platform: Virtual Machines, Languages, and Tools (PPPJ '13). The name of the article is: “Exploiting slicing and patterns for RTSJ immortal memory optimization” I hereby give consent for my thesis, if accepted, to be made available for photocopying and for inter-library loan, and for the title and summary to be made available to outside organizations. Signed ……. (candidate) Date . ……. vi TABLE OF CONTENTS TABLE OF FIGURES......................................................... ix Chapter 1: Introduction ....................................................... 1 1.1 THESIS OVERVIEW ................................................................................... 1 1.2 RESEARCH MOTIVATION .......................................................................... 3 1.3 RESEARCH AIM AND OBJECTIVES ............................................................ 5 1.4 THESIS CONTRIBUTIONS ........................................................................... 6 1.5 THESIS OUTLINE ...................................................................................... 7 Chapter 2: Literature Review .............................................. 9 2.1 OVERVIEW ............................................................................................... 9 2.2 BACKGROUND ........................................................................................ 12 2.2.1 RTSJ SCOPE PRINCIPLES ............................................................................ 14 2.2.2 RTSJ MEMORY MANAGEMENT APIS ......................................................... 16 2.2.3 SCOPED MEMORY REFERENCE SEMANTICS ............................................... 18 2.2.4 SCOPED MEMORY IN NON-RTS JAVA VIRTUAL MACHINES ......................... 20 2.3 CURRENT PROBLEMS AND EXISTING SOLUTIONS .................................... 22 2.3.1 TIME OVERHEADS ...................................................................................... 22 2.3.2 SPACE OVERHEADS .................................................................................... 24 2.3.3 DEVELOPMENT COMPLEXITY ..................................................................... 27 2.3.3.1 ASSISTING TOOLS .................................................................................. 27 2.3.3.2 SEPARATING MEMORY CONCERN FROM PROGRAM LOGIC .................... 28 2.3.3.3 DESIGN PATTERNS AND COMPONENTS ................................................... 31 2.3.3.4 ALLOCATION TIME ................................................................................. 42 2.4 BENCHMARKS TO EVALUATE RTSJ SCOPED MEMORY ............................ 43 2.5 POTENTIAL RESEARCH DIRECTIONS ....................................................... 49 2.6 SUMMARY .............................................................................................
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages188 Page
-
File Size-