Method and system for queuing data for multiple readers and writers
AssigneeTravelport, LP
InventorBryan Karr
Life of this patent
Estimating the term…
Abstract
Systems and methods of queuing data for multiple readers and writers are provided. Enqueuing operations are disclosed that can process write functionality and can determine whether ring buffers have potentially filled, and dynamically declare a new ring buffer at a multiple of capacity of the current ring. Dequeuing operations are disclosed that can process read functionality for advancing control and determining whether and when to free ring buffers from memory.
Claims14
A computer-implemented method of allocating a ring buffer, the method comprising:
- sequentially storing data with a first set of values in a first ring buffer comprising x elements, wherein x is a positive integer greater than two;
- determining that the first ring buffer is full because a first element of the first ring buffer and a last element of the first ring buffer have wrapped upon each other;
- allocating a second ring buffer, wherein the second ring buffer contains at least x+1elements;
- and
- sequentially storing data with a second set of values in one or more elements of the second ring buffer, wherein write operations are performed on elements of the second ring buffer because the last element of the first ring buffer is occupied by a value, and wherein reading operations are performed on the first set of values in the first ring buffer concurrently with or subsequently to the write operations being performed on the second set of values in the ring buffer.
A computer-implemented method of deallocating a ring buffer, the method comprising:
- storing a queue comprising at least one pointer;
- sequentially storing data with a first set of values in a first ring buffer comprising x elements, wherein x is a positive integer greater than two;
- determining that the first ring buffer is full because a first element of the first ring buffer and a last element of the first ring buffer have wrapped upon each other;
- allocating a second ring buffer, wherein the second ring buffer contains at least x+1elements;
- and
- sequentially storing data with a second set of values in one or more elements of the second ring buffer, wherein write operations are performed on an element of the second ring buffer because the last element of the first ring buffer is occupied by a value, and wherein reading operations are performed on the first set of values in the first ring buffer concurrently with or subsequently to the write operations being performed on the second set of values in the ring buffer;
- determining that the first ring buffer is empty based on a head pointer being associated with the first ring buffer, and a drain pointer being associated with the second ring buffer;
- and
- deallocating the first ring buffer.
A computer-implemented method of deallocating a ring buffer, the method comprising:
- storing a first ring buffer having a plurality of elements;
- sequentially storing data with a first set of values in a first ring buffer comprising x elements, wherein x is a positive integer greater than two;
- determining that the first ring buffer is full because a first element of the first ring buffer and a last element of the first ring buffer have wrapped upon each other;
- allocating a second ring buffer, wherein the second ring buffer contains at least x+1elements;
- sequentially storing data with a second set of values in one or more elements of the second ring buffer, wherein write operations are performed on elements of the second ring buffer because the last element of the first ring buffer is occupied by a value, and wherein reading operations are performed on the first set of values in the first ring buffer concurrently with or subsequently to the write operations being performed on the second set of values in the ring buffer;
- storing, in a local field, values corresponding to a current front element of the first ring buffer and an end element in the first ring buffer;
- determining that the first ring buffer is empty because the first ring buffer either:
- is not blocked and is not wrapped, or
- the first ring buffer is blocked and the value of the current front element is not in a position corresponding to the end element;
- and
- deallocating the first ring buffer.
A computer-implemented method of storing a queue, the queue associated with at least one ring buffer, the method comprising:
- storing at least one queue attribute that points to at least one attribute of a first ring buffer, wherein the at least one queue attribute includes one or more of:
- a head pointer,
- a drain pointer,
- a value corresponding to a quantity of readers, or
- a value corresponding to a quantity of writers;
- sequentially storing data with a first set of values in the first ring buffer;
- and
- sequentially storing data with a second set of values in one or more elements of a second ring buffer, wherein write operations are performed on elements of the second ring buffer because the last element of the first ring buffer is occupied by a value, and wherein reading operations are performed on the first set of values in the first ring buffer concurrently with or subsequently to the write operations being performed on the second set of values in the ring buffer.
Dependencies are inferred from the claim text.