Skip to content

WorkQueue

#include <xalgospp/scheduling/queue.hh>
class WorkQueue

Defined in src/lib/xalgospp/scheduling/queue.hh:33

A generic queue from which DAG tasks will be taken and scheduled.

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
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.

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.

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.

Whether there is outstanding work to do on this queue.

Return Name Description
std::mutex m_mutex
std::deque< std::shared_ptr< Task > > m_tasks

std::mutex m_mutex

Defined in src/lib/xalgospp/scheduling/queue.hh:103


std::deque< std::shared_ptr< Task > > m_tasks

Defined in src/lib/xalgospp/scheduling/queue.hh:104