Patent ID: 8607249

Claim:
A computer-implemented method of facilitating communication between multiple concurrent threads of execution, the method comprising: a computer executing the threads concurrently, wherein the threads comprise a plurality of producer threads and a plurality of consumer threads; the computer providing the multiple concurrent threads with access to an efficient queue, wherein the providing includes: providing an insert function usable by the producer threads to insert messages into the efficient queue concurrently through invocations of the insert function; and providing a consume function usable by the consumer threads to read the messages from the efficient queue concurrently, wherein for each of the producers, the consume function is configured to guarantee that messages inserted by the producer are read in the order in which the producer inserted those messages and that each message is read at most once; and the producer threads using the efficient queue to exchange messages with the consumer threads by: the producer threads inserting messages into the efficient queue by executing the insert function and the consumer threads reading the messages by executing the consume function; wherein the queue is configured to store the messages in an element array, and wherein different cells of the element array are concurrently accessible by the multiple concurrent threads of execution; wherein executing the insert function comprises determining an index into the element array and an insert ticket number, wherein the index and insert ticket number are calculated dependent on the number of times the insert function has been invoked; and wherein the producer threads insert the messages in an order determined by the index and the insert ticket number.