Multithreaded lossy queue protocol
AssigneeTarget Brands, Inc.
InventorsLuis F. Stevens, Hrishikesh V. Prabhune, Christopher Fretz
Life of this patent
Estimating the term…
Abstract
Methods and systems for managing a circular queue, or ring buffer, are disclosed. One method includes storing data from a producer into the ring buffer, and receiving a data read request from a consumer from among a plurality of consumers subscribed to read data from the ring buffer. After obtaining data from a location in the ring buffer in response to the data read request, it is determined if the location has been overrun by the producer. If it is determined that the location has been overrun by the producer, the data is discarded by the consumer. Otherwise, the data is consumed. Depending on the outcome, a miss counter or a read counter may be incremented.
Claims20
A system comprising:
- one or more processors;
- and
- a memory storing instructions that, when executed by the one or more processors, cause the one or more processors to:
- store, in a ring buffer in the memory, data from a producer;
- receive a data read request from a consumer from among a plurality of consumers, wherein each of the plurality of consumers is subscribed to independently read all data from the ring buffer;
- after obtaining data from a location in the ring buffer in response to the data read request, determine if the location has been overrun by the producer;
- if it is determined that the location has been overrun by the producer, discard the obtained data by the consumer and restart the consumer to read new data from a different location in the ring buffer by setting a consumer base index pointer associated with the consumer to a current location of a producer base index pointer associated with the producer;
- and
- if it is determined that the location has not been overrun by the producer, consume the obtained data.
A method comprising:
- storing, in a circular queue, data from a producer;
- receiving a data read request from a consumer from among a plurality of consumers, wherein each of the plurality of consumers is subscribed to independently read all data from the circular queue;
- copying data from a location in the circular queue that is adjacent to last-read data by the consumer;
- after copying the data in response to the data read request, determining whether the location has been overrun by the producer;
- upon determining that the location has not been overrun by the producer, consuming the copied data and incrementing a read counter;
- and
- upon determining that the location has been overrun by the producer, discarding the copied data by the consumer and restarting the consumer to read new data from a different location in the circular queue by setting a consumer base index pointer associated with the consumer to a current location of a producer base index pointer associated with the producer.
A system comprising:
- one or more processors;
- and
- a memory storing instructions that, when executed by the one or more processors, cause the one or more processors to:
- store, in a ring buffer in the memory, data from a producer at a location between a producer base index pointer and a producer reserve index pointer;
- receive a data read request from a consumer from among a plurality of consumers, wherein each of the plurality of consumers is subscribed to independently read all data from the ring buffer, the data read request identifying data in the ring buffer adjacent to a consumer base index pointer;
- after obtaining data from a location in the ring buffer between the consumer base index pointer and a consumer reserve index pointer in response to the data read request, determine if the location of the obtained data has been overrun by the producer by comparing the consumer base index pointer to the producer reserve index pointer;
- if it is determined that the location of the obtained data has been overrun by the producer, discard the obtained data by the consumer and proceed to read new data from a different location in the ring buffer by setting the consumer base index pointer to a current location of the producer base index pointer;
- and
- if it is determined that the location of the obtained data has not been overrun by the producer, consume the obtained data.
Dependencies are inferred from the claim text.