KR102275871B1 - A buffer management method for efficiently processing transmission and reception data and communication system - Google Patents
A buffer management method for efficiently processing transmission and reception data and communication system Download PDFInfo
- Publication number
- KR102275871B1 KR102275871B1 KR1020180165376A KR20180165376A KR102275871B1 KR 102275871 B1 KR102275871 B1 KR 102275871B1 KR 1020180165376 A KR1020180165376 A KR 1020180165376A KR 20180165376 A KR20180165376 A KR 20180165376A KR 102275871 B1 KR102275871 B1 KR 102275871B1
- Authority
- KR
- South Korea
- Prior art keywords
- memory
- descriptor
- memory block
- pool
- buffer
- 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.)
- Active
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L49/00—Packet switching elements
- H04L49/90—Buffering arrangements
- H04L49/9047—Buffering arrangements including multiple buffers, e.g. buffer pools
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L49/00—Packet switching elements
- H04L49/90—Buffering arrangements
- H04L49/9005—Buffering arrangements using dynamic buffer space allocation
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L49/00—Packet switching elements
- H04L49/90—Buffering arrangements
- H04L49/9015—Buffering arrangements for supporting a linked list
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer And Data Communications (AREA)
Abstract
통신 시스템에서 송수신 데이터를 저장하기 위한 버퍼의 저장 공간을 생성하고 해제하는 버퍼 관리 방법이 개시된다. 상기 버퍼 관리 방법은, 물리적 메모리 영역에 존재하는 디스크립터 풀(descriptor pool)과 메모리 블록 풀(memory block pool)로서, 다수의 디스크립터(descriptor)를 상기 디스크립터 풀에 미리 할당하고, 다수의 메모리 블록을 상기 메모리 블록 풀에 미리 할당하는 단계; 상기 디스크립터 풀로부터 하나의 디스크립터를 할당받고, 상기 메모리 블록 풀로부터 일정 개수의 메모리 블록들을 할당받는 단계; 및 상기 하나의 디스크립터와 상기 일정 개수의 메모리 블록들을 링크드 리스트 구조(linked list structure)로 연결하는 방식으로 상기 버퍼의 저장 공간을 생성하는 단계를 포함한다.A buffer management method for creating and releasing a storage space of a buffer for storing transmission/reception data in a communication system is disclosed. In the buffer management method, as a descriptor pool and a memory block pool existing in a physical memory area, a plurality of descriptors are allocated in advance to the descriptor pool, and the plurality of memory blocks are allocated to the pre-allocating a memory block pool; receiving one descriptor from the descriptor pool and receiving a predetermined number of memory blocks from the memory block pool; and creating a storage space of the buffer by connecting the one descriptor and the predetermined number of memory blocks in a linked list structure.
Description
본 발명은 통신 시스템에서 송수신 데이터의 저장 공간을 필요한 크기만큼 동적으로 할당하고 해제하도록 처리하는 버퍼 관리 기술이다.The present invention is a buffer management technology for dynamically allocating and releasing a storage space for transmission/reception data by a required size in a communication system.
통신 시스템에서 송수신 데이터를 임시로 버퍼에 저장하거나 읽어오는 과정은 매우 빈번하게 이루어진다. 또한 송수신 데이터의 길이는 어플리케이션에 따라 가변적으로 변하기 때문에 데이터 저장공간인 버퍼도 가변적으로 활용해야 한다. In a communication system, a process of temporarily storing or reading transmission/reception data in a buffer is performed very frequently. In addition, since the length of the transmitted/received data is variably changed according to the application, a buffer, which is a data storage space, must be used variably.
버퍼를 가변적으로 운영하기 위한 일반적인 방법은 malloc() 함수를 사용하여 힙(Heap) 영역에서 필요한 크기만큼 동적으로 메모리를 할당받고 더 이상필요 없을 시 free() 함수를 이용해 힙(Heap) 영역에 다시 메모리를 반납하는 방법이다.The general method for variable operation of the buffer is to use the malloc() function to dynamically allocate memory as much as the required size in the heap area, and when it is no longer needed, use the free() function to re-create it in the heap area. How to free memory.
예를 들어, 힙(Heap)영역에서 동적으로 메모리를 할당하게 되면 일반적으로 도 1과 같이 순서대로 메모리를 할당해 준다. 그런데 메모리 해제는 할당된 순서와 상관없이 수행되기 때문에 중간에 두 번째 할당영역과 세 번째 할당영역이 순차적으로 해제 될 수 있다. For example, if memory is dynamically allocated in the heap area, memory is generally allocated in order as shown in FIG. 1 . However, since memory release is performed regardless of the allocation order, the second and third allocation areas may be sequentially released in the middle.
그 이후 900byte 크기 힙(Heap) 메모리를 할당하려고 할 때 이미 해제된 두 번째, 세 번째, 힙 영역의 크기가 900byte 보다 작기 때문에 네 번째 힙 할당영역 뒤에 순차적으로 할당된다. 이렇게 중간에 재사용 가능한 힙 영역이 있는데도 불구하고 중간에 비어있는 영역이 존재하는 것을 "메모리 단편화(memory fragmentation)"라고 한다. After that, when trying to allocate 900 bytes of heap memory, since the size of the already freed second, third, and heap areas are smaller than 900 bytes, they are sequentially allocated after the fourth heap allocation area. Even though there is a reusable heap area in the middle, an empty area in the middle is called "memory fragmentation".
메모리 단편화는 힙(Heap) 영역에서 동적 할당과 해제를 반복할수록 발생확률이 높아지기 때문에 메모리 공간 사용의 효율성 떨어지고 또한 해제 영역에 대한 재사용 가능성을 체크하는 절차로 인해 힙(Heap) 할당에 걸리는 시간이 지연되는 문제점이 발생한다.Memory fragmentation is more likely to occur as dynamic allocation and deallocation are repeated in the heap area, so the efficiency of using memory space decreases and the time taken for heap allocation is delayed due to the procedure of checking the reusability of the freed area. problems arise.
본 발명의 목적은 통신시스템에서 송수신 데이터를 저장하고 읽어오는데 사용하는 버퍼를 가변적인 송수신 데이터의 크기에 따라 동적으로 메모리를 할당을 받을 수 있으며, 더 이상 버퍼를 사용하지 않을 경우 버퍼에 할당된 메모리를 반환하여 자원의 효율성을 높일 수 있는 버퍼 관리 방법을 제공하는 데 있다.An object of the present invention is that a buffer used to store and read transmission/reception data in a communication system can be dynamically allocated memory according to a variable size of transmission/reception data, and when the buffer is no longer used, the memory allocated to the buffer It is to provide a buffer management method that can increase resource efficiency by returning
상술한 목적을 달성하기 위한 본 발명의 일면에 따른 버퍼 관리 방법은, 물리적 메모리 영역에 존재하는 디스크립터 풀(descriptor pool)과 메모리 블록 풀(memory block pool)로서, 다수의 디스크립터(descriptor)를 상기 디스크립터 풀에 미리 할당하고, 다수의 메모리 블록을 상기 메모리 블록 풀에 미리 할당하는 단계; 상기 디스크립터 풀로부터 하나의 디스크립터를 할당받고, 상기 메모리 블록 풀로부터 일정 개수의 메모리 블록들을 할당받는 단계; 및 상기 하나의 디스크립터와 상기 일정 개수의 메모리 블록들을 링크드 리스트 구조(linked list structure)로 연결하는 방식으로 상기 버퍼의 저장 공간을 생성하는 단계를 포함한다.A buffer management method according to an aspect of the present invention for achieving the above object is a descriptor pool and a memory block pool existing in a physical memory area, and includes a plurality of descriptors as the descriptors. pre-allocating a pool and pre-allocating a plurality of memory blocks to the memory block pool; receiving one descriptor from the descriptor pool and receiving a predetermined number of memory blocks from the memory block pool; and creating a storage space of the buffer by connecting the one descriptor and the predetermined number of memory blocks in a linked list structure.
본 발명의 다른 일면에 따른 통신 시스템은, 다수의 디스크립터를 포함하는 디스크립터 풀(descriptor pool)과 다수의 메모리 블록을 포함하는 메모리 블록 풀(memory block pool)이 존재하는 물리적 메모리 영역을 갖는 메모리; 및 상기 디스크립터 풀로부터 하나의 디스크립터를 할당받고, 상기 메모리 블록 풀로부터 일정 개수의 메모리 블록들을 할당받고, 상기 하나의 디스크립터와 상기 일정 개수의 메모리 블록들을 링크드 리스트 구조(linked list structure)로 연결하여, 상기 버퍼의 저장 공간을 생성하는 프로세서;를 포함한다.A communication system according to another aspect of the present invention includes a memory having a physical memory area in which a descriptor pool including a plurality of descriptors and a memory block pool including a plurality of memory blocks exist; and one descriptor is allocated from the descriptor pool, a predetermined number of memory blocks are allocated from the memory block pool, and the one descriptor and the predetermined number of memory blocks are connected in a linked list structure, and a processor that creates a storage space of the buffer.
본 발명에 따르면, 송수신 데이터의 저장 공간인 버퍼에 대한 메모리 할당과 해제를 계속 반복하더라도 힙(Heap) 영역처럼 메모리 단편화가 증가하지 않아 메모리 재활용성이 용이하고, 이로 인해 메모리 할당에 대한 지연시간 또한 증가하지 않는다.According to the present invention, even if memory allocation and release for the buffer, which is a storage space for transmitting and receiving data, is repeatedly repeated, memory fragmentation does not increase as in the heap area, so memory recyclability is easy, and thus the delay time for memory allocation is also does not increase
도 1은 종래의 힙(Heap) 영역에서 동적 할당과 해제를 반복함에 따라 발생확률이 높아지는 메모리 단편화를 설명하기 위한 도면이다.
도 2는 본 발명의 실시 예에 따른 버퍼 풀에서 메모리 할당방법을 설명하기 위한 개념도.
도 3은 본 발명의 실시 예에 따른 송수신 데이터를 저장하기 위한 1개의 버퍼를 생성 과정을 도시한 순서도.
도 4는 본 발명의 실시 예에 따른 버퍼 풀로부터 디스크립터와 메모리블록을 할당받아 송수신 기본 단위인 데이터를 저장하기 위한 버퍼의 구조도.
도 5는 본 발명에 일 실시 예에 따른 버퍼 해제 및 버퍼 풀에 메모리를 반납하는 과정을 도식적으로 나타낸 개념도.
도 6은 본 발명의 버퍼 생성 과정에 따른 버퍼 관리 방법이 적용되는 통신 시스템을 나타내는 블록도.1 is a diagram for explaining memory fragmentation, in which the probability of occurrence increases as dynamic allocation and release are repeated in a conventional heap area.
2 is a conceptual diagram for explaining a memory allocation method in a buffer pool according to an embodiment of the present invention.
3 is a flowchart illustrating a process of generating one buffer for storing transmission/reception data according to an embodiment of the present invention.
4 is a structural diagram of a buffer for storing data that is a basic unit of transmission and reception by receiving descriptors and memory blocks allocated from a buffer pool according to an embodiment of the present invention;
5 is a conceptual diagram schematically illustrating a process of releasing a buffer and returning a memory to a buffer pool according to an embodiment of the present invention;
6 is a block diagram illustrating a communication system to which a buffer management method according to a buffer generation process of the present invention is applied.
본 발명의 전술한 목적 및 그 이외의 목적과 이점 및 특징, 그리고 그것들을 달성하는 방법은 첨부되는 도면과 함께 상세하게 후술되어 있는 실시예들을 참조하면 명확해질 것이다. The above and other objects, advantages and features of the present invention, and a method of achieving them will become apparent with reference to the embodiments described below in detail in conjunction with the accompanying drawings.
그러나 본 발명은 이하에서 개시되는 실시예들에 한정되는 것이 아니라 서로 다른 다양한 형태로 구현될 수 있으며, 단지 이하의 실시예들은 본 발명이 속하는 기술분야에서 통상의 지식을 가진 자에게 발명의 목적, 구성 및 효과를 용이하게 알려주기 위해 제공되는 것일 뿐으로서, 본 발명의 권리범위는 청구항의 기재에 의해 정의된다. However, the present invention is not limited to the embodiments disclosed below, but can be implemented in various different forms, and only the following examples are provided to those of ordinary skill in the art to which the present invention pertains to the purpose of the invention, It is only provided to easily inform the configuration and effect, and the scope of the present invention is defined by the description of the claims.
한편, 본 명세서에서 사용된 용어는 실시예들을 설명하기 위한 것이며 본 발명을 제한하고자 하는 것은 아니다. 본 명세서에서, 단수형은 문구에서 특별히 언급하지 않는 한 복수형도 포함한다. 명세서에서 사용되는 "포함한다(comprises)" 및/또는 "포함하는(comprising)"은 언급된 구성소자, 단계, 동작 및/또는 소자가 하나 이상의 다른 구성소자, 단계, 동작 및/또는 소자의 존재 또는 추가됨을 배제하지 않는다.On the other hand, the terms used herein are for the purpose of describing the embodiments and are not intended to limit the present invention. As used herein, the singular also includes the plural unless specifically stated otherwise in the phrase. As used herein, "comprises" and/or "comprising" means that a referenced element, step, operation and/or element is the presence of one or more other elements, steps, operations and/or elements. or added.
본 발명은 C 언어에서 제공하는 힙(Heap) 메모리에 대한 할당 함수(malloc())와 해제 함수(free())를 사용하지 않고 디스크립터와 메모리블록으로 구성된 버퍼 풀을 기반으로 송수신 버퍼를 동적으로 할당하고 해제하는 자체 메커니즘 방식으로 동작하는 버퍼 관리 방법을 제공함을 특징으로 한다.The present invention does not use the allocation function (malloc()) and the free function (free()) for the heap memory provided by the C language, but dynamically allocates the transmit/receive buffer based on the buffer pool composed of descriptors and memory blocks. It is characterized by providing a buffer management method that operates in its own mechanism of allocating and freeing.
도 2는 본 발명의 실시 예에 따른 버퍼 풀에서 메모리 할당방법을 설명하기 위한 개념도.2 is a conceptual diagram for explaining a memory allocation method in a buffer pool according to an embodiment of the present invention.
도 2를 참조하면, 본 발명의 실시 예에 따른 송수신 데이터(또는 송수신 패킷)의 저장 공간인 버퍼(100)는, 디스크립터(Descriptor)(112)와 메모리 블록(Memory Block)(122)을 버퍼 풀(Buffer Pool) 형태로 운영할 있도록 구성된다.Referring to FIG. 2 , the
이를 위해, 버퍼 풀은 디스크립터 풀(110, Descriptor Pool 또는 디스크립터의 버퍼 풀)과 메모리 블록 풀(120, Memory Block Pool 또는 메모리 블록의 버퍼 풀)을 포함한다. To this end, the buffer pool includes a descriptor pool 110 (Descriptor Pool or a descriptor buffer pool) and a memory block pool 120 (Memory Block Pool or a memory block buffer pool).
버퍼 풀은 물리적인 메모리 영역에 존재하고 버퍼 초기화 시 고정된 크기의 디스크립터(112)와 메모리 블록(122)을 각각의 버퍼 풀 영역(디스크립터 풀(110)과 메모리 블록 풀(120))에 미리 할당하여 도 2에 도시된 바와 같이 필요한 시점마다 빠르게 각각의 버퍼 풀 영역(디스크립터 풀(110)과 메모리 블록 풀(120))으로부터 디스크립터와 메모리블록을 할당 받을 수 있다. The buffer pool exists in a physical memory area, and when the buffer is initialized,
도 3은 본 발명의 실시 예에 따른 송수신 데이터를 저장하기 위한 1개의 버퍼의 저장공간을 생성하는 과정을 도시한 순서도이다. 설명의 이해를 돕기 위해 도 2가 함께 참조된다. 아래의 각 단계의 수행 주체는 통신 시스템에서의 송수신 데이터(송수신 패킷)를 효율적으로 처리하도록 버퍼를 관리하는 프로세서일 수 있다. 3 is a flowchart illustrating a process of creating a storage space of one buffer for storing transmission/reception data according to an embodiment of the present invention. FIG. 2 is referred to together to facilitate understanding of the description. A subject performing each of the steps below may be a processor that manages a buffer to efficiently process transmission/reception data (transmission/reception packets) in a communication system.
다만, 아래의 모든 단계의 수행 주체를 프로세서로 한정하여 설명하면, 각 단계의 동작을 수행하는 주체가 무엇인지 불명확해질 수 있기 때문에, 이해를 돕기 위해, 각 단계를 수행하는데 가장 적절한 대상을 수행주체로 기술한다. 그렇지만, 각 단계의 수행 주체는 하나의 프로세서 또는 서로 다른 프로세서라는 하드웨어 수단으로 구체화될 수 있으며, 이는 당업자에게는 자명하다 However, if the subject performing all the steps below is limited to the processor, it may become unclear what the subject performing the operation of each step is. described as However, the subject performing each step may be embodied in hardware means such as one processor or different processors, which will be apparent to those skilled in the art.
도 3을 참조하면, 먼저, S311에서, 디스크립터 풀(110)에서 할당받을 수 있는 디스크립터가 존재하는지를 판단하는 과정이 수행된다. Referring to FIG. 3 , first, in S311 , a process of determining whether there is a descriptor that can be allocated from the
이어, S313에서, 디스크립터 풀(110)에 버퍼 풀에 할당받을 수 있는 디스크립터가 존재하면, 디스크립터 풀(110)로부터 디스크립터(112)를 1개 할당을 받고, 디스크립터 풀(110)에 할당받을 수 있는 디스크립터가 존재하지 않으면, 버퍼 생성을 실패로 판단하여 버퍼 생성 과정을 종료한다.Next, in S313, if there is a descriptor that can be allocated to the buffer pool in the
이어, S315에서, 전단계(S313)의 수행에 따라 디스크립터 풀(110)로부터 1개의 디스크립터(112)를 할당받으면, 데이터 크기에 따른 메모리 블록 개수를 계산하는 과정이 수행된다. 데이터 크기에 적합한 메모리 블록의 개수는 아래의 수학식 1에 따라 계산될 수 있다.Next, in S315, when one
여기서, BlockCount는 최종 계산값인 메모리 블록의 개수로서, 정수값이며, DataSize는 송수신 데이터의 실제크기, BlockSize는 메모리 블록의 저장 공간의 크기이다.Here, BlockCount is the number of memory blocks that is the final calculated value, and is an integer value, DataSize is the actual size of transmitted and received data, and BlockSize is the size of the storage space of the memory block.
이어, S317에서, 수학식 1의 계산 과정에서 나머지 값이 생성하는 지를 판단한다. Next, in S317, it is determined whether the remaining values are generated in the calculation process of
나머지 값이 생성되지 않으면, 단계 S321를 진행하여 수학식 1에 따라 계산된 메모리 블록의 개수(BlockCount)만큼 순차적으로 메모리 블록 풀(도 2의 120)에서 메모리 블록(122)들을 할당받아 링크드 리스트 구조(linked list structure)로 단계 S313에서 할당 받은 디스크립터와 단계 S323에서 할당 받은 메모리 블록(122)들을 연결한다.If the remaining values are not generated, the linked list structure is sequentially allocated to the
만약 계산 과정에서 나머지 값이 생성되는 경우, S310에서, 메모리 블록의 개수(BlockCount)를 1 증가 시키고, 단계 S321에서, 증가된 메모리 블록의 개수(BlockCount)만큼 순차적으로 메모리 블록 풀(도 2의 120)에서 메모리 블록(122)들을 할당받아서 링크드 리스트 구조(linked list structure)로 단계 S313에서 할당 받은 디스크립터와 할당 받은 메모리 블록(122)들을 연결한다.If the remaining values are generated in the calculation process, in S310, the number of memory blocks (BlockCount) is incremented by 1, and in step S321, the memory block pool (120 in FIG. ) in which the
만약 메모리 블록들을 링크드 리스트 구조로 연결하는 과정에서 메모리 블록 풀(120)에서 할당받을 수 있는 메모리 블록 존재하지 않는다면, 버퍼 생성을 실패라고 판단하여 기존에 할당 받은 메모리 블록을 전부 메모리 블록 풀(120)에 반납(해제)하여, 버퍼의 저장 공간 생성 과정을 종료한다. If there is no memory block that can be allocated from the
도 4는 본 발명의 실시 예에 따른 버퍼 풀로부터 디스크립터와 메모리블록을 할당받아 송수신 기본 단위인 데이터를 저장하기 위한 버퍼의 구조도이다. 4 is a structural diagram of a buffer for storing data, which is a basic transmission/reception unit, by receiving a descriptor and a memory block allocated from a buffer pool according to an embodiment of the present invention.
도 4를 참조하면, 본 발명의 실시 예에 따라 버퍼는 일반적으로 연속적인 데이터를 저장할 수 있는 일반적인 버퍼의 구조와 달리, 디스크립터(112)의 메모리 블록 필드는 첫 번째 메모리 블록(MB)에 연결되고 첫 번째 메모리 블록(MB1)의 메보리 블록 필드(F1)는 두 번째 메모리 블록(MB2)에 연결되는 방식으로 마지막 메모리 블록(MB6)까지 같은 방식으로 연결된다. 이렇게 1개의 디스크립터(112)와 다수의 메모리 블록(MB1~MB6)은 순차적으로 연결되어 있는 링크드 리스트 형태의 버퍼 구조로 되어있다. Referring to FIG. 4 , the buffer according to an embodiment of the present invention is different from the structure of a general buffer capable of storing generally continuous data, the memory block field of the
데이터를 송수신 하는데 필요한 부가정보(프레임 길이, 프레임 종류, 전송속도, 전송시간 등)는 디스크립터(112)에 기록된다. 부가 정보는, 예를 들면, 프레임 길이, 프레임 종류, 전송속도, 전송시간 등을 포함한다. 따라서, 디스크립터(112)는 프레임 길이가 기록되는 필드(F1), 프레임 종류가 기록되는 필드(F2), 전송속도가 기록되는 필드(F3), 전송 시간이 기록되는 필드(F4)로 구성될 수 있다. Additional information (frame length, frame type, transmission rate, transmission time, etc.) necessary for transmitting and receiving data is recorded in the
추가로, 디스크립터(112)는 첫 번째 메모리 블록(MB1) 주소가 기록되는 필드(Fn)를 더 포함하도록 구성될 수 있다. 이와 같이, 필드(Fn)에 첫 번째 메모리 블록(MB1) 주소가 기록됨으로써, 디스크립터(112)와 첫 번째 메모리 블록(MB1)이 연결된다.Additionally, the
실제 데이터 페이로드(또는 데이터)는 각 메모리 블록에 저장된다. 따라서, 각 메모리 블록은 실제 데이터 페이로드가 저장되는 필드(F2)로 구성될 수 있다.The actual data payload (or data) is stored in each memory block. Accordingly, each memory block may be configured with a field F2 in which an actual data payload is stored.
추가로, 각 메모리 블록은 다음 메모리 블록의 주소가 기록되는 메모리 블록 필드(F1)를 포함하도록 구성될 수 있다. 이와 같이, 각 메모리 블록의 메모리 블록 필드에 다음 메모리 블록 주소가 기록됨으로써, 전체 메모리 블록들은 링크드 리스트 구조로 연결될 수 있게 된다.Additionally, each memory block may be configured to include a memory block field F1 in which the address of the next memory block is written. As described above, since the next memory block address is written in the memory block field of each memory block, all memory blocks can be connected in a linked list structure.
한편, 데이터의 크기가 메모리 블록의 데이터 필드(F2)의 공간보다 클 경우 메모리 블록과 연결되어 있는 다른 메모리 블록들의 데이터 필드에 분할하여 저장할 수 있다. Meanwhile, when the size of data is larger than the space of the data field F2 of the memory block, the data may be divided and stored in data fields of other memory blocks connected to the memory block.
링크드 리스트 구조로 연결된 메모리 블록의 개수는 메모리 블록 1개에 저장할 수 있는 공간의 크기와 송수신 데이터의 전송크기에 따라 가변적이다. 예를 들어 만약 메모리 블록에 Data 필드에 저장할 수 있는 공간이 256Byte이고 송신 데이터의 최대 전송크기가 1518byte이라면 1536byte(256byte x 6) 버퍼공간을 확보할 수 있는 6개의 메모리 블록이 필요하다. The number of memory blocks connected in a linked list structure is variable depending on the size of the space that can be stored in one memory block and the size of transmission/reception data. For example, if the space that can be stored in the Data field in the memory block is 256 bytes and the maximum transmission size of the transmitted data is 1518 bytes, 6 memory blocks that can secure the 1536 bytes (256 bytes x 6) buffer space are required.
이렇게 송신 데이터의 최대 크기보다 메모리 블록 1개의 데이터 저장 공간의 크기를 작게 하는 이유는 가변적인 송수신 데이터 크기에 따라 메모리 블록의 개수를 가변적으로 운영하여 메모리 블록의 낭비를 최소화 하고 버퍼공간의 활용성을 극대화하기 위함이다.The reason that the size of the data storage space of one memory block is smaller than the maximum size of transmission data is that the number of memory blocks is variably operated according to the variable transmission/reception data size to minimize waste of memory blocks and improve the utilization of buffer space in order to maximize
도 5는 본 발명에 일 실시 예에 따른 버퍼 해제 및 버퍼풀에 메모리를 반납하는 과정을 도식적으로 나타낸 개념도이다.5 is a conceptual diagram schematically illustrating a process of releasing a buffer and returning a memory to a buffer pool according to an embodiment of the present invention.
도 5를 참조하면, 송신 데이터를 성공적으로 전송했거나 수신 데이터를 이미 처리했다면 동적으로 할당된 버퍼는 더 이상 필요하지 않기 때문에 도 5와 같이 사용한 버퍼를 해제하기 위해서, 먼저 디스크립터(112)에 연결되어 있는 첫 번째 메모리 블록(MB1)에서부터 마지막 메모리 블록(MB6) 까지 순차적으로 주소 링크를 따라 가면서 각각의 메모리 블록을 메모리 블록 풀(120)에 모두 반납해준다. Referring to FIG. 5 , if the transmission data has been successfully transmitted or the reception data has already been processed, the dynamically allocated buffer is no longer needed. In order to release the buffer used as shown in FIG. 5 , it is connected to the
그 이후 최종적으로 디스크립터(112)를 디스크립터 풀(110)에 반납하는 과정을 수행한다.After that, a process of finally returning the
이상 설명한 바와 같이, 메모리 풀 없이 동적 할당과 해제를 반복하면 메모리의 랜덤한 위치에 할당과 해제가 반복되면서 메모리 단편화를 일으킬 수 있겠지만 미리 공간을 할당해 놓고 가져다 쓰고 반납하기 때문에 할당과 해제로 인한 메모리 단편화가 발생하지 않는다.As described above, if dynamic allocation and deallocation are repeated without a memory pool, memory fragmentation may occur as allocation and deallocation are repeated in random locations of memory. No fragmentation occurs.
도 6은 본 발명의 버퍼 생성 과정에 따른 버퍼 관리 방법이 적용되는 통신 시스템을 나타내는 블록도이다.6 is a block diagram illustrating a communication system to which a buffer management method according to a buffer generation process of the present invention is applied.
도 6을 참조하면, 통신 시스템(600)은 버스(6200)를 통해 연결되는 적어도 하나의 프로세서(610), 메모리(630), 사용자 인터페이스 입력 장치(640), 사용자 인터페이스 출력 장치(650), 스토리지(660), 및 네트워크 인터페이스(670)를 포함할 수 있다.Referring to FIG. 6 , the
프로세서(610)는 중앙 처리 장치(CPU) 또는 메모리(630) 및/또는 스토리지(660)에 저장된 명령어들에 대한 처리를 실행하는 반도체 장치일 수 있다. The
일 예에서, 프로세서(610)의 실행에 따라, 하나의 메모리 블록이 저장할 수 있는 공간의 크기와 상기 송수신 데이터의 크기에 따라 상기 메모리 블록의 일정 개수가 계산될 수 있다.In one example, according to the execution of the
다른 예에서, 프로세서(610)의 실행에 따라, 아래의 수학식 1에 따라 상기 송수신 데이터의 크기에 적합한 상기 일정 개수가 계산되고In another example, according to the execution of the
상기 수학식 1은, 이다.
여기서, BlockCount는 최종 계산값인 메모리 블록의 일정 개수로서, 정수값이며, DataSize는 송수신 데이터의 실제크기, BlockSize는 메모리 블록의 저장 공간의 크기인Here, BlockCount is a certain number of memory blocks that are the final calculated value, and is an integer value, DataSize is the actual size of transmitted and received data, and BlockSize is the size of the storage space of the memory block
또 다른 예에서, 프로세서(610)의 실행에 따라, 상기 하나의 디스크립터에 링크드 리스트 구조(linked list structure)로 연결된 첫 번째 메모리블록에서부터 마지막 메모리블록까지 순차적으로 주소 링크를 따라가면서 각 메모리 블록을 상기 메모리 블록 풀에 모두 반납한 후, 각 메모리 블록의 반납이 완료되면, 상기 하나의 디스크립터를 디스크립터 풀에 반납하여, 상기 버퍼의 저장 공간을 해제하는 과정이 수행된다.In another example, according to the execution of the
메모리(630) 및 스토리지(660)는 다양한 종류의 휘발성 또는 불휘발성 저장 매체를 포함할 수 있다. 예를 들어, 메모리(630)는 ROM(Read Only Memory) 및 RAM(Random Access Memory)을 포함할 수 있다.The
일 예에서, 메모리(630)는 다수의 디스크립터를 포함하는 디스크립터 풀(descriptor pool)과 다수의 메모리 블록을 포함하는 메모리 블록 풀(memory block pool)이 존재하는 물리적 메모리 영역을 갖도록 구성될 수 있다.In one example, the
본 명세서에 개시된 실시예들과 관련하여 설명된 방법 또는 알고리즘의 단계는 프로세서(610)에 의해 실행되는 하드웨어, 소프트웨어 모듈, 또는 그 2 개의 결합으로 직접 구현될 수 있다. The steps of a method or algorithm described in connection with the embodiments disclosed herein may be implemented directly in hardware executed by the
소프트웨어 모듈은 RAM 메모리, 플래시 메모리, ROM 메모리, EPROM 메모리, EEPROM 메모리, 레지스터, 하드 디스크, 착탈형 디스크, CD-ROM과 같은 저장 매체(즉, 메모리(630) 및/또는 스토리지(660))에 상주할 수도 있다. A software module resides in a storage medium (ie,
예시적인 저장 매체는 프로세서(610)에 연결되며, 그 프로세서(610)는 저장 매체로부터 정보를 판독할 수 있고 저장 매체에 정보를 기입할 수 있다. 다른 방법으로, 저장 매체는 프로세서(610)와 일체형일 수도 있다. 프로세서 및 저장 매체는 주문형 집적회로(ASIC) 내에 상주할 수도 있다. ASIC는 사용자 단말기 내에 상주할 수도 있다. 다른 방법으로, 프로세서 및 저장 매체는 사용자 단말기 내에 개별 컴포넌트로서 상주할 수도 있다.An exemplary storage medium is coupled to the
본 개시의 예시적인 방법들은 설명의 명확성을 위해서 동작의 시리즈로 표현되어 있지만, 이는 단계가 수행되는 순서를 제한하기 위한 것은 아니며, 필요한 경우에는 각각의 단계가 동시에 또는 상이한 순서로 수행될 수도 있다. 본개시에 따른 방법을 구현하기 위해서, 예시하는 단계에 추가적으로 다른 단계를 포함하거나, 일부의 단계를 제외하고 나머지 단계를 포함하거나, 또는 일부의 단계를 제외하고 추가적인 다른 단계를 포함할 수도 있다.Example methods of the present disclosure are expressed as a series of operations for clarity of description, but this is not intended to limit the order in which the steps are performed, and if necessary, each step may be performed simultaneously or in a different order. In order to implement a method according to the present disclosure, other steps may be included in addition to the illustrated steps, some steps may be included except some steps, or additional other steps may be included except some steps.
본 개시의 다양한 실시 예는 모든 가능한 조합을 나열한 것이 아니고 본 개시의 대표적인 양상을 설명하기 위한 것이며, 다양한 실시 예에서 설명하는 사항들은 독립적으로 적용되거나 또는 둘 이상의 조합으로 적용될 수도 있다Various embodiments of the present disclosure do not list all possible combinations, but are intended to describe representative aspects of the present disclosure, and matters described in various embodiments may be applied independently or in combination of two or more.
또한, 본 개시의 다양한 실시 예는 하드웨어, 펌웨어(firmware), 소프트웨어, 또는 그들의 결합 등에 의해 구현될 수 있다. 하드웨어에 의한 구현의 경우, 하나 또는 그 이상의 ASICs(Application Specific Integrated Circuits), DSPs(Digital Signal Processors), DSPDs(Digital Signal Processing Devices), PLDs(Programmable Logic Devices), FPGAs(Field Programmable Gate Arrays), 범용프로세서(general processor), 컨트롤러, 마이크로 컨트롤러, 마이크로 프로세서 등에 의해 구현될 수 있다.In addition, various embodiments of the present disclosure may be implemented by hardware, firmware, software, or a combination thereof. For implementation by hardware, one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), general purpose It may be implemented by a processor (general processor), a controller, a microcontroller, a microprocessor and the like.
본 개시의 범위는 다양한 실시 예의 방법에 따른 동작이 장치 또는 컴퓨터 상에서 실행되도록 하는 소프트웨어 또는 머신-실행가능한 명령들(예를 들어, 운영체제, 애플리케이션, 펌웨어(firmware), 프로그램 등), 및 이러한 소프트웨어 또는 명령 등이 저장되어 장치 또는 컴퓨터 상에서 실행 가능한 비-일시적 컴퓨터-판독가능 매체(non-transitory computer-readable medium)를 포함한다.The scope of the present disclosure includes software or machine-executable instructions (eg, operating system, application, firmware, program, etc.) that cause an operation according to the method of various embodiments to be executed on a device or computer, and such software or and non-transitory computer-readable media in which instructions and the like are stored and executed on a device or computer.
이상의 설명은 본 발명의 기술적 사상을 예시적으로 설명한 것에 불과한 것으로서, 본 발명이 속하는 기술 분야에서 통상의 지식을 가진 자라면, 본 발명의 본질적 특성을 벗어나지 않는 범위에서 다양한 수정 및 변형이 가능하다. The above description is merely illustrative of the technical idea of the present invention, and various modifications and variations are possible without departing from the essential characteristics of the present invention by those skilled in the art to which the present invention pertains.
따라서, 본 발명에 표현된 실시예들은 본 발명의 기술적 사상을 한정하는 것이 아니라, 설명하기 위한 것이고, 이러한 실시예에 의하여 본 발명의 권리범위가 한정되는 것은 아니다. 본 발명의 보호 범위는 아래의 청구범위에 의하여 해석되어야 하고, 그와 동등하거나, 균등한 범위 내에 있는 모든 기술적 사상은 본 발명의 권리범위에 포함되는 것으로 해석되어야 할 것이다.Accordingly, the embodiments expressed in the present invention are not intended to limit the technical spirit of the present invention, but to illustrate, and the scope of the present invention is not limited by these embodiments. The protection scope of the present invention should be construed by the following claims, and all technical ideas that are equivalent to or within the equivalent range should be construed as being included in the scope of the present invention.
Claims (8)
물리적 메모리 영역에 존재하는 디스크립터 풀(descriptor pool)과 메모리 블록 풀(memory block pool)로서, 다수의 디스크립터(descriptor)를 상기 디스크립터 풀에 미리 할당하고, 다수의 메모리 블록을 상기 메모리 블록 풀에 미리 할당하는 단계;
상기 디스크립터 풀로부터 하나의 디스크립터를 할당받고, 상기 메모리 블록 풀로부터 일정 개수의 메모리 블록들을 할당받는 단계; 및
상기 하나의 디스크립터와 상기 일정 개수의 메모리 블록들을 링크드 리스트 구조(linked list structure)로 연결하는 방식으로 상기 버퍼의 저장 공간을 생성하는 단계를 포함하고,
상기 하나의 디스크립터에 링크드 리스트 구조(linked list structure)로 연결된 첫 번째 메모리블록에서부터 마지막 메모리블록까지 순차적으로 주소 링크를 따라가면서 각 메모리 블록을 상기 메모리 블록 풀에 모두 반납하는 단계; 및
각 메모리 블록의 반납이 완료되면, 상기 하나의 디스크립터를 디스크립터 풀에 반납하여, 상기 버퍼의 저장 공간을 해제하는 단계
를 더 포함하는 버퍼 관리 방법.In a buffer management method of creating and releasing a storage space of a buffer for storing transmission and reception data in a communication system,
As a descriptor pool and a memory block pool existing in a physical memory area, a plurality of descriptors are pre-allocated to the descriptor pool, and a plurality of memory blocks are pre-allocated to the memory block pool. to do;
receiving one descriptor from the descriptor pool and receiving a predetermined number of memory blocks from the memory block pool; and
creating a storage space of the buffer in a way that the one descriptor and the predetermined number of memory blocks are connected in a linked list structure,
returning all memory blocks to the memory block pool while sequentially following address links from a first memory block connected to the one descriptor in a linked list structure to a last memory block; and
When the return of each memory block is completed, returning the one descriptor to the descriptor pool to release the storage space of the buffer
A buffer management method further comprising a.
상기 일정 개수의 메모리 블록들을 할당받는 단계는,
하나의 메모리 블록이 저장할 수 있는 공간의 크기와 상기 송수신 데이터의 크기에 따라 상기 메모리 블록의 일정 개수를 가변적으로 계산하는 단계; 및
상기 메모리 블록 풀로부터 상기 가변적으로 계산된 상기 일정 개수의 메모리 블록들을 할당받는 단계;
를 포함하는 버퍼 관리 방법.In claim 1,
Allocating the predetermined number of memory blocks comprises:
variably calculating a predetermined number of the memory blocks according to a size of a space that can be stored in one memory block and a size of the transmitted/received data; and
receiving the variably calculated number of memory blocks allocated from the memory block pool;
Buffer management method including.
아래의 수학식 1에 따라 상기 송수신 데이터의 크기에 적합한 상기 일정 개수를 계산하는 단계를 포함하고,
상기 수학식 1은,
여기서, BlockCount는 최종 계산값인 메모리 블록의 일정 개수로서, 정수값이며, DataSize는 송수신 데이터의 실제크기, BlockSize는 메모리 블록의 저장 공간의 크기인 것인 버퍼 관리 방법.The method of claim 1 , wherein the receiving of the predetermined number of memory blocks comprises:
Comprising the step of calculating the predetermined number suitable for the size of the transmission and reception data according to Equation 1 below,
Equation 1 is,
Here, BlockCount is a predetermined number of memory blocks, which is a final calculated value, and is an integer value, DataSize is an actual size of transmitted/received data, and BlockSize is a size of a storage space of a memory block.
다수의 디스크립터를 포함하는 디스크립터 풀(descriptor pool)과 다수의 메모리 블록을 포함하는 메모리 블록 풀(memory block pool)이 존재하는 물리적 메모리 영역을 갖는 메모리; 및
상기 디스크립터 풀로부터 하나의 디스크립터를 할당받고, 상기 메모리 블록 풀로부터 일정 개수의 메모리 블록들을 할당받고, 상기 하나의 디스크립터와 상기 일정 개수의 메모리 블록들을 링크드 리스트 구조(linked list structure)로 연결하여, 상기 버퍼의 저장 공간을 생성하는 프로세서;를 포함하고,
상기 프로세서는,
상기 하나의 디스크립터에 링크드 리스트 구조(linked list structure)로 연결된 첫 번째 메모리블록에서부터 마지막 메모리블록까지 순차적으로 주소 링크를 따라가면서 각 메모리 블록을 상기 메모리 블록 풀에 모두 반납한 후, 각 메모리 블록의 반납이 완료되면, 상기 하나의 디스크립터를 디스크립터 풀에 반납하여, 상기 버퍼의 저장 공간을 해제하는 통신 시스템.In a communication system that creates and releases a storage space of a buffer for storing transmit/receive data,
a memory having a physical memory area in which a descriptor pool including a plurality of descriptors and a memory block pool including a plurality of memory blocks exist; and
One descriptor is allocated from the descriptor pool, a predetermined number of memory blocks are allocated from the memory block pool, and the one descriptor and the predetermined number of memory blocks are connected in a linked list structure to connect the a processor that creates a storage space for the buffer;
The processor is
Returning each memory block to the memory block pool while sequentially following the address link from the first memory block connected to the one descriptor in a linked list structure to the last memory block When this is completed, the communication system releases the storage space of the buffer by returning the one descriptor to the descriptor pool.
상기 프로세서는,
하나의 메모리 블록이 저장할 수 있는 공간의 크기와 상기 송수신 데이터의 크기에 따라 상기 메모리 블록의 일정 개수를 계산하는 것인 통신 시스템.In claim 5,
The processor is
A communication system for calculating a predetermined number of memory blocks according to a size of a space that one memory block can store and a size of the transmitted/received data.
상기 프로세서는,
아래의 수학식 1에 따라 상기 송수신 데이터의 크기에 적합한 상기 일정 개수를 계산하고,
상기 수학식 1은,
이고,
여기서, BlockCount는 최종 계산값인 메모리 블록의 일정 개수로서, 정수값이며, DataSize는 송수신 데이터의 실제크기, BlockSize는 메모리 블록의 저장 공간의 크기인 것인 통신 시스템.In claim 5,
The processor is
Calculate the predetermined number suitable for the size of the transmission and reception data according to Equation 1 below,
Equation 1 is,
ego,
Here, BlockCount is a predetermined number of memory blocks, which is a final calculated value, and is an integer value, DataSize is an actual size of transmitted/received data, and BlockSize is a size of a storage space of a memory block.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| KR1020180165376A KR102275871B1 (en) | 2018-12-19 | 2018-12-19 | A buffer management method for efficiently processing transmission and reception data and communication system |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| KR1020180165376A KR102275871B1 (en) | 2018-12-19 | 2018-12-19 | A buffer management method for efficiently processing transmission and reception data and communication system |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| KR20200076352A KR20200076352A (en) | 2020-06-29 |
| KR102275871B1 true KR102275871B1 (en) | 2021-07-12 |
Family
ID=71400666
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| KR1020180165376A Active KR102275871B1 (en) | 2018-12-19 | 2018-12-19 | A buffer management method for efficiently processing transmission and reception data and communication system |
Country Status (1)
| Country | Link |
|---|---|
| KR (1) | KR102275871B1 (en) |
Citations (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20150127762A1 (en) * | 2013-11-05 | 2015-05-07 | Oracle International Corporation | System and method for supporting optimized buffer utilization for packet processing in a networking device |
Family Cites Families (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| KR20150116627A (en) * | 2014-04-08 | 2015-10-16 | 에스케이하이닉스 주식회사 | Controller and data storage device including the same |
-
2018
- 2018-12-19 KR KR1020180165376A patent/KR102275871B1/en active Active
Patent Citations (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20150127762A1 (en) * | 2013-11-05 | 2015-05-07 | Oracle International Corporation | System and method for supporting optimized buffer utilization for packet processing in a networking device |
Also Published As
| Publication number | Publication date |
|---|---|
| KR20200076352A (en) | 2020-06-29 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN112214313B (en) | Memory allocation method and related equipment | |
| WO2016011811A1 (en) | Memory management method and apparatus, and storage medium | |
| CN111177017B (en) | Memory allocation method and device | |
| US9213501B2 (en) | Efficient storage of small random changes to data on disk | |
| US10210109B2 (en) | Pre-allocating memory buffers by physical processor and using a bitmap metadata in a control program | |
| CN103593485A (en) | Method and device for achieving real-time operation on data base | |
| US11762554B2 (en) | Metadata volume bitmap data conflict processing method and related components | |
| US11301238B2 (en) | Firmware updating method and firmware updating system | |
| CN106685429B (en) | Integer compression method and device | |
| CN112306693B (en) | Data packet processing method and device | |
| CN116225997A (en) | Data acceleration calculation method, device, equipment and storage medium | |
| CN112346848A (en) | Method, device and terminal for managing memory pool | |
| CN108139969B (en) | A memory configuration method, device and system | |
| KR102275871B1 (en) | A buffer management method for efficiently processing transmission and reception data and communication system | |
| US9189382B2 (en) | Noncontiguous representation of an array | |
| CN113867925A (en) | Memory management method, apparatus, device and storage medium | |
| US9032178B2 (en) | Electronic apparatus for memory allocation and reorganization | |
| CN115757206A (en) | Shared linked list management method, device and equipment | |
| CN118227514A (en) | A memory management method, device, equipment and storage medium | |
| CN113741787B (en) | Data storage method, device, equipment, and medium | |
| CN110543357A (en) | Method for managing application objects, related device and system | |
| CN114493875A (en) | Transaction execution method, computer device and storage medium | |
| US10430081B2 (en) | Methods for minimizing fragmentation in SSD within a storage system and devices thereof | |
| CN110929102A (en) | Data processing method and device and electronic equipment | |
| CN110764707A (en) | Data processing method and device |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PA0109 | Patent application |
Patent event code: PA01091R01D Comment text: Patent Application Patent event date: 20181219 |
|
| PA0201 | Request for examination |
Patent event code: PA02012R01D Patent event date: 20200221 Comment text: Request for Examination of Application Patent event code: PA02011R01I Patent event date: 20181219 Comment text: Patent Application |
|
| PG1501 | Laying open of application | ||
| E902 | Notification of reason for refusal | ||
| PE0902 | Notice of grounds for rejection |
Comment text: Notification of reason for refusal Patent event date: 20201211 Patent event code: PE09021S01D |
|
| E701 | Decision to grant or registration of patent right | ||
| PE0701 | Decision of registration |
Patent event code: PE07011S01D Comment text: Decision to Grant Registration Patent event date: 20210615 |
|
| GRNT | Written decision to grant | ||
| PR0701 | Registration of establishment |
Comment text: Registration of Establishment Patent event date: 20210705 Patent event code: PR07011E01D |
|
| PR1002 | Payment of registration fee |
Payment date: 20210706 End annual number: 3 Start annual number: 1 |
|
| PG1601 | Publication of registration | ||
| PR1001 | Payment of annual fee |
Payment date: 20240624 Start annual number: 4 End annual number: 4 |
|
| PR1001 | Payment of annual fee |
Payment date: 20250624 Start annual number: 5 End annual number: 5 |