Circular Buffer Architecture Using Hardware Locks for Deadlock-Free Operation
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Implementing an N-element circular buffer with limited memory resources is a complex task, requiring customized solutions to ensure efficient and deadlock-free operation, especially when the number of memory banks is less than the number of objects to be stored.
Innovation Solution
The system includes a circular buffer with a memory coupled to a producer circuit and a consumer circuit, featuring a buffer controller that tracks positions and uses hardware locks to allocate objects across multiple memory banks, ensuring deadlock-free operation by enforcing specific data access constraints.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Device complexity
If the number of memory banks is reduced to save resources, then device complexity and resource usage decrease, but the ability to store N objects and ensure deadlock-free operation deteriorates
Solution Approach 1:
The circular buffer is segmented into multiple memory banks (M banks) where each bank stores a portion of the N objects. The buffer controller divides the objects across banks using bank indices calculated from object indices, allowing the system to function with fewer memory banks than objects while maintaining deadlock-free operation through coordinated access control.
Solution Approach 2:
A buffer controller acts as an intermediary between the producer/consumer circuits and the memory banks. It tracks the position of objects across banks, manages hardware locks for each bank, and coordinates access to prevent deadlocks. This intermediary layer enables the system to overcome the limitation of having fewer memory banks than objects by intelligently managing resource allocation and access patterns.
2Reliability
If hardware locks are used to reserve memory banks, then deadlock-free operation is ensured, but device complexity increases
Solution Approach 1:
The hardware locks serve multiple functions: they reserve memory banks for exclusive access, track which banks are currently in use, and coordinate between producer and consumer circuits. Each of the M hardware locks corresponds to one memory bank and manages access rights, allowing a single lock mechanism to handle multiple aspects of synchronization and resource management.
Solution Approach 2:
The buffer controller automatically manages the hardware locks by acquiring them before allocating objects to memory banks and releasing them when objects are moved or freed. The system self-regulates access control without external intervention, with the buffer controller tracking lock states and coordinating releases to prevent deadlocks while maintaining efficient resource utilization.
3Productivity
If multiple positions are tracked to manage limited memory banks, then efficient allocation is achieved, but device complexity increases
Solution Approach 1:
The buffer controller pre-calculates and tracks the positions of objects across memory banks before allocation or movement occurs. It maintains four position trackers (consumer bank position, consumer object position, producer bank position, producer object position) that are updated in advance of actual data movements, enabling efficient allocation decisions without requiring complex runtime searches or negotiations.
Data Source
AI summary
A circular buffer architecture includes a memory coupled to a producer circuit and a consumer circuit. The memory is configured to store objects. The memory can include memory banks. The number of the memory banks is less than a number of the objects. The circular buffer can include hardware locks configured to reserve selected ones of the memory banks for use by the producer circuit or the consumer circuit. The circular buffer can include a buffer controller coupled to the memory and configured to track a plurality of positions. The positions can include a consumer bank position, a consumer object position, a producer bank position, and a producer object position. The buffer controller is configured to allocate selected ones of the objects from the memory banks to the producer circuit and to the consumer circuit according to the tracked positions and using the hardware locks.


