嵌入式實(shí)時系統(tǒng)動態(tài)內(nèi)存分配管理器的設(shè)計與實(shí)現(xiàn)
發(fā)布時間:2018-02-08 22:37
本文關(guān)鍵詞: 動態(tài)內(nèi)存分配 TLSF算法 內(nèi)存管理器 嵌入式實(shí)時系統(tǒng) 出處:《重慶大學(xué)》2013年碩士論文 論文類型:學(xué)位論文
【摘要】:隨著物聯(lián)網(wǎng)技術(shù)的發(fā)展,嵌入式實(shí)時操作系統(tǒng)得到越來越廣泛的應(yīng)用。嵌入式實(shí)時操作系統(tǒng)對動態(tài)內(nèi)存分配的實(shí)時性、碎片率、可靠性有更高的要求,因此,動態(tài)內(nèi)存分配已成為嵌入式實(shí)時操作系統(tǒng)的一個重要研究內(nèi)容,F(xiàn)有內(nèi)存管理一般通過犧牲內(nèi)存利用率來滿足實(shí)時性要求,造成了內(nèi)存資源浪費(fèi)。此外,由于嵌入式系統(tǒng)處理器一般沒有內(nèi)存管理單元,實(shí)時操作系統(tǒng)的內(nèi)存管理無法對內(nèi)存進(jìn)行保護(hù),,易造成內(nèi)存越界訪問,降低系統(tǒng)的可靠性。為此,改善內(nèi)存利用率和內(nèi)存安全保護(hù)功能對于提供動態(tài)內(nèi)存分配性能具有重要意義。 本文針對上述問題,在嵌入式實(shí)時系統(tǒng)內(nèi)存管理算法TLSF(Two-levelSegregated Fit)基礎(chǔ)上,針對其內(nèi)存分配和釋放時的不足,以及在內(nèi)存保護(hù)方面的缺陷,研究了在不降低系統(tǒng)實(shí)時性的前提下降低內(nèi)存碎片率的方法,通過加入二級位圖算法,提出新的數(shù)據(jù)結(jié)構(gòu),添加內(nèi)存越界訪問保護(hù)機(jī)制,完成了一種新的嵌入式實(shí)時系統(tǒng)動態(tài)內(nèi)存管理器ERMM(Embedded Real-time Memory Manager)的設(shè)計。主要工作包括: 1)分析了常用嵌入式實(shí)時操作系統(tǒng)的動態(tài)內(nèi)存管理算法,對不同的動態(tài)內(nèi)存分配算法(DSA)的實(shí)時性及內(nèi)存碎片率進(jìn)行了討論,根據(jù)嵌入式實(shí)時系統(tǒng)的對實(shí)時性及內(nèi)存碎片率的要求,提出了以TLSF算法為基礎(chǔ)的嵌入式實(shí)時系統(tǒng)動態(tài)內(nèi)存管理器內(nèi)存管理方案。 2)通過對TLSF算法進(jìn)行詳細(xì)分析,提出了一個新的嵌入式實(shí)時系統(tǒng)動態(tài)內(nèi)存分配管理器(ERMM)。針對TLSF算法在小內(nèi)存分配時效率較低的缺點(diǎn),提出新的數(shù)據(jù)結(jié)構(gòu),對不同大小的內(nèi)存請求采取不同的分配策略。對小內(nèi)存請求,采取二級位圖算法加快查找速度,并通過以空間換時間的策略降低分配時間,減少外部內(nèi)存碎片;對大內(nèi)存請求,采用改進(jìn)TLSF算法:對其內(nèi)存分配的“取下限”切割策略,提出“精確切割”的改進(jìn)策略,降低內(nèi)部內(nèi)存碎片率;對其內(nèi)存釋放時空閑內(nèi)存塊“立即合并”策略,提出“延時合并”的改進(jìn)策略,提高實(shí)時性;在可靠性方面,采取內(nèi)存越界保護(hù)等措施提高內(nèi)存管理的安全性。 3)將TLSF算法及ERMM在μC/OS-Ⅲ系統(tǒng)上進(jìn)行實(shí)現(xiàn),在內(nèi)存碎片率及實(shí)時性方面對這兩種方法進(jìn)行實(shí)驗(yàn)對比,并對ERMM的內(nèi)存安全性進(jìn)行測試。實(shí)驗(yàn)結(jié)果表明,ERMM動態(tài)內(nèi)存分配管理器具有較好的實(shí)時性、較高的可靠性及較低的內(nèi)存碎片率,可有效提高嵌入式實(shí)時系統(tǒng)內(nèi)存管理的性能。
[Abstract]:With the development of Internet of things technology, embedded real-time operating system is more and more widely used. Embedded real-time operating system has higher requirements for real-time, fragmentation and reliability of dynamic memory allocation. Dynamic memory allocation has become an important research content in embedded real-time operating system. The existing memory management usually sacrifices the memory utilization to meet the real-time requirements, which results in the waste of memory resources. Because the embedded system processor generally has no memory management unit, the memory management of the real-time operating system can not protect the memory, which can easily cause the memory to cross the boundary and reduce the reliability of the system. Improving memory utilization and memory security protection is important to provide dynamic memory allocation performance. In order to solve the above problems, based on the memory management algorithm TLSF(Two-levelSegregated Fit, this paper aims at the shortcomings of memory allocation and release, as well as the defects in memory protection. This paper studies the method of reducing the memory fragmentation rate without reducing the real-time performance of the system. By adding a two-level bitmap algorithm, a new data structure is proposed, and a memory access protection mechanism is added. A new embedded real-time system dynamic memory manager, ERMM(Embedded Real-time Memory Manager, is designed. The main work includes:. 1) the dynamic memory management algorithms of common embedded real-time operating systems are analyzed, and the real-time performance and memory fragmentation rate of different dynamic memory allocation algorithms (DSAs) are discussed. According to the requirement of real-time and memory fragmentation rate of embedded real-time system, a memory management scheme of dynamic memory manager for embedded real-time system based on TLSF algorithm is proposed. 2) based on the detailed analysis of the TLSF algorithm, a new dynamic memory allocation manager for embedded real-time system is proposed. Aiming at the low efficiency of the TLSF algorithm in small memory allocation, a new data structure is proposed. For small memory requests, the secondary bitmap algorithm is adopted to speed up the lookup speed, and to reduce the allocation time and reduce the external memory fragmentation by using the strategy of changing space for time, and for large memory requests, the second level bitmap algorithm is adopted to speed up the search speed for the small memory requests with different memory requests of different sizes. The improved TLSF algorithm is adopted: the "lower limit" cutting strategy for its memory allocation, the improved "accurate cutting" strategy to reduce the internal memory fragmentation rate, and the "immediate merge" strategy for the free memory blocks when the memory is released. The improved strategy of "delay merging" is put forward to improve the real-time performance, and in the aspect of reliability, the security of memory management is improved by taking measures such as memory overstepping protection and so on. 3) the TLSF algorithm and ERMM are implemented on 渭 C / OS- 鈪
本文編號:1496439
本文鏈接:http://sikaile.net/kejilunwen/jisuanjikexuelunwen/1496439.html
最近更新
教材專著