廖世煒臺灣大學:資訊工程學研究所曾賢舜Tseng, Shian-ShuenShian-ShuenTseng2010-05-172018-07-052010-05-172018-07-052009U0001-1208200914384000http://ntur.lib.ntu.edu.tw//handle/246246/183375在電腦系統中,記憶體管理扮演了一個重要的角色。一般而言,記體管理員負責分配記憶體給程式和回收不再被使用的記憶體。有鑑Memory Wall 的問題,記憶體管理已成為提升電腦系統效能的重要究主題。在本篇論文提出了數種的記憶體管理決策,並探討這些方在不同的電腦層級中對效能的影響。一個實驗探討了不同的參數設定對memory copy 效能的影響。從驗中發現,正確的參數設定可以比預設的效能要好上8% 。另一方,若選錯了參數設定,相較於最好的參數設定,效能上的差距將會到三倍之多。然而最好的參數並非那麼顯而易見。第二個實驗中,我們探討並改善了Android 中Dalvik 虛擬機器垃圾收集機制的效能,與原始的設計相比,垃圾收集的效能提升約7%。最後,我們也改善了Dalvik 中配置記憶體的速度,其速度提升43%。Memory management is the act of governing the memory sub-system inomputers. Generally, memory management software involves the ways tollocate portions of memory requests by programs and recycle the memoryhen it is no longer needed. Due to the Memory Wall problem, memoryanagement has been an important research topic to boost the performancef computer systems. In this thesis, the performance of different memoryanagement strategies at different levels is evaluated. Several practical methodsor memory management are provided to boost the system performance.irst, the experiments were done to evaluate the performance of memoryopy operations with different configurations. From empirical experiments,e found that with proper configuration, the performance of memory copyperation can achieve about 8% speedup as compared with the default configuration.n the other hand, if the configuration is not chosen judiciously,he performance delivered by the best configuration, which is not obviouso find, can be 3.94 times faster than the worst configuration. Second, wevaluated the performance of Garbage Collection mechanism implementedn Android’s Dalvik virtual machine. The speed of garbage collecting operations improved up to 67% compared to original design. Finally, the memoryllocation mechanism in Dalvik is studied as well. The speed of memory allocation operation is accelerated by up to 43%.致謝i文摘要iibstract iii Introduction 1.1 Thesis Organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 Background 3.1 Memory System Architecture . . . . . . . . . . . . . . . . . . . . . . . . 3.1.1 Cache . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.1.2 Data Prefetching . . . . . . . . . . . . . . . . . . . . . . . . . . 4.1.3 SIMD Instruction Set . . . . . . . . . . . . . . . . . . . . . . . . 5.2 Memory Copy in Kernel Space . . . . . . . . . . . . . . . . . . . . . . . 7.3 Memory Management in Virtual Machine . . . . . . . . . . . . . . . . . 8.4 Related Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Parameter Search for Kernel Memory Copy 10.1 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10.2 Exploration Space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.2.1 Implementations of Memory Copy . . . . . . . . . . . . . . . . . 11.2.2 Configurations of Hardware Prefetchers . . . . . . . . . . . . . . 11.2.3 Data Sizes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12.3 Implementations for Memory Copy . . . . . . . . . . . . . . . . . . . . 13.3.1 Simple Memory Copy . . . . . . . . . . . . . . . . . . . . . . . 14.3.2 SIMD Instruction for Data Movement . . . . . . . . . . . . . . . 14.3.3 Non-Temporal Data Movement . . . . . . . . . . . . . . . . . . 16.3.4 Prefetch Instructions . . . . . . . . . . . . . . . . . . . . . . . . 16.3.5 Block Prefetch . . . . . . . . . . . . . . . . . . . . . . . . . . . 17.4 Experimental Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17.4.1 Experimental Setup . . . . . . . . . . . . . . . . . . . . . . . . . 19.4.2 Overview of Performance Results . . . . . . . . . . . . . . . . . 19.4.3 Data Size of 4KB . . . . . . . . . . . . . . . . . . . . . . . . . . 20.4.4 Data Size of 256KB . . . . . . . . . . . . . . . . . . . . . . . . 21.4.5 Data Size of 16MB . . . . . . . . . . . . . . . . . . . . . . . . . 22.5 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 Memory Management in Dalvik Virtual Machine 25.1 Android Dalvik . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25.2 Dalvik Internal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26.2.1 Heap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26.2.2 Garbage Collection . . . . . . . . . . . . . . . . . . . . . . . . . 28.3 Observation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28.3.1 Object Size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28.3.2 Allocation and Release in Dalvik . . . . . . . . . . . . . . . . . 30.4 Buffer Cache . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.5 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 Conclusion and Future Work 35.1 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35.2 Future Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36.2.1 Dynamic Memory Copy Selection . . . . . . . . . . . . . . . . . 36.2.2 Parameter Search for User Memory Copy . . . . . . . . . . . . . 36.2.3 More Genius Memory Management in Dalvik . . . . . . . . . . . 36.2.4 Other Tunable Factors in Dalvik . . . . . . . . . . . . . . . . . . 37ibliography 38application/pdf1779110 bytesapplication/pdfen-US記憶體管理Memory Mopy參數設定Dalvik垃圾收集Memory ManagementMemory CopyConfigurationsGarbage Collection在記憶體密集型應用程式中的最佳化技術Techniques in Optimizing Memory-Intensive Applicationsthesishttp://ntur.lib.ntu.edu.tw/bitstream/246246/183375/1/ntu-98-R96922102-1.pdf