CN100590609C - A Dynamic Memory Management Method Based on Discontinuous Pages - Google Patents
A Dynamic Memory Management Method Based on Discontinuous Pages Download PDFInfo
- Publication number
- CN100590609C CN100590609C CN200810059862A CN200810059862A CN100590609C CN 100590609 C CN100590609 C CN 100590609C CN 200810059862 A CN200810059862 A CN 200810059862A CN 200810059862 A CN200810059862 A CN 200810059862A CN 100590609 C CN100590609 C CN 100590609C
- Authority
- CN
- China
- Prior art keywords
- memory
- data
- host
- page
- management unit
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
- 238000007726 management method Methods 0.000 title claims description 71
- 238000000034 method Methods 0.000 claims description 28
- 238000011084 recovery Methods 0.000 claims description 11
- 238000013507 mapping Methods 0.000 claims description 7
- 238000012546 transfer Methods 0.000 claims description 5
- 238000013500 data storage Methods 0.000 claims description 3
- 238000001514 detection method Methods 0.000 claims description 3
- 230000004044 response Effects 0.000 claims description 2
- GNFTZDOKVXKIBK-UHFFFAOYSA-N 3-(2-methoxyethoxy)benzohydrazide Chemical compound COCCOC1=CC=CC(C(=O)NN)=C1 GNFTZDOKVXKIBK-UHFFFAOYSA-N 0.000 claims 1
- 230000006870 function Effects 0.000 description 8
- 238000010586 diagram Methods 0.000 description 4
- 238000013467 fragmentation Methods 0.000 description 2
- 238000006062 fragmentation reaction Methods 0.000 description 2
- 230000002159 abnormal effect Effects 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 239000013256 coordination polymer Substances 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 230000005055 memory storage Effects 0.000 description 1
- 238000012795 verification Methods 0.000 description 1
Images
Landscapes
- Memory System (AREA)
Abstract
Description
技术领域 technical field
本发明属于集成电路设计领域,特别涉及有实时性要求的网络通信芯片中内存分配、存储和管理的方法,具体是一种基于非连续页的动态内存管理方法。The invention belongs to the field of integrated circuit design, in particular to a method for allocating, storing and managing memory in a network communication chip with real-time requirements, in particular to a dynamic memory management method based on discontinuous pages.
背景技术 Background technique
根据数据存取的不同模式,管理内存通常有许多不同的方法。当数据的存入和取出的顺序相同时,通常用类似于先进先出(FIFO)的缓冲(Buffer)结构来管理,例如交换机中转发队列就是以不同形式的Buffer来管理。当数据的取出顺序和存入顺序不同时,则在完整的内存存储单元中有可能出现一片空闲单元(Hole),若不能正确处理这些分散在已分配内存中的小片空闲单元,将极大地影响内存的利用率。There are often many different ways to manage memory, depending on the pattern of data access. When the data is stored in and taken out in the same order, it is usually managed with a buffer (Buffer) structure similar to first-in-first-out (FIFO). For example, the forwarding queue in a switch is managed with different forms of Buffer. When the sequence of fetching and storing data is different, there may be a piece of free cells (Hole) in the complete memory storage unit. If these small pieces of free cells scattered in the allocated memory cannot be handled correctly, it will greatly affect Memory utilization.
软件实现的动态内存方法多采用连续分配的方式,用两个双向链表结构管理空闲的内存块。随着内存分配、回收的不断进行,空闲链表将逐渐增大,为了从这个空闲链表中找到一个合适的内存块的搜索时间也相应的增长,而且该时间与请求的内存块大小有关,因此无法满足实时性的要求。并且,这种软件实现的内存分配方法,为了减少碎片问题,都加入内存的分割(splitting)和合并(coalescing)的功能,但这些方法的引入,也在一定程度上影响到内存管理的时间确定性(Time-BoundedService)。The dynamic memory method implemented by software mostly adopts the method of continuous allocation, and manages free memory blocks with two doubly linked list structures. With the continuous progress of memory allocation and recovery, the free list will gradually increase, and the search time to find a suitable memory block from this free list will also increase accordingly, and this time is related to the size of the requested memory block, so it cannot Meet real-time requirements. Moreover, the memory allocation method implemented by this software, in order to reduce the fragmentation problem, has added the function of splitting and merging (coalescing) of memory, but the introduction of these methods also affects the time determination of memory management to a certain extent. Sex (Time-BoundedService).
发明内容 Contents of the invention
本发明的目的就是克服现有技术的不足,提供一种基于非连续页的动态内存管理方法。The purpose of the present invention is to overcome the shortcomings of the prior art and provide a dynamic memory management method based on discontinuous pages.
本发明的动态内存管理方法是根据应用环境中数据流的特征将内存单元分割为大小相同的内存页,这些内存页是内存分配的最小单元,也是内存管理的最小单位,该内存管理方法具体包括内存分配、内存回收和地址映射。其中:The dynamic memory management method of the present invention divides the memory unit into memory pages of the same size according to the characteristics of the data flow in the application environment. These memory pages are the smallest unit of memory allocation and also the smallest unit of memory management. The memory management method specifically includes Memory allocation, memory reclamation and address mapping. in:
内存分配的方法是基于允许逻辑上相连的数据存储在物理上非连续的页中,具体步骤包括:The method of memory allocation is based on allowing logically connected data to be stored in physically non-contiguous pages. The specific steps include:
1、当主机请求内存分配时,内存管理单元比较当前内存的剩余资源(包括空闲页总量和数据标志符DataID)和主机请求的内存大小,若空闲页总量大于主机请求的内存页总量,并且内存管理单元中仍有可用的数据标志符,则继续内存分配,否则结束内存分配。继续内存分配和结束内存分配的信息在一个系统时钟后返回给主机,供主机查询。如果继续内存分配,内存管理单元将从存储DataID信息的二进制向量中,用“首零检测”的方法找到一个可用的标志符,并将该标志符分配给这一块数据。1. When the host requests memory allocation, the memory management unit compares the remaining resources of the current memory (including the total amount of free pages and the data identifier DataID) with the memory size requested by the host. If the total amount of free pages is greater than the total amount of memory pages requested by the host , and there are still available data identifiers in the memory management unit, continue memory allocation, otherwise end memory allocation. The information of continuing memory allocation and ending memory allocation is returned to the host after one system clock for query by the host. If the memory allocation continues, the memory management unit will use the "first zero detection" method to find an available identifier from the binary vector storing the DataID information, and assign the identifier to this piece of data.
2、内存分配单元进入实质性分配阶段,内存管理单元关闭对新的内存分配请求的响应。同时,内存管理单元根据请求的页数,从空闲页表管理单元读出可用页的页号,并写入到数据页表管理单元中。空闲页表中的可用页来自计数器或先进先出队列(FIFO),由分配模式寄存器中的值来决定。当该寄存器中的值为1时,空闲页表管理单元从计数器中获得可用页的页号;当该寄存器中的值为0时,从先进先出队列中获得可用页的页号。2. The memory allocation unit enters the substantive allocation stage, and the memory management unit closes the response to the new memory allocation request. At the same time, the memory management unit reads the page number of the available page from the free page table management unit according to the requested page number, and writes it into the data page table management unit. Available pages in the free page table come from a counter or a first-in-first-out queue (FIFO), as determined by the value in the allocation mode register. When the value in the register is 1, the free page table management unit obtains the page number of the available page from the counter; when the value in the register is 0, it obtains the page number of the available page from the first-in-first-out queue.
3、如果分配给主机的所有内存页全部从空闲页表中转移到数据页表中,则本次内存分配完成,内存管理单元重新进入接收内存分配请求的状态,等待下一次请求;如果分配给主机的所有内存页没有完全从空闲页表中转移到数据页表中,则转到2,继续进行内存页转移。3. If all the memory pages allocated to the host are transferred from the free page table to the data page table, the memory allocation is completed this time, and the memory management unit re-enters the state of receiving memory allocation requests, waiting for the next request; if allocated to If all the memory pages of the host are not completely transferred from the free page table to the data page table, go to 2 to continue the memory page transfer.
内存回收的方法具体步骤包括:The specific steps of the memory recovery method include:
1、当主机请求内存分配时,内存管理单元比较当前内存的剩余资源和主机请求的内存大小,若空闲页总量大于主机请求的内存页总量,并且内存管理单元中仍有可用的数据标志符,则内存管理单元启动与本次请求对应的倒计时器,计时初值为T0,计时步长为1秒,计时的时间基准由外部输入。1. When the host requests memory allocation, the memory management unit compares the remaining resources of the current memory with the memory size requested by the host. If the total amount of free pages is greater than the total amount of memory pages requested by the host, and there are still available data flags in the memory management unit symbol, the memory management unit starts a countdown timer corresponding to this request, the initial timing value is T0, the timing step is 1 second, and the timing reference is input from the outside.
2、如果某次请求在被成功分配一块内存,并且在与该次请求对应的计时器计时到零时,数据所占用的内存资源仍没有被回收,则转4;如果在计时器倒计时到零之前,主机不再使用该内存页中的数据,可以向内存管理单元写入回收内存的指令,要求内存管理单元回收这一块数据所占用的内存页和数据标识符资源。指令中需指出要求回收的数据对应的数据标志符(DataID)。该过程中,内存管理单元停止倒计时器并将其复位到T0。2. If a request is successfully allocated a block of memory, and the memory resource occupied by the data has not been recovered when the timer corresponding to the request reaches zero, go to 4; if the timer counts down to zero Before, the host no longer uses the data in the memory page, and can write an instruction to reclaim memory to the memory management unit, requiring the memory management unit to reclaim the memory page and data identifier resources occupied by this piece of data. The data identifier (DataID) corresponding to the data to be recycled should be pointed out in the instruction. During this process, the memory management unit stops the countdown timer and resets it to T0.
3、当内存管理单元的内部寄存器接收到主机发送显示的“回收内存”的指令时,将指令中数据标志符对应的所有内存页依次从数据页表中读出,并将其写入到空闲页表中,然后转5。其中读出和写入的次数与该数据标志符对应的数据所占用的内存页的总量相同。3. When the internal register of the memory management unit receives the instruction of "reclaiming memory" sent by the host, it will read all the memory pages corresponding to the data identifier in the instruction from the data page table in turn, and write them into the free memory page. page table, then go to 5. The times of reading and writing are the same as the total amount of memory pages occupied by the data corresponding to the data identifier.
4、当倒计时器计时到零时,与该计时器对应的数据所占用的内存资源仍没有被回收,则在数据页表和空闲页表都空闲时,将超时的数据占用的内存页从数据页表中依次读出并写入空闲页表中,同时在所有内存页回收后,将该数据占用的数据标志符对应的二进制向量位重新复位,即回收数据标志符(DataID)资源。4. When the countdown timer counts down to zero, and the memory resource occupied by the data corresponding to the timer has not been reclaimed, then when the data page table and the free page table are both free, the memory page occupied by the timed-out data is removed from the data The page table is sequentially read and written into the free page table, and at the same time, after all memory pages are recovered, the binary vector bit corresponding to the data identifier occupied by the data is reset again, that is, the data identifier (DataID) resource is recovered.
5、内存回收结束。5. The memory recovery is completed.
地址映射将用户访问的逻辑地址转换到能访问物理内存的实际地址,在本发明的应用环境中,内存中的数据是连续写入和读出的。针对这样的数据流特征,地址映射的方法步骤包括:The address mapping converts the logical address accessed by the user into the actual address that can access the physical memory. In the application environment of the present invention, the data in the memory is continuously written and read. For such data flow characteristics, the method steps of address mapping include:
1、当主机需要访问内存时,先向内存管理单元写入一条请求读写的指令。其中,当主机读内存时,在发出读请求的同时,指明需要读取的数据所对应的数据标识符;而当主机需要写内存时,只需发送写请求,数据所对应的标识符由内存管理单元自动管理,该标识符在主机请求内存分配时由内存分配单元分配。1. When the host needs to access the memory, it first writes an instruction requesting read and write to the memory management unit. Among them, when the host reads the memory, it specifies the data identifier corresponding to the data to be read while sending a read request; and when the host needs to write the memory, it only needs to send a write request, and the identifier corresponding to the data is determined by the memory Managed automatically by the management unit, this identifier is allocated by the memory allocation unit when the host requests memory allocation.
2、内存管理单元在接收到主机需要访问内存的指令时,以所访问数据对应的数据标识符为基地址,偏移为零,组合成一个新地址,读取数据页表中数据存储的首个内存页的页号,并将该页号存入“当前页号”寄存器。其中,地址组合时,以数据标识符作为地址的高p位,而地址的低d位为全零。P定义为w-d,其中w为内存中地址线的宽度,d为逻辑地址的页内偏移,相应地,每一片内存页的大小为2d字节(Byte)。2. When the memory management unit receives an instruction from the host that needs to access the memory, it takes the data identifier corresponding to the accessed data as the base address, offsets it to zero, combines it into a new address, and reads the header of the data storage in the data page table. The page number of a memory page is stored in the "current page number" register. Among them, when combining addresses, the data identifier is used as the high p bit of the address, and the low d bits of the address are all zeros. P is defined as wd, where w is the width of the address line in the memory, and d is the page offset of the logical address. Correspondingly, the size of each memory page is 2 d bytes (Byte).
3、当主机开始访问内存时,内存管理单元截取主机当前访问的逻辑地址的低d位,作为物理地址的低d位,并以“当前页号”寄存器中的值为地址的高p位,组合为可以访问内存的物理地址。若主机访问的逻辑地址不是一页中的最后一个字节,则转4;若主机访问的逻辑地址为一页中的最后一个字节,内存管理单元在同一个系统周期内,截取主机当前访问的逻辑地址的高p位,将该p位的数据加1(记为p1)并与当前访问数据的数据标识符一起组合成一个新地址,用该地址读取数据页表管理单元中的页号,并在下一个系统周期时,将从数据页表中获得的页号更新到“当前页表”寄存器中。3. When the host starts to access the memory, the memory management unit intercepts the low d bits of the logical address currently accessed by the host as the low d bits of the physical address, and uses the value in the "current page number" register as the high p bit of the address, Combined into physical addresses that can access memory. If the logical address accessed by the host is not the last byte in a page, turn to 4; if the logical address accessed by the host is the last byte in a page, the memory management unit intercepts the current access of the host in the same system cycle The high p bit of the logic address of the logical address, add 1 to the data of the p bit (denoted as p1) and combine it with the data identifier of the currently accessed data to form a new address, and use this address to read the page in the data page table management unit number, and in the next system cycle, update the page number obtained from the data page table to the "current page table" register.
4、若主机访问内存结束,则向内存管理单元中写入“结束访问”的指令,内存管理单元复位“当前页表”寄存器,并等待主机的下一次访问请求;若主机还需访问内存,则转3,继续内存访问的过程。4. If the host finishes accessing the memory, write the "end access" instruction to the memory management unit, and the memory management unit resets the "current page table" register, and waits for the next access request from the host; if the host still needs to access the memory, Then turn to 3 and continue the process of memory access.
本发明中的所涉及的操作(如读、写内存等)为基本技术常识,采用常规技术手段。本发明的发明点在于提供一种较为先进的内存管理流程。The operations involved in the present invention (such as reading and writing memory, etc.) are basic technical common sense, and conventional technical means are adopted. The inventive point of the present invention is to provide a relatively advanced memory management process.
本发明以非连续的页作为基本分配和回收的单元,允许逻辑上相连的数据存储在非连续的页中。这种方式提高了内存分配的灵活度,相应地,内存的外部碎片被消除,内存的利用率得到了提高。The present invention uses non-contiguous pages as the basic allocation and recovery unit, allowing logically connected data to be stored in non-contiguous pages. This method improves the flexibility of memory allocation, correspondingly, the external fragmentation of memory is eliminated, and the utilization rate of memory is improved.
附图说明 Description of drawings
图1本发明的应用系统结构图;Fig. 1 application system structural diagram of the present invention;
图2本发明内存分配功能的结构图;Fig. 2 is a structural diagram of the memory allocation function of the present invention;
图3本发明内存分配功能的流程图;Fig. 3 is a flow chart of the memory allocation function of the present invention;
图4本发明内存分配过程的时序;The sequence of Fig. 4 memory allocation process of the present invention;
图5本发明系统运行过程中内存分配结果实例;Fig. 5 is an example of memory allocation results during system operation of the present invention;
图6逻辑地址到物理地址的映射。Figure 6 Logical address to physical address mapping.
具体实施方式 Detailed ways
本发明的典型系统应用环境如图1所示,其中内存管理单元为本发明的一个实例。本发明有三大主要功能:一,分配内存,更新内存记录信息;二,回收内存并更新内存记录信息;三,地址映射。下面结合发明内容中对三个主要功能流程的描述进一步介绍各功能的具体实施方式。The typical system application environment of the present invention is shown in Fig. 1, wherein the memory management unit is an example of the present invention. The present invention has three major functions: first, allocate memory and update memory record information; second, reclaim memory and update memory record information; third, address mapping. The specific implementation of each function will be further introduced below in combination with the description of the three main functional processes in the summary of the invention.
内存分配功能的结构图如图2所示,内存分配流程如图3所示。其中,空闲页资源用计数器和FIFO相结合的方式来管理。在分配的初始阶段,采用计数器分配空闲页,归还的页将存入FIFO中,当所有页都转移到FIFO中后由FIFO管理空闲页。空闲页表管理单元的工作状态由“分配模式控制”寄存器来决定。计数器的引入消除了空闲页表初始化的过程。计数器还有另一个作用,出于实际应用中内存管理单元的鲁棒性考虑,当内存管理单元出现异常时,空闲页表管理单元在判明内存中没有有效数据后,将重新回到初始状态(可以根据保存数据标识符的二进制向量来判断内存中是否存在数据,当该向量为全零时,表示内存中没有有效数据)。这时,只要复位计数器,并将空闲页分配模式重置为初始状态。整个过程可以在单时钟周期内完成,不会影响整个系统的正常工作。The structural diagram of the memory allocation function is shown in Figure 2, and the memory allocation process is shown in Figure 3. Among them, free page resources are managed by combining counters and FIFOs. In the initial stage of allocation, counters are used to allocate free pages, and the returned pages will be stored in FIFO. After all pages are transferred to FIFO, FIFO manages free pages. The working state of the free page table management unit is determined by the "allocation mode control" register. The introduction of counters eliminates the process of free page table initialization. The counter has another function. For the sake of the robustness of the memory management unit in practical applications, when the memory management unit is abnormal, the free page table management unit will return to the initial state ( Whether there is data in the memory can be judged according to the binary vector storing the data identifier, and when the vector is all zeros, it means that there is no valid data in the memory). At this time, it is only necessary to reset the counter and reset the free page allocation mode to the initial state. The whole process can be completed in a single clock cycle without affecting the normal work of the whole system.
内存分配过程中,由状态控制器从空闲页表中读出可用的内存页,将这些内存页写入到数据页表中。数据页表为SRAM结构,并以DataID作为访问的基地址进行读写。当数据对应的内存页全部转移后,分配结束。内存页转移时的时序图如图4所示,其中RdEn为读取FIFO中的可用内存页信息的使能信号,而UpdateCEn用于更新计数器的值,为下一次转移内存页做好准备;WrDataStoreList为数据页表写使能信号;TransFinish用于控制内存页转移是否完成;FreePages为空闲内存页的页号。During the memory allocation process, the state controller reads the available memory pages from the free page table and writes these memory pages into the data page table. The data page table is a SRAM structure, and the DataID is used as the base address for access to read and write. When all the memory pages corresponding to the data are transferred, the allocation ends. The timing diagram of the memory page transfer is shown in Figure 4, where RdEn is the enable signal for reading the available memory page information in the FIFO, and UpdateCEn is used to update the value of the counter to prepare for the next memory page transfer; WrDataStoreList Write enable signal for the data page table; TransFinish is used to control whether the memory page transfer is completed; FreePages is the page number of the free memory page.
内存中每一部分数据都有一个唯一的ID(DataID)与之相对应。DataID用一个二进制数组来表示(bitmap),每一位代表一个DataID,DataID的值由其对应位在bitmap中的位置译码得到。内存分配不但要分配可用的页,同时还要分配可用的DataID,DataID通过“首零检测器”算法得到。首零检测器的输入是DataID对应的bitmap,输出为首个可用的DataID在bitmap中的位置。DataID的位宽可以根据应用调整,如当采用4bit表示DataID,则表示系统中可用的DataID总量为24个。Each part of data in memory has a unique ID (DataID) corresponding to it. DataID is represented by a binary array (bitmap), each bit represents a DataID, and the value of DataID is obtained by decoding the position of its corresponding bit in the bitmap. Memory allocation not only allocates available pages, but also allocates available DataIDs. DataIDs are obtained through the "first zero detector" algorithm. The input of the first zero detector is the bitmap corresponding to the DataID, and the output is the position of the first available DataID in the bitmap. The bit width of the DataID can be adjusted according to the application. For example, when 4 bits are used to represent the DataID, it means that the total number of DataIDs available in the system is 24 .
本发明支持两种内存回收方式:显式和隐式。两种内存回收方式都需要访问数据页表和空闲页表,因此必须处理好两者访问公共资源时的冲突问题。内存的显式回收由主机主动提出,在数据对应的倒计时器计时溢出之前,主机发送指令要求内存管理单元回收这一部分数据所占用的内存资源,指令中需包括要回收的数据对应的DataID;而内存的隐式回收由内存管理单元自动完成,不需要主机参与。当内存分配单元为一条数据成功分配一块内存时,将启动与该块数据对应的一个倒计时器,计时的间隔为1秒,计时的初值T0可以由用户配置,在本发明的实施例中T0取4秒。当倒计时器计时到零时,内存管理单元在内存分配和内存显式回收等任务之外,插入一条低优先级的任务,在数据页表和空闲页表都空闲时,将超时数据对应的内存资源以隐式的方式回收,其中包括将超时数据块占用的内存页从数据页表中依次读出并写入空闲页表中,同时在所有内存页回收后,将该块数据占用的数据标志符对应的二进制向量位重新复位,即回收数据标识符资源。内存隐式回收这一功能由一个专用的状态机控制其状态的转换,避开数据页表和空闲页表访问过程中的冲突问题。The present invention supports two memory recovery methods: explicit and implicit. Both memory reclamation methods need to access the data page table and the free page table, so the conflict between the two accessing common resources must be properly handled. The explicit recovery of memory is initiated by the host. Before the countdown timer corresponding to the data expires, the host sends an instruction to request the memory management unit to reclaim the memory resources occupied by this part of the data. The instruction must include the DataID corresponding to the data to be recycled; The implicit recovery of memory is done automatically by the memory management unit without the participation of the host. When the memory allocation unit successfully allocates a piece of memory for a piece of data, it will start a countdown timer corresponding to the piece of data. The timing interval is 1 second, and the initial value T0 of timing can be configured by the user. In the embodiment of the present invention, T0 Take 4 seconds. When the countdown timer reaches zero, the memory management unit inserts a low-priority task in addition to tasks such as memory allocation and memory explicit recovery. When both the data page table and the free page table are free, the memory corresponding to the data will be timed out. Resources are reclaimed implicitly, which includes sequentially reading the memory pages occupied by the timeout data block from the data page table and writing them into the free page table. The binary vector bit corresponding to the symbol is reset, that is, the data identifier resource is reclaimed. The function of memory implicit reclamation is controlled by a dedicated state machine to change its state, avoiding the conflict problem during the access process of data page table and free page table.
本发明的应用环境中,数据是连续读写的,当主机需要访问内存时,先向内存管理单元写入一条请求读写的指令。其中,当主机读内存时,要在发出读请求的同时,指明需要读取的数据所对应的数据标识符;而当主机需要写内存时,只需发送写请求,数据所对应的标识符由内存管理单元自动管理,该标识符在主机请求内存分配时由内存分配单元分配。读写过程中使用的数据标识符记为ID。内存管理单元在接收到主机需要访问内存的指令时,以所访问数据对应的数据标识符为基地址,偏移为零,组合成一个新地址,读取数据页表中数据存储的首个内存页的页号,并将该页号存入“当前页号”寄存器。其中,地址组合的方式如图6所示。当主机开始访问内存时,内存管理单元截取主机当前访问的逻辑地址的低d位,作为物理地址的低d位,并以“当前页号”寄存器中的值CP为地址的高p位,组合为可以访问内存的物理地址。同时,当主机访问的逻辑地址为一页中的最后一个字节时,内存管理单元在同一个系统周期内,截取主机当前访问的逻辑地址的高p位,将该p位的数据加1(记为p1)并与当前访问数据的数据标识符一起组合成一个新地址,用该地址读取数据页表管理单元中的页号,并在下一个系统周期时,将从数据页表中获得的页号更新到“当前页表”寄存器中。其中p定义为w-d,w为内存中地址线的宽度,d为逻辑地址的页内偏移,相应地,每一片内存页的大小为2d字节(Byte)。地址组合的方式如图6所示。In the application environment of the present invention, data is continuously read and written. When the host needs to access the memory, it first writes an instruction requesting read and write to the memory management unit. Among them, when the host reads the memory, it needs to specify the data identifier corresponding to the data to be read while sending the read request; and when the host needs to write the memory, it only needs to send a write request, and the identifier corresponding to the data is determined by Automatically managed by the memory management unit, this identifier is allocated by the memory allocation unit when the host requests memory allocation. The data identifier used in the read and write process is recorded as ID. When the memory management unit receives an instruction from the host to access the memory, it takes the data identifier corresponding to the accessed data as the base address, offsets it to zero, combines it into a new address, and reads the first memory of the data storage in the data page table. The page number of the page, and store the page number in the "current page number" register. Wherein, the manner of address combination is shown in FIG. 6 . When the host starts to access the memory, the memory management unit intercepts the low d bits of the logical address currently accessed by the host as the low d bits of the physical address, and uses the value CP in the "current page number" register as the high p bits of the address to combine The physical address of the memory that can be accessed. At the same time, when the logical address accessed by the host is the last byte in a page, the memory management unit intercepts the high p bits of the logical address currently accessed by the host in the same system cycle, and adds 1 to the data of the p bits ( Denoted as p1) and combined with the data identifier of the currently accessed data to form a new address, use this address to read the page number in the data page table management unit, and in the next system cycle, the data obtained from the data page table The page number is updated into the "current page table" register. Among them, p is defined as wd, w is the width of the address line in the memory, and d is the page offset of the logical address. Correspondingly, the size of each memory page is 2 d bytes (Byte). The way of address combination is shown in Figure 6.
当主机完成对某一块数据的访问时,需向内存管理单元中写入“结束访问”的指令,内存管理单元复位本次访问使用的寄存器,并等待主机的下一次访问请求。When the host completes access to a certain block of data, it needs to write an "end access" instruction to the memory management unit, and the memory management unit resets the registers used for this access and waits for the next access request from the host.
本发明在系统中的验证结果如图5所示,其中横坐标是系统时间,纵坐标(左)反映本发明中可用内存页数目的实时变化,而纵坐标(右)反映本发明中可用数据ID(DataID)数目的实时变化。The verification result of the present invention in the system is as shown in Figure 5, wherein the abscissa is the system time, the ordinate (left) reflects the real-time variation of the number of available memory pages in the present invention, and the ordinate (right) reflects the available data in the present invention Real-time changes in the number of IDs (DataIDs).
Claims (1)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN200810059862A CN100590609C (en) | 2008-02-22 | 2008-02-22 | A Dynamic Memory Management Method Based on Discontinuous Pages |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN200810059862A CN100590609C (en) | 2008-02-22 | 2008-02-22 | A Dynamic Memory Management Method Based on Discontinuous Pages |
Publications (2)
Publication Number | Publication Date |
---|---|
CN101231619A CN101231619A (en) | 2008-07-30 |
CN100590609C true CN100590609C (en) | 2010-02-17 |
Family
ID=39898112
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN200810059862A Expired - Fee Related CN100590609C (en) | 2008-02-22 | 2008-02-22 | A Dynamic Memory Management Method Based on Discontinuous Pages |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN100590609C (en) |
Families Citing this family (27)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101667105B (en) * | 2009-09-02 | 2011-12-28 | 龙芯中科技术有限公司 | Dispatching device and method for dynamically reading, writing, accessing and grouping dynamic memories |
CN101901191A (en) * | 2010-05-31 | 2010-12-01 | 深圳市茁壮网络股份有限公司 | Method and device for managing multiclass memories of embedded system |
CN102023821A (en) * | 2010-12-16 | 2011-04-20 | 成都市华为赛门铁克科技有限公司 | Disc space management method and system |
CN102123198A (en) * | 2011-01-11 | 2011-07-13 | 中国联合网络通信集团有限公司 | Memory management method and memory manager for media player |
CN104011645B (en) * | 2011-12-22 | 2018-06-26 | 英特尔公司 | For generating integer phase difference constant integer span wherein in continuous position and smallest positive integral is from the processor of the integer sequence of zero offset integer shifts, method, system and medium containing instruction |
US9753860B2 (en) * | 2012-06-14 | 2017-09-05 | International Business Machines Corporation | Page table entry consolidation |
CN104008061B (en) * | 2013-02-22 | 2018-01-23 | 华为技术有限公司 | Method for recovering internal storage and device |
CN104169891B (en) * | 2013-10-29 | 2017-07-21 | 华为技术有限公司 | A kind of method and apparatus for accessing internal memory |
CN103593300B (en) * | 2013-11-15 | 2017-05-03 | 浪潮电子信息产业股份有限公司 | Memory allocating and collecting method |
CN104090848B (en) * | 2014-07-16 | 2017-03-08 | 云南大学 | EMS memory management process and device that a kind of periodicity big data is processed |
KR102501751B1 (en) * | 2015-09-22 | 2023-02-20 | 삼성전자주식회사 | Memory Controller, Non-volatile Memory System and Operating Method thereof |
CN107291556B (en) * | 2017-08-01 | 2021-01-22 | 上海联影医疗科技股份有限公司 | Medical equipment, memory allocation method and device thereof and storage medium |
CN107704199A (en) * | 2017-09-07 | 2018-02-16 | 郑州云海信息技术有限公司 | A kind of logical partition method and device of solid state hard disc |
CN107864391B (en) * | 2017-09-19 | 2020-03-13 | 北京小鸟科技股份有限公司 | Video stream cache distribution method and device |
CN107908428B (en) * | 2017-11-24 | 2021-09-14 | 中国航空工业集团公司西安航空计算技术研究所 | Frame and page synchronous GPU (graphics processing Unit) graphics instruction buffer synchronization method |
CN109992522A (en) * | 2017-12-29 | 2019-07-09 | 广东欧珀移动通信有限公司 | Application processing method and apparatus, electronic device, computer-readable storage medium |
CN108804032B (en) * | 2018-05-16 | 2021-05-18 | 山东华芯半导体有限公司 | Self-adaptive wear-balanced garbage recovery accelerating device and method |
CN108717395B (en) * | 2018-05-18 | 2021-07-13 | 记忆科技(深圳)有限公司 | Method and device for reducing memory occupied by dynamic block mapping information |
CN109284234B (en) * | 2018-09-05 | 2020-12-04 | 珠海昇生微电子有限责任公司 | Storage address allocation method and system |
CN110688330B (en) * | 2019-09-23 | 2021-08-31 | 北京航空航天大学 | A Virtual Memory Address Translation Method Based on Memory Map Adjacency |
CN110727606A (en) * | 2019-09-27 | 2020-01-24 | Oppo(重庆)智能科技有限公司 | Memory recovery method and device and electronic equipment |
CN110928682B (en) * | 2019-11-13 | 2023-06-09 | 深圳国微芯科技有限公司 | Method for accessing computer memory by external device |
CN111813710B (en) * | 2020-09-11 | 2021-02-05 | 鹏城实验室 | Method and device for avoiding Linux kernel memory fragmentation and computer storage medium |
CN113849511B (en) * | 2021-09-24 | 2024-11-26 | 中控技术股份有限公司 | A method and device for writing data from a host computer |
CN114201444B (en) * | 2021-12-06 | 2023-11-14 | 海飞科(南京)信息技术有限公司 | Method, medium, program product, system, and apparatus for storage management |
CN114510441B (en) * | 2021-12-28 | 2025-03-21 | 阿里巴巴(中国)有限公司 | Page table cache optimization method and page table update method |
CN117957527A (en) * | 2022-08-30 | 2024-04-30 | 晶晨半导体(上海)股份有限公司 | Memory management method and module, chip, electronic device and storage medium |
-
2008
- 2008-02-22 CN CN200810059862A patent/CN100590609C/en not_active Expired - Fee Related
Also Published As
Publication number | Publication date |
---|---|
CN101231619A (en) | 2008-07-30 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN100590609C (en) | A Dynamic Memory Management Method Based on Discontinuous Pages | |
CN104636285B (en) | A flash memory storage system and method for reading, writing and deleting thereof | |
US8683126B2 (en) | Optimal use of buffer space by a storage controller which writes retrieved data directly to a memory | |
CN110730945B (en) | Scalable low latency memory interface | |
EP3608790B1 (en) | Modifying nvme physical region page list pointers and data pointers to facilitate routing of pcie memory requests | |
US10049035B1 (en) | Stream memory management unit (SMMU) | |
US20160124639A1 (en) | Dynamic storage channel | |
WO2018024214A1 (en) | Io flow adjustment method and device | |
TW202015044A (en) | Data management method and storage controller using the same | |
WO2024099448A1 (en) | Memory release method and apparatus, memory recovery method and apparatus, and computer device and storage medium | |
CN109213423A (en) | Concurrent I/O command is handled without lock based on address barrier | |
CN110321057B (en) | Storage device with cache to enhance IO performance certainty | |
CN114610654B (en) | A solid-state storage device and a method for writing data thereto | |
CN107577492A (en) | The NVM block device drives method and system of accelerating file system read-write | |
US9417805B2 (en) | Exporting computational capabilities into a block-oriented disk memory | |
CN115586943B (en) | Hardware marking implementation method for dirty pages of virtual machine of intelligent network card | |
US12175128B2 (en) | Nonvolatile storage device, host, and method of controlling nonvolatile storage device | |
TWI534619B (en) | Methods for logical partitioning dynamically and apparatuses using the same | |
CN111694777B (en) | DMA transmission method based on PCIe interface | |
US20180081580A1 (en) | Buffer Allocation and Memory Management | |
US9424227B2 (en) | Providing byte enables for peer-to-peer data transfer within a computing environment | |
CN118331512B (en) | Processing method and device based on memory control card | |
CN117851290B (en) | Page table management method, system, electronic component and electronic device | |
CN109213424A (en) | Concurrent I/O command without lock processing method | |
CN119229912A (en) | NVMe write IO initiator circuit of NVMe controller |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
C17 | Cessation of patent right | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20100217 Termination date: 20130222 |