Zero-Copy Streaming Media Transmission via Scatter-Gather I/O

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing methods for streaming media data transmission in Linux-based systems incur significant CPU overhead due to data copying and system calls, particularly when handling heavy loads, which hampers system processing ability and efficiency.

Innovation Solution

Implementing zero copy transmission using the Linux network protocol stack by separating the head and load of RTP packets and utilizing DMA and Scatter/Gather functions to map buffers directly to the network card, reducing the need for data copies and system calls through the 'sendmsg' system call, which enables batch transmission of packets.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If data is copied from user space to kernel space for RTP packet transmission, then network protocol compatibility is maintained, but CPU resources are excessively consumed and system processing ability decreases

Engineering Contradiction:
Improvenetwork protocol compatibilityVSAvoidsystem processing ability
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The patent extracts the data copying operation from the mandatory transmission path by using scatter-gather I/O to map user space buffers directly to kernel space network buffers, eliminating the intermediate copy step while maintaining protocol compatibility through the sendmsg system call interface

Inventive Principle:
Principle #2Taking out (Extraction)

Solution Approach 2:

The patent introduces scatter-gather I/O as an intermediary mechanism that bridges user space and kernel space without requiring data copying, using descriptor structures to map buffer regions and enable direct memory access between the two spaces

Inventive Principle:
Principle #24Intermediary (Mediator)

2Reliability

If multiple system calls are used for data reading, packaging, and transmission, then each operation can be performed correctly, but context switching overhead increases and CPU usage rises

Engineering Contradiction:
Improveoperation correctnessVSAvoidCPU usage
Core Design Contradiction:
ReliabilityVSUse of energy by moving object

Solution Approach 1:

The patent merges multiple system calls (read, packaging, send) into a single sendmsg system call that performs all operations in one kernel context entry, combining data retrieval, RTP packet formation, and network transmission into one atomic operation sequence

Inventive Principle:
Principle #5Merging (Combining)

Solution Approach 2:

The patent performs preliminary actions by pre-allocating and pre-mapping buffer descriptors before the sendmsg call, so that when the system call is made, all buffer mappings and packet structures are already prepared, eliminating the need for multiple context switches during transmission

Inventive Principle:
Principle #10Preliminary action

3Reliability

If data is copied multiple times during transmission from disk to network, then data integrity is maintained across system spaces, but transmission efficiency decreases and processing time increases

Engineering Contradiction:
Improvedata integrityVSAvoidtransmission time
Core Design Contradiction:
ReliabilityVSLoss of time

Solution Approach 1:

The patent replaces physical data copying with virtual memory mapping using scatter-gather descriptors, where buffer descriptors reference the same physical memory pages from different virtual address spaces, eliminating actual data movement while maintaining data integrity across user and kernel spaces

Inventive Principle:
Principle #26Copying

Solution Approach 2:

The patent changes the dimension of data transfer by moving from a linear copy operation (source to destination) to a multi-dimensional mapping operation using scatter-gather I/O descriptors that create virtual connections between disk buffers, user buffers, and network buffers without physical data movement

Inventive Principle:
Principle #17Another dimension (Dimensionality change)

Data Source

PatentEP2312807B1Method and system for enabling zero-copy transmission of streaming media data
Publication Date: 2018.11.14 ZTE CORP
  • EP2312807B1 patent drawingFigure 1~2

AI summary

A method and system for implementing zero copy transmission of streaming media data are disclosed in the present invention, and the method and system are based on Linux network protocol stack. The method comprises: when a streaming media server receives a data request from a user equipment, it performs a system call of data transmission, reading the streaming media data out from the disk space and writing it into a user data buffer; packaging the streaming media data stored in the user data buffer as real-time transmission protocol packets which are transmitted applying streaming media packets whose head and load are separated. The method and system of the present invention sufficiently use the DMA function and SG (Scatter/Gather) function of a network card to implement zero-copy transmission of the streaming media data; compared with the existing network protocol stack of Linux kernel, the method and system of the present invention implement the transmission of streaming media packets whose head and load are separated and reduce one data copy operation required in the process of RTP packaging the streaming media data.