PPL Logo

conv::msgQ< P > Class Template Reference

Charm Message Queue: Holds msg pointers and returns the next message to execute on a PE. More...

#include <msgq.h>

Collaboration diagram for conv::msgQ< P >:

Collaboration graph
[legend]

Public Types

typedef P prio_t
 The datatype for msg priorities.
typedef P prio_t

Public Member Functions

 msgQ ()
 Hardly any initialization required.
void enq (const msg_t *msg, const prio_t &prio=prio_t(), const bool isFifo=true)
 Given a message (optionally with a priority and queuing policy), enqueue it for delivery.
const msg_tdeq ()
 Pop (and return) the next message to deliver.
size_t size () const
 Number of messages in the queue.
size_t max_size () const
bool empty () const
 Is the queue empty?
void enumerate (msg_t **first, msg_t **last) const
 Just so that we can support CqsEnumerateQueue().
 msgQ ()
size_t size () const
size_t max_size () const
bool empty () const
void enumerate (msg_t **first, msg_t **last) const
void enq (const msg_t *msg, const prio_t &prio=prio_t(), const bool isFifo=true)
const msg_tdeq ()

Private Types

typedef std::deque< const msg_t * > bkt_t
 Message bucket type.
typedef std::pair< prio_t,
bkt_t * > 
prioidx_t
 A key-val pair of a priority value and a handle to the bucket of msgs of that priority.
typedef std::unordered_map
< prio_t, bkt_t
bktmap_t
 A type for mapping between priority values and msg buckets.

Private Attributes

std::vector< const msg_t * > randQ
 All the messages go in one bin when we're picking them out randomly.
size_t qSize
 The size of this message queue.
bktmap_t msgbuckets
 Collection of msg buckets, each holding msgs of a given priority (maps priorities to buckets).
std::priority_queue< prioidx_t,
std::vector< prioidx_t >
, std::greater< prioidx_t > > 
prioQ
 A _min_ heap of distinct msg priorities along with handles to matching buckets.
std::deque< const msg_t * > bkt

Friends

std::ostream & operator<< (std::ostream &out, const msgQ &q)
 An ostream operator overload, that currently just prints q size.
std::ostream & operator<< (std::ostream &out, const msgQ &q)

Detailed Description

template<typename P = int>
class conv::msgQ< P >

Charm Message Queue: Holds msg pointers and returns the next message to execute on a PE.

Templated on the type of the priority field. Defaults to int priority. All scheduling policies are encapsulated behind this queue interface.

All messages of a given priority p are stored in a single container. Since each message can be enqueued either to the front or back of this container, a dequeue is used. Each such dequeue is referred to as a bucket. The set of priority values of all the messages in the container is stored in a min-heap. A deq() operation simply peeks at the most important prio value, and finds the bucket associated with that value. It then dequeues the message at the front of this bucket. A mapping between the priority values and the corresponding buckets is maintained. enq() operations simply find the bucket corresponding to a prio value and place the msg into it.

Definition at line 37 of file msgq.h.


Member Typedef Documentation

template<typename P = int>
typedef P conv::msgQ< P >::prio_t

The datatype for msg priorities.

Definition at line 41 of file msgq.h.

template<typename P = int>
typedef std::deque<const msg_t*> conv::msgQ< P >::bkt_t [private]

Message bucket type.

Definition at line 77 of file msgq.h.

template<typename P = int>
typedef std::pair<prio_t, bkt_t*> conv::msgQ< P >::prioidx_t [private]

A key-val pair of a priority value and a handle to the bucket of msgs of that priority.

Definition at line 79 of file msgq.h.

template<typename P = int>
typedef std::unordered_map<prio_t, bkt_t> conv::msgQ< P >::bktmap_t [private]

A type for mapping between priority values and msg buckets.

Definition at line 81 of file msgq.h.

template<typename P = int>
typedef P conv::msgQ< P >::prio_t

Definition at line 222 of file msgq.h.


Constructor & Destructor Documentation

template<typename P = int>
conv::msgQ< P >::msgQ (  )  [inline]

Hardly any initialization required.

Definition at line 44 of file msgq.h.

template<typename P = int>
conv::msgQ< P >::msgQ (  )  [inline]

Definition at line 223 of file msgq.h.


Member Function Documentation

template<typename P>
void conv::msgQ< P >::enq ( const msg_t msg,
const prio_t prio = prio_t(),
const bool  isFifo = true 
) [inline]

Given a message (optionally with a priority and queuing policy), enqueue it for delivery.

Definition at line 94 of file msgq.h.

References conv::msgQ< P >::bkt, conv::msgQ< P >::msgbuckets, conv::msgQ< P >::prioQ, conv::msgQ< P >::qSize, and conv::msgQ< P >::randQ.

template<typename P>
const msg_t * conv::msgQ< P >::deq ( void   )  [inline]

Pop (and return) the next message to deliver.

For detecting races, and for a general check that applications dont depend on priorities or message ordering for correctness, charm can be built with a randomized scheduler queue.

In this case, this container's deq() operation will not actually respect priorities. Instead it simply returns a randomly selected msg.

Definition at line 140 of file msgq.h.

References conv::msgQ< P >::bkt, conv::msgQ< P >::empty(), msg, conv::msgQ< P >::msgbuckets, conv::msgQ< P >::prioQ, and conv::msgQ< P >::qSize.

Here is the call graph for this function:

template<typename P = int>
size_t conv::msgQ< P >::size ( void   )  const [inline]

Number of messages in the queue.

Definition at line 53 of file msgq.h.

References conv::msgQ< P >::qSize.

Referenced by CqsEnumerateQueue().

Here is the caller graph for this function:

template<typename P = int>
size_t conv::msgQ< P >::max_size (  )  const [inline]

Definition at line 54 of file msgq.h.

References max().

Here is the call graph for this function:

template<typename P = int>
bool conv::msgQ< P >::empty (  )  const [inline]

Is the queue empty?

Definition at line 57 of file msgq.h.

References conv::msgQ< P >::qSize.

Referenced by conv::msgQ< P >::deq().

Here is the caller graph for this function:

template<typename P>
void conv::msgQ< P >::enumerate ( msg_t **  first,
msg_t **  last 
) const [inline]

Just so that we can support CqsEnumerateQueue().

Definition at line 196 of file msgq.h.

References conv::msgQ< P >::msgbuckets, and conv::msgQ< P >::randQ.

Referenced by CqsEnumerateQueue().

Here is the caller graph for this function:

template<typename P = int>
size_t conv::msgQ< P >::size ( void   )  const [inline]

Definition at line 224 of file msgq.h.

References conv::msgQ< P >::bkt.

template<typename P = int>
size_t conv::msgQ< P >::max_size (  )  const [inline]

Definition at line 225 of file msgq.h.

References conv::msgQ< P >::bkt.

template<typename P = int>
bool conv::msgQ< P >::empty (  )  const [inline]

Definition at line 226 of file msgq.h.

References conv::msgQ< P >::bkt.

template<typename P = int>
void conv::msgQ< P >::enumerate ( msg_t **  first,
msg_t **  last 
) const [inline]

Definition at line 227 of file msgq.h.

template<typename P = int>
void conv::msgQ< P >::enq ( const msg_t msg,
const prio_t prio = prio_t(),
const bool  isFifo = true 
) [inline]

Definition at line 230 of file msgq.h.

References conv::msgQ< P >::bkt.

template<typename P = int>
const msg_t* conv::msgQ< P >::deq ( void   )  [inline]

Definition at line 234 of file msgq.h.

References conv::msgQ< P >::bkt.


Friends And Related Function Documentation

template<typename P = int>
std::ostream& operator<< ( std::ostream &  out,
const msgQ< P > &  q 
) [friend]

An ostream operator overload, that currently just prints q size.

Definition at line 63 of file msgq.h.

template<typename P = int>
std::ostream& operator<< ( std::ostream &  out,
const msgQ< P > &  q 
) [friend]

Definition at line 228 of file msgq.h.


Field Documentation

template<typename P = int>
std::vector<const msg_t*> conv::msgQ< P >::randQ [private]

All the messages go in one bin when we're picking them out randomly.

Definition at line 73 of file msgq.h.

Referenced by conv::msgQ< P >::enq(), and conv::msgQ< P >::enumerate().

template<typename P = int>
size_t conv::msgQ< P >::qSize [private]

The size of this message queue.

Definition at line 84 of file msgq.h.

Referenced by conv::msgQ< P >::deq(), conv::msgQ< P >::empty(), conv::msgQ< P >::enq(), and conv::msgQ< P >::size().

template<typename P = int>
bktmap_t conv::msgQ< P >::msgbuckets [private]

Collection of msg buckets, each holding msgs of a given priority (maps priorities to buckets).

Definition at line 86 of file msgq.h.

Referenced by conv::msgQ< P >::deq(), conv::msgQ< P >::enq(), and conv::msgQ< P >::enumerate().

template<typename P = int>
std::priority_queue<prioidx_t, std::vector<prioidx_t>, std::greater<prioidx_t> > conv::msgQ< P >::prioQ [private]

A _min_ heap of distinct msg priorities along with handles to matching buckets.

Definition at line 88 of file msgq.h.

Referenced by conv::msgQ< P >::deq(), and conv::msgQ< P >::enq().

template<typename P = int>
std::deque<const msg_t*> conv::msgQ< P >::bkt [private]


The documentation for this class was generated from the following file:

Generated on Mon Sep 21 08:33:47 2020 for Charm++ by  doxygen 1.5.5