Multi-lane concurrent bag for facilitating inter-thread communication
First Claim
1. A non-transient, computer-readable storage medium storing program instruction executable by a processor to implement:
- a concurrent multi-lane bag data structure comprising;
a plurality of independently-accessible concurrent intermediaries configured to store data elements;
an insert function executable to insert a given data element into the bag by selecting a successive one of the intermediaries, at least in part, by atomically reading and modifying an indication of the most recent intermediary selected by an execution of the insert function, and inserting the data element into the selected intermediary; and
a consume function executable to consume a data element from the bag by choosing a successive one of the intermediaries, at least in part, by atomically reading and modifying an indication of the most recent intermediary chosen by an execution of the consume function, and removing and returning the data element from the chosen intermediary;
wherein;
the bag guarantees that an execution of the consume function consumes a data element if the bag is non-empty; and
the bag enables multiple threads to execute the insert function or the consume function concurrently.
1 Assignment
0 Petitions
Accused Products
Abstract
A method, system, and medium are disclosed for facilitating communication between multiple concurrent threads of execution using a multi-lane concurrent bag. The bag comprises a plurality of independently-accessible concurrent intermediaries (lanes) that are each configured to store data elements. The bag provides an insert function executable to insert a given data element into the bag by selecting one of the intermediaries and inserting the data element into the selected intermediary. The bag also provides a consume function executable to consume a data element from the bag by choosing one of the intermediaries and consuming (removing and returning) a data element stored in the chosen intermediary. The bag guarantees that execution of the consume function consumes a data element if the bag is non-empty and permits multiple threads to execute the insert or consume functions concurrently.
-
Citations
18 Claims
-
1. A non-transient, computer-readable storage medium storing program instruction executable by a processor to implement:
-
a concurrent multi-lane bag data structure comprising; a plurality of independently-accessible concurrent intermediaries configured to store data elements; an insert function executable to insert a given data element into the bag by selecting a successive one of the intermediaries, at least in part, by atomically reading and modifying an indication of the most recent intermediary selected by an execution of the insert function, and inserting the data element into the selected intermediary; and a consume function executable to consume a data element from the bag by choosing a successive one of the intermediaries, at least in part, by atomically reading and modifying an indication of the most recent intermediary chosen by an execution of the consume function, and removing and returning the data element from the chosen intermediary; wherein; the bag guarantees that an execution of the consume function consumes a data element if the bag is non-empty; and the bag enables multiple threads to execute the insert function or the consume function concurrently. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8)
-
-
9. A method, comprising:
-
providing, by a computer system, a multi-lane concurrent bag to a plurality of threads, wherein the bag comprises; a plurality of independently-accessible concurrent intermediaries configured to store data elements; an insert function executable to insert a given data element into the bag by selecting a successive one of the intermediaries, at least in part, by atomically reading and modifying an indication of the most recent intermediary selected by an execution of the insert function, and inserting the data element into the selected intermediary; and a consume function executable to consume a data element from the bag by choosing a successive one of the intermediaries, at least in part, by atomically reading and modifying an indication of the most recent intermediary chosen by an execution of the consume function, and removing and returning the data element from the chosen intermediary; wherein; the bag guarantees that an execution of the consume function consumes a data element if the bag is non-empty; and the bag enables multiple threads to execute the insert function or the consume function concurrently; and
executing, by the computer system, the plurality of concurrent threads, wherein the executing comprises;the threads communicating with one another using the bag by inserting data elements into the bag by executing the insert function and consuming those data elements from the bag by executing the consume function. - View Dependent Claims (10, 11, 12, 13, 14)
-
-
15. A system, comprising:
-
a processor; a memory coupled to the processor and storing program instructions executable by the processor to implement a concurrent multi-lane bag data structure comprising; a plurality of independently-accessible concurrent intermediaries configured to store data elements; an insert function executable to insert a given data element into the bag by selecting a successive one of the intermediaries, at least in part, by atomically reading and modifying an indication of the most recent intermediary selected by an execution of the insert function, and inserting the data element into the selected intermediary, wherein the insert function is configured such that successive executions select successive intermediaries in a predefined order; and a consume function executable to consume a data element from the bag by choosing a successive one of the intermediaries, at least in part, by atomically reading and modifying an indication of the most recent intermediary chosen by an execution of the consume function, and removing and returning the data element from the chosen intermediary, wherein the consume function is configured such that successive executions choose successive intermediaries in the predefined order; wherein; the bag guarantees that an execution of the consume function consumes a data element if the bag is non-empty; and the bag enables multiple threads to execute the insert function or the consume function concurrently. - View Dependent Claims (16, 17, 18)
-
Specification