KR20000065846A - Method for zero-copy between kernel and user in operating system - Google Patents

Method for zero-copy between kernel and user in operating system Download PDF

Info

Publication number
KR20000065846A
KR20000065846A KR1019990012554A KR19990012554A KR20000065846A KR 20000065846 A KR20000065846 A KR 20000065846A KR 1019990012554 A KR1019990012554 A KR 1019990012554A KR 19990012554 A KR19990012554 A KR 19990012554A KR 20000065846 A KR20000065846 A KR 20000065846A
Authority
KR
South Korea
Prior art keywords
user
kernel
memory
area
zero
Prior art date
Application number
KR1019990012554A
Other languages
Korean (ko)
Inventor
이승환
Original Assignee
구자홍
엘지전자 주식회사
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by 구자홍, 엘지전자 주식회사 filed Critical 구자홍
Priority to KR1019990012554A priority Critical patent/KR20000065846A/en
Publication of KR20000065846A publication Critical patent/KR20000065846A/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/545Interprogram communication where tasks reside in different layers, e.g. user- and kernel-space
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping
    • G06F9/4406Loading of operating system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/544Buffers; Shared memory; Pipes

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Memory System Of A Hierarchy Structure (AREA)

Abstract

PURPOSE: A zero copy method in an OS(Operating System) is provided to share and transmit a data block without copying the data block when the data block is transmitted between the kernel and the user so that it can reduce a transmission overhead or a wasteful memory spending. CONSTITUTION: A zero copy method in an OS comprises a shared buffer allocation process and a shared buffer release process. The shared buffer allocation process includes steps of initializing a memory pool of a user area(30), allocating a zero copy area(31), generating a shared buffer on a kernel by a memory remapping(40), and acquiring the shared buffer(41). The shared buffer release process includes steps of executing a shared buffer return logic(42), executing a logic for eliminating the shred buffer on the kernel by mapping out the address of the shred buffer(43), releasing the shared buffer allocation(34) and releasing the initialization of the shared buffer(35).

Description

오퍼레이팅 시스템에서 커널과 사용자 사이의 제로-카피 방법{Method for zero-copy between kernel and user in operating system}Method for zero-copy between kernel and user in operating system}

본 발명은 오퍼레이팅 시스템(O/S)에서 커널과 사용자 사이의 제로-카피 방법에 관한 것으로 특히, 솔라리스(Solaris)운영 체제에서 커널과 사용자 사이의 데이터 블록 전송 시에 복사를 하지 않고 서로 공유하여 데이터 블록을 전송하기에 적당하도록 한 오퍼레이팅 시스템에서 커널과 사용자 사이의 제로-카피 방법에 관한 것이다.The present invention relates to a zero-copy method between a kernel and a user in an operating system (O / S). In particular, in a Solaris operating system, data is shared by each other without copying when data blocks are transferred between the kernel and a user. A zero-copy method between the kernel and the user in an operating system suitable for transferring blocks.

커널(Kernel)은 오퍼레이팅 시스템의 기능 중에서 오퍼레이팅 시스템을 구성하는 프로세스와 오퍼레이팅 시스템의 제어에서 실행하는 프로그램에 대하여 자원 할당(resource allocation)을 맡는 부분으로 원래는 제어 프로그램 중에서 주기억이 상주하는 부분을 가리키는데, 유닉스(UNIX)에서는 유닉스 시스템 구성의 기초를 이루는 핵심부분으로서, 소위 오퍼레이팅 시스템이라고 불리는 부분이다.Kernel is a part of the function of the operating system that is responsible for resource allocation for the processes constituting the operating system and the programs running under the control of the operating system. Originally, it refers to the part where the main memory resides in the control program. In UNIX, the core part of the UNIX system configuration is the so-called operating system.

커널은 하드웨어와 사용자 프로그램의 중간에 위치하며, CPU, 메모리, 하드디스크 등의 하드웨어 지원(support), 화일 시스템 서비스, 입출력 서비스 등의 기능을 사용자에게 제공한다.The kernel is located between the hardware and the user program, and provides the user with hardware support such as CPU, memory, hard disk, file system service, and I / O service.

일반적으로 오퍼레이팅 시스템 환경에서 커널(Kernel)과 사용자(User) 사이의 데이터 전송은 커널과 사용자 사이의 가상 메모리 리매핑(Virtual Memory Remapping)이나, 공유 기억 영역(Shared Memory Region)을 이용한 복사(Copy) 방법을 이용하고 있다. 그중 에서 가상 메모리 리매핑은 실질적으로 그 기술의 구체적인 내용이 공개되어 있지 않다.In general, data transfer between kernel and user in operating system environment is virtual memory remapping between kernel and user or copy method using shared memory region. Is using. Among them, virtual memory remapping has not been disclosed in detail.

제로-카피(Zero-Copy)라는 것은 사용자 영역에 있는 버퍼를 복사(Copy)없이 커널에서 사용할 수 있는 방법으로 여러 논문에서 제안하고 있는데 CMNS에서는 가상 메모리 맵핑(Virtual Memory mapping)을 사용자 영역에서 커널 영역으로 리매핑(remapping)하고 있다. 그와 같은 이유는 첫째, RTP/RTCP에서는 그 자체가 어플리케이션 스페시픽 프로토콜 (application specific protocol)로서 사용자 레벨에 구현하도록 권고하고 있기 때문으로, 네오비스(Neovis)에서 사용하는 CMFS는 파일을 읽어서 커널 메모리에 복사하고 CMNS는 RTP의 헤더를 붙여서 패킷 사이즈(Packet size)만큼 잘라서 클라이언트에게 전송하게 된다. 그러므로 RTP를 사용자 영역에서 구현할 경우 매번 RTP 헤더를 커널 영역으로 복사해야 하는 문제가 발생한다. 그렇다고 커널 레벨에 구현할 경우 RTP 특성을 살리지 못하므로 커널에 구현하되 그것을 사용자 영역에서 언제든지 정보를 읽어볼 수 있도록 할 필요성이 있었다.Zero-Copy is a method that can be used in the kernel without copying the buffer in the user space. Several papers suggest that virtual memory mapping is the user-space kernel space in CMNS. Remapping The reason for this is that, first, RTP / RTCP recommends that it be implemented at the user level as an application specific protocol itself. Therefore, the CMFS used by Neovis reads a file and kernel. After copying to memory, CMNS cuts packet size by sending header of RTP and sends to client. Therefore, when RTP is implemented in user space, there is a problem of copying the RTP header to the kernel space every time. However, the implementation at the kernel level does not take advantage of the RTP characteristics, so it was necessary to implement it in the kernel so that the information can be read at any time in the user space.

두 번째 이유는 커널 모듈의 정보를 언제든지 사용자가 파악하여 제어를 용이하게 할 필요성이 있기 때문으로, 불필요한 시스템 콜(system call)을 없애서 시스템 콜 타임을 줄여 보다 효율적인 제어가 되도록 구현할 필요성 때문이다.The second reason is that the user needs to easily understand the kernel module information at any time and to facilitate the control. This is because the system call time is reduced by eliminating unnecessary system calls to implement more efficient control.

이하, 종래 오퍼레이팅 시스템에서 커널과 사용자 사이의 데이터 전송 방법을 설명하기로 한다.Hereinafter, a method of transmitting data between a kernel and a user in a conventional operating system will be described.

종래 기술은 가상 메모리 리매핑이나 공유 메모리를 사용하는 방법으로 이러한 기능을 구현한 사례는 있으나 구체적인 알고리즘과 사용할 수 있는 방법은 공개되어 있지 않아 그와 같은 기술의 기본적인 알고리즘(Algorithm)만으로 설명하기로 한다.Although the prior art has implemented such a function by using virtual memory remapping or shared memory, specific algorithms and methods that can be used are not disclosed. Therefore, only the basic algorithm of such technology will be described.

우선, 용어의 통일을 위해 메모리를 관리, 생성하는 메니저(manager)를 오리지네이터(originator)라 하고, 이것을 사용하는 것을 클라이언트(client)라 하기로 한다.First of all, a manager that manages and creates a memory for unification of terms is called an originator, and using this is called a client.

우선, 오리지네이터에서의 집합체 목적 할당(Allocate an Aggregate Object)은 오리지네이터에서 빈 가상 어드레스(free virtual address)를 할당하고, 해당 피지컬 메모리(physical memory)를 할당하고 클리어(clear) 시킨다. 그 다음, 피지컬 페이지 테이블을 업데이트한다.First, Allocate an Aggregate Object in the Originator allocates a free virtual address in the Originator, allocates and clears the corresponding physical memory. Next, update the physical page table.

이어서, 오리지네이터에서 집합체 목적 송신(Send Aggregate Object)은 할당된 메모리의 리스트(list)를 만들고, 리스트를 프로텍트(protect)한다. 그 다음, TLB/cache의 일관성(consistency)를 위해 피지컬 테이블을 업데이트한다.The Send Aggregate Object in the Originator then creates a list of allocated memory and protects the list. Next, update the physical table for consistency of TLB / cache.

이어서, 리시버(Receiver)에서의 집합체 목적 수신(Receive Aggregate Object)은 리시버의 어드레스 범위(address range)에서 빈 가상 어드레스(free virtual address)를 찾는다. 이어서, 피지컬 페이지 테이블을 업데이트한다. 그다음 해당 메모리 리스트에서 목적 메모리를 획득한다.The Receive Aggregate Object in the Receiver then finds a free virtual address in the address range of the receiver. Then, the physical page table is updated. Then obtain the destination memory from the memory list.

그리고, 집합체 목적 해제(Free an Aggregate Object)는 가상 어드레스를 해제하고 피지컬 페이지 테이블을 업데이트한다. 마지막으로 사용하지 않는 피지컬 페이지를 해제한다.Free an Aggregate Object releases the virtual address and updates the physical page table. Finally, release the unused physical pages.

종래 오퍼레이팅 시스템에서 커널과 사용자 사이의 데이터 전송 방법에 있어서는 오리지네이터가 메모리 풀을 핸드링하여 사용자에게 넘겨주는 방식으로 되어 있어, 사용자 측면에서 불편하고, 매 번 피지컬 테이블을 업데이트하여야 하므로 시간적인 면에서 많은 오버헤드(overhead)가 있었다.In the conventional operating system, the data transfer method between the kernel and the user is a method in which the originator hands the memory pool and hands it to the user, which is inconvenient for the user, and in time, because the physical table must be updated every time. There was a lot of overhead.

본 발명의 목적은 상기한 바와 같은 종래 기술의 문제점들을 해결하기 위하여 안출한 것으로 특히, 커널 영역과 사용자 영역간의 오버헤드(overhead)를 줄이고, 사용자에게 편리한 인터페이스를 제공하기에 적당하도록 한 오퍼레이팅 시스템에서의 커널과 유저 사이의 제로-카피 방법을 제공하는데 있다.Disclosure of Invention The object of the present invention is to solve the problems of the prior art as described above. In particular, in an operating system that is suitable for reducing the overhead between kernel area and user area and providing a user-friendly interface. To provide a zero-copy method between the kernel and the user.

도 1은 본 발명 오퍼레이팅 시스템에서의 커널과 사용자 사이의 제로-카피 알고리즘을 설명하기 위한 블록 구성도1 is a block diagram illustrating a zero-copy algorithm between a kernel and a user in an operating system of the present invention.

도 2는 도 1에 나타낸 본 발명 제로-카피 알고리즘시의 공유 버퍼 할당 및 해제 과정을 설명하기 위한 블록 구성도FIG. 2 is a block diagram illustrating a shared buffer allocation and release process in the zero-copy algorithm of the present invention shown in FIG.

도 3은 본 발명 제로-카피 알고리즘을 설명하기 위한 순서도3 is a flow chart for explaining the present invention zero-copy algorithm

*도면의 주요 부분에 대한 부호의 설명** Description of the symbols for the main parts of the drawings *

1 : CMNS 관리자 라이브러리 모듈 2 : 라이브러리 공유 버퍼1: CMNS Manager Library Module 2: Library Shared Buffer

3 : 메모리 풀 4 : 커널 가상 어드레스3: memory pool 4: kernel virtual address

5 : CMNS 모드(커널 모듈) 10 : 사용자 영역5: CMNS mode (kernel module) 10: user area

20 : 커널 영역 32 : 공유버퍼 메모리 풀20 Kernel Area 32 Shared Buffer Memory Pool

33 : 공유버퍼 50 : 제로-카피 메모리 오리지널 영역33: Shared buffer 50: Zero-copy memory original area

60 : 제로-카피 메모리 리매핑 영역60: zero-copy memory remapping region

본 발명 오퍼레이팅 시스템에서 커널과 사용자 사이의 제로-카피 방법은 공유 기억 영역과, 사용자 메모리를 포함하는 사용자영역과, 커널 가상 어드레스를 포함하는 커널 영역으로 구성된 오퍼레이팅 시스템에 있어서, 상기 사용자 영역의 상기 공유 기억 영역을 초기화하는 단계, 상기 공유 기억 영역에 상기 사용자 메모리를 할당하는 단계, 상기 커널 영역에 가상의 공유 기억 영역을 생성하는 단계, 상기 사용자영역의 임의의 데이터를 상기 커널 영역의 상기 가상의 공유 기억 영역에 제로-카피하는 단계로 이루어진다.A zero-copy method between a kernel and a user in an operating system of the present invention comprises an operating system including a shared storage area, a user area including a user memory, and a kernel area including a kernel virtual address, wherein the sharing of the user area is performed. Initializing a storage area, allocating the user memory to the shared storage area, creating a virtual shared storage area in the kernel area, and sharing any data in the user area with the virtual share of the kernel area. Zero-copy to the storage area.

바람직하게, 상기 공유기억영역에 상기 사용자 메모리를 할당하는 단계는 상기 공유 기억 영역에 상기 사용자 메모리를 할당받는 단계후에 상기 커널 영역에 메모리 리매핑을 요구하는 단계가 더 포함된다.Preferably, the step of allocating the user memory to the shared memory area further includes requesting memory remapping of the kernel area after the step of allocating the user memory to the shared memory area.

바람직하게, 상기 공유 기억 영역에 사용자 메모리를 할당하는 단계에서 메모리 정렬을 사용하는 경우에는 상기 사용자 메모리를 페이지 사이즈로 할당하는 단계와, 상기 페이지 사이즈로 할당한 사용자 메모리를 복수개의 제어 버퍼(ControlBuffer)와, 실시간 전송 프로토콜 버퍼(RtpBuffer)가 나누어서 사용한다.Preferably, when using memory alignment in allocating user memory to the shared storage area, allocating the user memory to a page size, and assigning a plurality of control buffers to the user memory allocated to the page size. And the real time transfer protocol buffer (RtpBuffer) are used separately.

바람직하게, 상기 커널 영역에 가상의 공유 기억 영역을 생성하는 단계는 상기 커널 영역에 상기 사용자 영역의 메모리를 리매핑하는 것으로 이루어진다.Advantageously, creating a virtual shared storage area in the kernel area consists of remapping the memory of the user area in the kernel area.

바람직하게, 상기 커널 영역의 상기 가상의 공유 기억 영역에 상기 사용자 영역의 임의의 데이터를 제로-카피할 때 상기 사용자 메모리를 페이지 사이즈로 할당하는 단계와, 상기 페이지 사이즈로 할당한 하나의 페이지에 여러 개의 공유 버퍼를 구성하고, 상기 페이지 사이즈 개수만큼 메모리를 리매핑한다.Preferably, allocating the user memory to a page size when zero-copying any data of the user area to the virtual shared storage area of the kernel area, and assigning a plurality of pages to one page allocated to the page size. Shared buffers and remap the memory by the number of page sizes.

이하, 본 발명 오퍼레이팅 시스템에서의 커널과 유저 사이의 데이터 전송 방법을 첨부된 도면을 참조하여 설명하기로 한다.Hereinafter, a method of transmitting data between a kernel and a user in an operating system of the present invention will be described with reference to the accompanying drawings.

도 1은 본 발명 오퍼레이팅 시스템에서의 커널과 사용자 사이의 제로-카피 알고리즘을 설명하기 위한 블록 구성도이다.1 is a block diagram illustrating a zero-copy algorithm between a kernel and a user in an operating system of the present invention.

우선, 본 발명 오퍼레이팅 시스템에서의 커널과 사용자 사이의 제로-카피 알고리즘을 설명하기 위한 기본적인 구성은 도 1에 나타낸 바와 같이, 임의의 사용자들에게 응용 프로그램 인터페이스(API)를 제공하는 CMNS 관리자 라이브러리 모듈 (Manager liblary module)(1)과, 상기 사용자들이 작성한 프로그램 등을 CMNS 관리자 라이브러리 모듈(1)로부터 받아 기억하고 있는 라이브러리 공유 버퍼(2)와, 페이지 단위사용자 메모리인 메모리 풀(memory pool)(3)로 구성된 사용자 영역(10)과, 프로그램 맵 인/프로그램 맵 아웃(Program mapin/Program mapout)에 따라 상기 메모리 풀(3)의 프로그램을 공유하는 커널 가상 어드레스(4) 및 임의의 시스템 호출(system call)을 이용하여 상기 사용자 영역(10)의 라이브러리 공유 버퍼(2)에서 사용자의 어드레스를 전송 받는 CMNS 모드(5)로 구성된 커널 영역(20)으로 이루어진다.First, the basic configuration for explaining the zero-copy algorithm between the kernel and the user in the operating system of the present invention is a CMNS manager library module that provides an application program interface (API) to arbitrary users, as shown in FIG. Manager liblary module (1), a library shared buffer (2) that receives and stores programs written by the users from the CMNS manager library module (1), and a memory pool (3), which is a page-based user memory. Kernel virtual address 4 and any system call that share the program of the memory pool 3 according to the user area 10 and the program map in / program map out. Kernel configured in CMNS mode (5) to receive the user's address in the library shared buffer (2) of the user area 10 using Consists of an area 20.

이때, 상기 메모리 풀(3)과 라이브러리 공유 버퍼(2)는 메모리 정렬/해제(memory align/memory free)시에 페이지 사이즈(Page size) 단위로 메모리를 이용한다.In this case, the memory pool 3 and the library shared buffer 2 use the memory in page size units when memory align / memory free.

솔라리스(Solaris)에서는 가상 메모리(virtual memory)라는 개념을 사용하는데 이것을 논리적(logical)으로 페이지(page) 단위(8Kbyte)로 핸들링(handling) 한다.Solaris uses the concept of virtual memory, which is logically handled in page units (8Kbytes).

이를 위해 어플리케이션(application)에서는 메모리 풀(3)의 메모리를 잡을 때 페이지 단위(8Kbyte)나 그 이하로 잡는다.To do this, the application grabs the memory of the memory pool 3 in page units (8 Kbytes) or less.

그렇게 하는 방법으로 커널 영역(20)의 CMNS 모드(5)에서는 사용자 영역(10)에서 사용자 어드레스(address)를 CMNS 모드(5)에 전달하면 CMNS 모드(5)에서는 프로그램 맵 인(program mapin : 이하, prmapin이라 약칭함)이라는 함수를 사용하는데 그 함수의 사용방법은 다음과 같다.In such a way, in the CMNS mode 5 of the kernel region 20, a user address is transmitted to the CMNS mode 5 in the user region 10, and in the CMNS mode 5, the program mapin: , which is abbreviated as prmapin), and its usage is as follows.

prmapin(as, (caddr_t)u_cbufpt,1)에서, as는 현재 수행되고 있는 스레드(thread)의 번지 공간(address space)을 나타내고, u_cbufpt는 맵핑(mapping)할 사용자 영역(10)의 어드레스이며, 1은 버퍼의 읽기/쓰기 옵션(READ/WRITE option)으로 1인 경우는 읽기/쓰기를 나타내고, 0인 경우는 읽기(READ)만 가능하다. 이 함수의 반환값(returned value)이 커널 가상 어드레스(kernel virtual address)이다.In prmapin (as, (caddr_t) u_cbufpt, 1), as denotes the address space of the thread currently being executed, u_cbufpt is the address of the user area 10 to be mapped, and 1 Is a read / write option of the buffer. If 1, it indicates read / write, and if 0, only read. The returned value of this function is the kernel virtual address.

도 2는 도 1에 나타낸 본 발명 제로-카피 알로리즘시의 공유 버퍼 할당 및 해제 과정을 설명하기 위한 블록 구성도이다.FIG. 2 is a block diagram illustrating a shared buffer allocation and release process in the zero-copy algorithm of the present invention shown in FIG.

본 발명 제로-카피 알고리즘시의 공유 버퍼 할당 및 해제 과정은 공유 버퍼 호출 메카니즘(shared buffer call mechanism)을 이용하여 설명하기로 한다.The shared buffer allocation and release process in the zero-copy algorithm of the present invention will be described by using a shared buffer call mechanism.

공유 버퍼 라이브러리는 공유 버퍼(33)라는 영역을 사용자 영역과 커널 영역 사이에 공유시키기 위한 버퍼를 제공하는 라이브러리인데 그 사용순서는 다음과 같다.The shared buffer library is a library that provides a buffer for sharing an area called the shared buffer 33 between the user area and the kernel area. The order of use is as follows.

공유 버퍼 할당과정(30)(31)으로써 우선, 공유 버퍼(33) 초기화 로직을 실행한다(Sbuf_init())(30).As the shared buffer allocation process (30) (31), first, the shared buffer 33 initialization logic is executed (Sbuf_init ()) (30).

즉, 기억 영역 할당(memory map)을 위해서 /dve/zero를 여는 루틴(routine)으로서 CMNS_Inti에서 Call되어 지는데, 제 1 로직을 참조하여 설명하기로 한다. 이때, 메모리 정렬(memory align)을 사용할 경우에는 이것은 필요없다.That is, it is called in CMNS_Inti as a routine that opens / dve / zero for a memory map, which will be described with reference to the first logic. This is not necessary if you use memory align.

[제 1 로직][First logic]

LogicLogic

Open("/dev/zero")Open ("/ dev / zero")

이어서, 공유 버퍼(33)를 할당(Sbuf_alloc(Sbuf_t type, int number))하기 위한 로직을 실행한다(31).Subsequently, the logic for allocating the shared buffer 33 (Sbuf_alloc (Sbuf_t type, int number)) is executed (31).

즉, 사용자 메모리를 할당받아서 CMNS 모드에 메모리 리매핑(remapping)을 요구하는 것이다.That is, memory remapping is requested in the CMNS mode by allocating user memory.

이때, 메모리 정렬(memory align)(이하, memalign이라 약칭 함)을 사용할 경우에는 페이지 사이즈(page size)(솔라리스인 경우에는 8K)만큼 할당 받을 수 있다. 그 이유는 커널 영역에서 사용하는 prmapin/out이 페이지 단위로 이루어지기 때문이다. 이때, type은 ControlBuf_t, RtpBuf_t일 경우를 구별하기 위한 인수 (argument)이다. 참고적으로 ControlBuf는 제어버퍼이고, RtpBuf는 실시간 전송 프로토콜 버퍼(Realtimme transport protocol)이다.In this case, when using memory alignment (hereinafter, referred to as memalign), a page size (8K in the case of Solaris) may be allocated. This is because the prmapin / out used in the kernel area is made up of pages. In this case, type is an argument for distinguishing between ControlBuf_t and RtpBuf_t. For reference, ControlBuf is the control buffer and RtpBuf is the real-time transport protocol buffer.

그리고, number는 총 개수로서 이것은 최대 세션 번호(maximim session number)와 같다. 메모리 사용의 효율성을 위해 페이지 사이즈만큼 잡은 메모리를 여러 개의 ControlBuffer와 RtpBuffer가 나누어서 사용한다. 이를 제 2 로직을 참조하여 설명하면 다음과 같다And, number is the total number, which is equal to the maximum session number. For efficiency of memory usage, multiple pages of ControlBuffer and RtpBuffer are used to divide the memory of page size. This will be described with reference to the second logic as follows.

[제 2 로직][Second logic]

InputInput

sbuf_t_type, int numbersbuf_t_type, int number

LogicLogic

check numbercheck number

if control buffer thenif control buffer then

memalignmemalign

calculate num=PAGESIZE/sizeof(ControBuf_t)calculate num = PAGESIZE / sizeof (ControBuf_t)

sbuf_create_in_kernelsbuf_create_in_kernel

if Rtp buffer thenif Rtp buffer then

memalignmemalign

calculate num=PAGESIZE/sizeof(RtpBuf_t)calculate num = PAGESIZE / sizeof (RtpBuf_t)

sbuf_create_in_kernelsbuf_create_in_kernel

그다음, 할당되어진 공유 버퍼(33)를 공유 버퍼 메모리 풀(32)에서 가져오기 (Sbuf_get) 위한 로직을 실행한다(Sbuf_get(int sid,sbuf_t type)).Then, the logic for obtaining (Sbuf_get) the allocated shared buffer 33 from the shared buffer memory pool 32 is executed (Sbuf_get (int sid, sbuf_t type)).

이것은 할당되어진 공유 버퍼(33)를 공유 버퍼 메모리 풀(32)에서 사용하도록 가져오고, 초기화하는 과정이다. 이때, 초기에 공유 버퍼(33)가 모두 할당되어져 있어서 각 sid에 공유버퍼(33)가 정적(static)으로 할당되어져 있다. 제 3 로직을 참조하여 설명하면 다음과 같다.This is the process of bringing and initializing the allocated shared buffer 33 for use in the shared buffer memory pool 32. At this time, all the shared buffers 33 are allotted initially, and the shared buffers 33 are statically assigned to each sid. A description with reference to the third logic is as follows.

[제 3 로직][Third logic]

InputInput

int_sid,sbuf_t typeint_sid, sbuf_t type

LogicLogic

check sidcheck sid

if control buffer then initialize and return itif control buffer then initialize and return it

if rtp buffer then initialize and return itif rtp buffer then initialize and return it

이어서, 사용된 공유 버퍼(33)를 공유 버퍼 메모리 풀(32)로 반환(Sbuf_return)하기 위한 로직을 실행한다(Sbuf_return(int sid,sbuf_t_type)).Subsequently, logic for returning the used shared buffer 33 to the shared buffer memory pool 32 (Sbuf_return) is executed (Sbuf_return (int sid, sbuf_t_type)).

이를 제 4 로직을 참조하여 설명하면 다음과 같다.This will be described with reference to the fourth logic as follows.

[제 4 로직][Fourth logic]

InputInput

int sid,sbuf_t typeint sid, sbuf_t type

LogicLogic

check sidcheck sid

if control buffer then deinitialize itif control buffer then deinitialize it

if rtp buffer then deinitialize itif rtp buffer then deinitialize it

그 다음, 공유 버퍼 메모리 풀(32)의 공유 버퍼(33)의 해제과정(34)(35)으로서, 공유 버퍼(33) 해제 로직을 실행한다(Sbuf_dealloc(sbuf_t type,int number) (34).Next, as the release process 34 (35) of the shared buffer 33 of the shared buffer memory pool 32, the release logic of the shared buffer 33 is executed (Sbuf_dealloc (sbuf_t type, int number) 34).

이때, Sbuf_dealloc은 Sbuf_alloc에서 잡은 memory를 해제(free)시켜주는 부분으로서, 커널 영역의 CMNS 모드에게 메모리 리매핑을 해제시킨다. 이를 제 5 로직을 참조하여 설명하면 다음과 같다.At this time, Sbuf_dealloc is a part that frees the memory caught by Sbuf_alloc, and releases memory remapping to the CMNS mode of the kernel region. This will be described with reference to the fifth logic as follows.

[제 5 로직][Fifth Logic]

InputInput

sbuf_t type,int numbersbuf_t type, int number

LogicLogic

check numbercheck number

free memoryfree memory

그 다음, 공유 버퍼 초기화 해제를 실시한다(35).Then, the shared buffer initialization is canceled (35).

즉, 기억 영역 할당(memory map)을 위해서 열었던 /dev/zero를 닫는 루틴이다.That is, it closes / dev / zero, which is open for memory maps.

제 6 로직을 참조하여 설명하면 다음과 같다.A description with reference to the sixth logic is as follows.

[제 6 로직][Sixth Logic]

LogicLogic

Close(Sbuf-fd);Close (Sbuf-fd);

이와 같은 본 발명 제로-카피 알고리즘시의 공영 버퍼 할당 및 해제 과정을 이용한 제로-카피 알고리즘을 설명하기로 한다.The zero-copy algorithm using the process of allocating and freeing a shared buffer in the zero-copy algorithm of the present invention will be described.

도 3은 본 발명 제로-카피 알고리즘을 설명하기 위한 순서도이다.3 is a flowchart illustrating the present invention zero-copy algorithm.

본 발명 제로-카피 알고리즘은, 도 2에 나타낸 바와 같은 제 1 내지 제 2 로직을 이용하여 사용자 영역(도 1 참조)의 메모리 풀(3)을 초기화하는 공유 버퍼 초기화(30)과정과 제로-카피 영역 할당을 위한 공유 버퍼 할당(31) 과정후, 메모리 리매핑을 통해 커널 영역에 공유 버퍼를 생성한다(Sbuf_create_in_kernel(int sid,sbuf_t type,void*slot))(40).The zero-copy algorithm of the present invention uses the first to second logic as shown in FIG. 2, and the zero-copy process and the shared buffer initialization 30 process of initializing the memory pool 3 of the user area (see FIG. 1). After the process of allocating the shared buffer 31 for allocating the region, a shared buffer is created in the kernel region through memory remapping (Sbuf_create_in_kernel (int sid, sbuf_t type, void * slot)) (40).

즉, 커널 영역의 CMNS 모드(5)에 제로-카피 메모리 오리지널 영역(50)의 메모리를 리매핑하는 것으로 하나의 페이지(PAGE)에 여러 개의 공유 버퍼가 구성되도록 한다. 이것은 PAGESIZE/sizeof(controBuf_t or RtpBuf_t) 개수만큼 메모리를 제로-카피 메모리 리매핑 영역(60)에 리매핑한다. 그리고, CMNS 모드(5)에 전달되는 커맨드(command)는 CMNS_MAPIN_CBUF or CMNS_MAPIN_RBUF이다. 여기에는 매핑(mapping)될 어드레스와 개수가 파라미터(parameter)로 전달된다.That is, by remapping the memory of the zero-copy memory original area 50 in the CMNS mode 5 of the kernel area, a plurality of shared buffers are configured in one page PAGE. This remaps the memory to the zero-copy memory remapping region 60 by the number of PAGESIZE / sizeof (controBuf_t or RtpBuf_t). The command transmitted to the CMNS mode 5 is CMNS_MAPIN_CBUF or CMNS_MAPIN_RBUF. Here, the address and the number to be mapped are passed as parameters.

이를 제 7 로직을 사용하여 나타내면 다음과 같다.This is shown using the seventh logic as follows.

[제 7 로직][Seventh Logic]

InputInput

int sid,sbuf_t type,void*slotint sid, sbuf_t type, void * slot

Pseudo CodePseudo Code

if control buffer thenif control buffer then

build cmnsmsg for it and SetCommandbuild cmnsmsg for it and SetCommand

if rpt buffer thenif rpt buffer then

build cmnsmsg for it and SetCommandbuild cmnsmsg for it and SetCommand

그러면, 공유 버퍼를 획득하게 된다(41).The shared buffer is then obtained (41).

그리고, 상기 공유 버퍼를 해제하는 과정은 도 2에서 설명한 바와 같은 제 5 로직과 제 6 로직을 이용하여 공유 버퍼 할당 해제(34)과정과, 공유 버퍼 초기화 해제(35)과정을 실시한다.The releasing of the shared buffer is performed by using the fifth and sixth logics as described above with reference to FIG.

이때, 공유 버퍼 할당을 해제(34)하는 과정전에 도 2에서 설명한 바와 같은 제 4 로직을 이용한 공유 버퍼 복귀(Sbuf_return(int sid,sbuf_t type)) 로직을 실시한다(42).In this case, before the process of releasing the shared buffer 34, the shared buffer return (Sbuf_return (int sid, sbuf_t type)) logic using the fourth logic as described with reference to FIG. 2 is performed (42).

그다음, 커널 영역의 공유 버퍼를 삭제하는 로직(Sbuf_delete_in_kernel (int sid,sbuf_t_type))을 실시한다(43). 이것은 공유 버퍼가 매핑된 어드레스를 맵아웃(mapout)시키는 과정으로 제 7 로직에서 설명한 바와 같은 CMNS 모드(5)에 매핑된 어드레스를 맵아웃 시키는 것이다.Next, logic (Sbuf_delete_in_kernel (int sid, sbuf_t_type)) for deleting the shared buffer of the kernel area is performed (43). This is a process of mapping out the address to which the shared buffer is mapped and mapping out the address mapped to the CMNS mode 5 as described in the seventh logic.

이를 제 8 로직을 참조하여 설명한다.This will be described with reference to the eighth logic.

[제 8 로직][8th Logic]

InputInput

intsid,sbuf_t typeintsid, sbuf_t type

Pseudo CodePseudo Code

if control buffer thenif control buffer then

build cmnsmsg for it and SetCommandbuild cmnsmsg for it and SetCommand

if rpt buffer thenif rpt buffer then

build cmnsmsg for it and SetCommandbuild cmnsmsg for it and SetCommand

본 발명에 따른 오퍼레이팅 시스템에서 커널과 사용자 사이의 제로-카피 방법에 있어서는 데이터 블록 전송시 사용자 영역에 있는 버퍼를 복사(copy)하지 않고 커널에서 가상의 메모리를 이용하므로 매 번 피지컬 테이블을 업데이트하여야 하는 문제가 없어 시간적인 면에서 많은 오버헤드(overhead)를 줄일 수 있고 메모리의 낭비를 없애고, 사용자에게 편리한 인터페이스 환경을 제공하는 효과가 있다.In the zero-copy method between the kernel and the user in the operating system according to the present invention, the physical table must be updated every time since the kernel uses virtual memory without copying a buffer in the user area during data block transmission. There is no problem, which can reduce a lot of overhead in terms of time, eliminate memory waste, and provide a user-friendly interface environment.

Claims (5)

공유 기억 영역과, 사용자 메모리를 포함하는 사용자영역과, 커널 가상 어드레스를 포함하는 커널 영역으로 구성된 오퍼레이팅 시스템에 있어서,An operating system comprising a shared storage area, a user area including user memory, and a kernel area including a kernel virtual address, 상기 사용자 영역의 상기 공유 기억 영역을 초기화하는 단계;Initializing the shared storage area of the user area; 상기 공유 기억 영역에 상기 사용자 메모리를 할당하는 단계;Allocating the user memory to the shared storage area; 상기 커널 영역에 가상의 공유 기억 영역을 생성하는 단계;Creating a virtual shared storage area in the kernel area; 상기 사용자영역의 임의의 데이터를 상기 커널 영역의 상기 가상의 공유 기억 영역에 제로-카피하는 단계로 이루어지는 것을 특징으로 하는 오퍼레이팅 시스템에서 커널과 사용자 사이의 제로-카피 방법.Zero-copying any data of the user area to the virtual shared storage area of the kernel area. 제 1 항에 있어서, 상기 공유기억영역에 상기 사용자 메모리를 할당하는 단계는 상기 공유 기억 영역에 상기 사용자 메모리를 할당받는 단계후에 상기 커널 영역에 메모리 리매핑을 요구하는 단계가 더 포함되는 것을 특징으로 하는 오퍼레이팅시스템에서 커널과 사용자 사이의 제로-카피 방법.The method of claim 1, wherein the allocating of the user memory to the shared memory area further comprises requesting memory remapping of the kernel area after the user memory is allocated to the shared memory area. Zero-copy method between kernel and user in operating system. 제 1 항에 있어서, 상기 공유 기억 영역에 사용자 메모리를 할당하는 단계에서 메모리 정렬을 사용하는 경우에는 상기 사용자 메모리를 페이지 사이즈로 할당하는 단계와, 상기 페이지 사이즈로 할당한 사용자 메모리를 복수개의 제어 버퍼(ControlBuffer)와, 실시간 전송 프로토콜 버퍼(RtpBuffer)가 나누어서 사용하는 것을 특징으로 하는 오퍼레이팅시스템에서 커널과 사용자 사이의 제로-카피 방법.2. The method of claim 1, wherein in the case of using memory alignment in allocating user memory to the shared storage area, allocating the user memory to a page size and a plurality of control buffers to allocate the user memory to the page size. (ControlBuffer) and the real-time transport protocol buffer (RtpBuffer) is a zero-copy method between the kernel and the user in the operating system characterized in that divided use. 제 1 항에 있어서, 상기 커널 영역에 가상의 공유 기억 영역을 생성하는 단계는 상기 커널 영역에 상기 사용자 영역의 메모리를 리매핑하는 것으로 이루어지는 것을 특징으로 하는 오퍼레이팅 시스템에서 커널과 사용자 사이의 제로-카피 방법.2. The zero-copy method between a kernel and a user in an operating system according to claim 1, wherein creating a virtual shared storage area in the kernel area comprises remapping memory of the user area in the kernel area. . 제 1 항에 있어서, 상기 커널 영역의 상기 가상의 공유 기억 영역에 상기 사용자 영역의 임의의 데이터를 제로-카피할 때 상기 사용자 메모리를 페이지 사이즈로 할당하는 단계와, 상기 페이지 사이즈로 할당한 하나의 페이지에 여러 개의 공유 버퍼를 구성하고, 상기 페이지 사이즈 개수만큼 메모리를 리매핑하는 것을 특징으로 하는 오퍼레이팅 시스템에서 커널과 사용자 사이의 제로-카피 방법.2. The method of claim 1, further comprising: allocating the user memory to a page size when zero-copying any data of the user area to the virtual shared storage area of the kernel area; A zero-copy method between a kernel and a user in an operating system, comprising configuring a plurality of shared buffers in a page and remapping memory by the number of page sizes.
KR1019990012554A 1999-04-09 1999-04-09 Method for zero-copy between kernel and user in operating system KR20000065846A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
KR1019990012554A KR20000065846A (en) 1999-04-09 1999-04-09 Method for zero-copy between kernel and user in operating system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
KR1019990012554A KR20000065846A (en) 1999-04-09 1999-04-09 Method for zero-copy between kernel and user in operating system

Publications (1)

Publication Number Publication Date
KR20000065846A true KR20000065846A (en) 2000-11-15

Family

ID=19579264

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1019990012554A KR20000065846A (en) 1999-04-09 1999-04-09 Method for zero-copy between kernel and user in operating system

Country Status (1)

Country Link
KR (1) KR20000065846A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100758272B1 (en) 2006-04-26 2007-09-12 한국전자통신연구원 File movement method supporting data zero-copy technique
US8495262B2 (en) 2010-11-23 2013-07-23 International Business Machines Corporation Using a table to determine if user buffer is marked copy-on-write
CN115167786A (en) * 2022-09-06 2022-10-11 浪潮电子信息产业股份有限公司 Data storage method, device, system, equipment and medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR970006411B1 (en) * 1993-12-22 1997-04-28 재단법인 한국전자통신연구소 Output device of memory
KR19980063413A (en) * 1996-12-02 1998-10-07 포맨제프리엘 Method and system for efficient data transmission in multimedia system
KR0171769B1 (en) * 1995-12-30 1999-03-30 유기범 Data transmission method of isdn board
KR20000038076A (en) * 1998-12-03 2000-07-05 정선종 Method for zero-copy message passing

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR970006411B1 (en) * 1993-12-22 1997-04-28 재단법인 한국전자통신연구소 Output device of memory
KR0171769B1 (en) * 1995-12-30 1999-03-30 유기범 Data transmission method of isdn board
KR19980063413A (en) * 1996-12-02 1998-10-07 포맨제프리엘 Method and system for efficient data transmission in multimedia system
KR20000038076A (en) * 1998-12-03 2000-07-05 정선종 Method for zero-copy message passing

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100758272B1 (en) 2006-04-26 2007-09-12 한국전자통신연구원 File movement method supporting data zero-copy technique
US8495262B2 (en) 2010-11-23 2013-07-23 International Business Machines Corporation Using a table to determine if user buffer is marked copy-on-write
CN115167786A (en) * 2022-09-06 2022-10-11 浪潮电子信息产业股份有限公司 Data storage method, device, system, equipment and medium
CN115167786B (en) * 2022-09-06 2023-01-24 浪潮电子信息产业股份有限公司 Data storage method, device, system, equipment and medium

Similar Documents

Publication Publication Date Title
US7206915B2 (en) Virtual space manager for computer having a physical address extension feature
JP3364587B2 (en) System and method for controlling transmission of relatively large data objects in a communication system
US5884313A (en) System and method for efficient remote disk I/O
US6163834A (en) Two level address translation and memory registration system and method
US5961606A (en) System and method for remote buffer allocation in exported memory segments and message passing between network nodes
Welch et al. Pseudo devices: User-level extensions to the Sprite file system
US5768618A (en) Method for performing sequence of actions in device connected to computer in response to specified values being written into snooped sub portions of address space
KR100758272B1 (en) File movement method supporting data zero-copy technique
US20050081202A1 (en) System and method for task queue management of virtual devices using a plurality of processors
US20130318333A1 (en) Operating processors over a network
US6405237B1 (en) Method and apparatus for an efficient data transfer mechanism
US20050144402A1 (en) Method, system, and program for managing virtual memory
CN101150488A (en) A receiving method for zero copy network packet
US11989588B2 (en) Shared memory management method and device
US7103747B2 (en) Memory table and memory manager for use in managing memory
CN113760560A (en) Inter-process communication method and inter-process communication device
WO2023165431A1 (en) Device access method and system for secure container
KR102086757B1 (en) GPU memory scheduler and GPU memory preemption method using the same
US5893926A (en) Data buffering technique in computer system
KR20000065846A (en) Method for zero-copy between kernel and user in operating system
WO2023010879A1 (en) Memory management method and apparatus, and computer device
US11689621B2 (en) Computing device and storage card
US20240176640A1 (en) Method and apparatus for managing memory
JP2664827B2 (en) Real-time information transfer control method
KR19980086588A (en) System Resource Reduction Tool Using TCP / IP Socket Application

Legal Events

Date Code Title Description
N231 Notification of change of applicant
A201 Request for examination
E902 Notification of reason for refusal
E601 Decision to refuse application
J201 Request for trial against refusal decision
J121 Written withdrawal of request for trial