WorkQueue
WorkQueue
Section titled “WorkQueue”#include <xalgospp/scheduling/queue.hh>class WorkQueueDefined in src/lib/xalgospp/scheduling/queue.hh:33
A generic queue from which DAG tasks will be taken and scheduled.
List of all members
Section titled “List of all members”| Name | Kind | Owner |
|---|---|---|
push |
function |
Declared here |
pop |
function |
Declared here |
steal |
function |
Declared here |
empty |
function |
Declared here |
m_mutex |
variable |
Declared here |
m_tasks |
variable |
Declared here |
Public Methods
Section titled “Public Methods”| Return | Name | Description |
|---|---|---|
void |
push inline |
Add new work to the queue. |
std::shared_ptr< Task > |
pop inline |
Take the next work item from the front of the queue. |
std::shared_ptr< Task > |
steal inline |
Steal work from the queue. |
bool |
empty inline |
Whether there is outstanding work to do on this queue. |
inline
inline void push(std::shared_ptr< Task > task)Defined in src/lib/xalgospp/scheduling/queue.hh:40
Add new work to the queue.
inline
inline std::shared_ptr< Task > pop()Defined in src/lib/xalgospp/scheduling/queue.hh:54
Take the next work item from the front of the queue.
Workers preferrentially take work from their local (in NUMA locality sense) queues. When doing so, they pop from the front using this routine. Work can also be stolen (see below), in which case it pulls from the back.
Returns
Section titled “Returns”The work to do or nullptr.
inline
inline std::shared_ptr< Task > steal()Defined in src/lib/xalgospp/scheduling/queue.hh:76
Steal work from the queue.
If a worker does not find pending work locally, it can take work from a remote queue. In that case, it will steal from the back of the queue in order to minimize contention with the local workers that are popping from the front.
Returns
Section titled “Returns”The stolen work or nullptr.
inline
inline bool empty()Defined in src/lib/xalgospp/scheduling/queue.hh:96
Whether there is outstanding work to do on this queue.
Returns
Section titled “Returns”Whether there is outstanding work to do on this queue.
Private Attributes
Section titled “Private Attributes”| Return | Name | Description |
|---|---|---|
std::mutex |
m_mutex |
|
std::deque< std::shared_ptr< Task > > |
m_tasks |
m_mutex
Section titled “m_mutex”std::mutex m_mutexDefined in src/lib/xalgospp/scheduling/queue.hh:103
m_tasks
Section titled “m_tasks”std::deque< std::shared_ptr< Task > > m_tasksDefined in src/lib/xalgospp/scheduling/queue.hh:104