Lockless Ring Buffer Access via Nextfilled Pointers

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Ring buffer readers experience delays due to locking mechanisms, which hinder the efficient communication of data, particularly in real-time applications like audio/video processing, as higher execution priority for readers does not entirely prevent delays caused by locking contention and the need for writers to catch up.

Innovation Solution

Implementing a lockless access method to a ring buffer using nextfilled pointers to allow concurrent access by readers and writers without exclusive locking, allowing readers to advance and writers to write ahead, and dynamically adjusting the ring buffer size to improve performance and resource management.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If a locking mechanism is used to coordinate access to the ring buffer, then data integrity is maintained, but reader delays occur due to locking contention and overhead

Engineering Contradiction:
Improvedata integrityVSAvoidreader delay
Core Design Contradiction:
ReliabilityVSLoss of time

Solution Approach 1:

The patent extracts the locking mechanism from the ring buffer access coordination and replaces it with a lockless approach using per-element state tracking. Readers and writers independently track which buffer elements are filled or being processed, eliminating the need for mutual exclusion locks while maintaining data integrity through careful state management of individual buffer slots.

Inventive Principle:
Principle #2Taking out (Extraction)

Solution Approach 2:

The patent introduces an intermediary state tracking system where readers and writers maintain separate knowledge of buffer element states (filled, processing, empty). This intermediary layer of state information allows concurrent access without direct coordination through locks, as each thread can independently determine which elements are safe to access based on the tracked states.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Loss of time

If a higher execution priority is assigned to the reader thread, then reader delays are reduced, but the reader catches up to the writer and must wait

Engineering Contradiction:
Improvereader delayVSAvoidwriter throughput
Core Design Contradiction:
Loss of timeVSProductivity

Solution Approach 1:

The patent segments the ring buffer into independent, concurrently accessible elements with individual state tracking. Instead of treating the buffer as a single locked resource, each buffer slot can be independently accessed by readers or writers based on its state, allowing the reader to progress through available elements without blocking the writer from filling other elements.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent implements dynamic state tracking where the accessibility of buffer elements changes based on real-time conditions. Readers can dynamically access any element marked as filled, while writers can dynamically fill any element marked as empty or processed, creating a flexible system that adapts to the relative speeds of readers and writers without fixed priority constraints.

Inventive Principle:
Principle #15Dynamics

3Ease of manufacture

If the ring buffer size is fixed, then memory allocation is simple, but resource utilization is inefficient when read/write speeds vary

Engineering Contradiction:
Improvememory allocationVSAvoidresource utilization
Core Design Contradiction:
Ease of manufactureVSProductivity

Solution Approach 1:

The patent implements a dynamically resizable ring buffer where the buffer size can be adjusted at runtime based on actual workload demands. The buffer can expand when data production exceeds consumption and contract when consumption catches up, optimizing memory utilization while maintaining efficient read/write operations through the lockless access mechanism.

Inventive Principle:
Principle #15Dynamics

Data Source

PatentUS7620753B1Lockless access to a ring buffer
Publication Date: 2009.11.17 APPLE INC
  • US7620753B1 patent drawing
  • US7620753B1 patent drawing
  • US7620753B1 patent drawing

AI summary

A reader and writer access a ring buffer without using a locking mechanism, thereby avoiding any delays attendant to using a locking mechanism when performing read operations to supply the reader with data from the ring buffer. Other measures are used to reduce delayed performance of read operations. If data requested by a reader is not available in the ring buffer, rather than waiting until the data becomes available, substitute data not from the ring buffer is provided instead. The ring buffer's size may be dynamically increased or decreased to improve performance of read and write operations and/or to conserve computer resources.