Contiguous File Buffer Allocation for Packet Stream Reception
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
ATSC 3.0 receivers face challenges in optimizing memory usage, minimizing CPU cycles, avoiding memory leaks, and ensuring acceptable performance with limited resources, particularly in managing fragmented file storage and reception of packet streams.
Innovation Solution
A method and apparatus for managing a buffer with a preset size by determining file identifiers and lengths, deleting entries if an incoming file won't fit, allocating contiguous areas, and updating the write location to optimize storage and reception of packets.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Productivity
If files are stored in a circular buffer with wrapping, then the buffer can continuously receive new files, but file storage becomes fragmented and CPU cycles increase
Solution Approach 1:
The buffer management is segmented into multiple regions: a fixed header region containing file metadata (file_id, length, next_write_location) and a data region for file contents. This segmentation allows efficient tracking of file boundaries and contiguous storage without wrapping, reducing management complexity while maintaining continuous reception capability
Solution Approach 2:
Before storing file data, the system preliminarily allocates a contiguous buffer region based on the expected file length. This preliminary action prevents fragmentation by ensuring sufficient space is reserved upfront, and the header is prepared in advance with all necessary metadata, reducing CPU cycles during actual file reception
2Quantity of substance
If the buffer size is increased to accommodate larger files, then more files can be stored, but memory usage increases
Solution Approach 1:
The buffer management system dynamically tracks the next_write_location in the header and monitors buffer usage. When the buffer is full, the system can clear completed files and reuse buffer space, allowing the same physical buffer to accommodate multiple files over time, effectively increasing storage capacity without increasing memory size
Solution Approach 2:
The system changes the parameter of file storage from fixed-size allocation to variable-size allocation based on actual file lengths. By storing the expected length in the header and allocating exactly that much space, the buffer efficiently packs files of varying sizes, maximizing the number of files that can be stored in the available memory
3Ease of operation
If file metadata is stored separately from file data, then buffer management becomes simpler, but memory access efficiency decreases
Solution Approach 1:
The header containing file metadata (file_id, length, next_write_location) is merged with the file data storage in a single contiguous buffer region. This merging allows the metadata to be immediately accessible when file data is being written or read, eliminating separate memory access operations and maintaining high efficiency while keeping management simple through unified structure
Data Source
Figure 1
Figure 2
Figure 3
AI summary
A method for managing a buffer having a preset byte size for storing files includes determining a file identifier and length of an incoming file. The method includes determining that the incoming file will not fit into a space between a next write location and an end of the buffer. In response to the determination that the incoming file will not fit, the method includes, in a map, deleting each entry corresponding to a file at least partially overlapping the range of the incoming file and adding an entry in the map for the incoming file. The method further includes allocating a contiguous area in the buffer for the incoming file and then moving the next write location to the end of the allocated contiguous area, and receiving packets of the incoming file and storing the received packets into the allocated contiguous area.