Mark3 Realtime Kernel
Mark3::PriorityMapL2< T, C > Class Template Reference

The PriorityMapL2 class This class implements a priority bitmap data structure. Each bit in the objects internal storage represents a priority. When a bit is set, it indicates that something is scheduled at the bit's corresponding priority, when a bit is clear it indicates that no entities are scheduled at that priority. This object provides the fundamental logic required to implement efficient priority-based scheduling for the thread + coroutine schedulers in the kernel. More...

#include <priomapl2.h>

Public Member Functions

 PriorityMapL2 ()
 PriorityMap Initialize the priority map object, clearing the bitamp data to all 0's. More...
 
void Set (T uXPrio_)
 Set Set the priority map bitmap data, at all levels, for the given priority. More...
 
void Clear (T uXPrio_)
 Clear Clear the priority map bitmap data, at all levels, for the given priority. More...
 
HighestPriority (void)
 HighestPriority Computes the numeric priority of the highest-priority thread represented in the priority map. More...
 

Static Private Member Functions

static T PrioBit (T prio)
 
static T PrioMapWordIndex (T prio)
 
static T PriorityFromBitmap (T uXPrio_)
 

Private Attributes

m_auXPriorityMap [m_uXPrioMapNumWords]
 
m_uXPriorityMapL2
 

Static Private Attributes

static constexpr size_t m_uXPrioMapShiftLUT [9] = {0, 3, 4, 0, 5, 0, 0, 0, 6}
 
static constexpr auto m_uXPrioMapWordShift = T { m_uXPrioMapShiftLUT[sizeof(T)] }
 
static constexpr auto m_uXPrioMapBits = T { 8 * sizeof(T) }
 
static constexpr auto m_uXPrioMapBitMask = T { (1 << m_uXPrioMapWordShift) - 1 }
 
static constexpr auto m_uXPrioMapNumWords = T { (C + (m_uXPrioMapBits - 1)) / m_uXPrioMapBits }
 

Detailed Description

template<typename T, size_t C>
class Mark3::PriorityMapL2< T, C >

The PriorityMapL2 class This class implements a priority bitmap data structure. Each bit in the objects internal storage represents a priority. When a bit is set, it indicates that something is scheduled at the bit's corresponding priority, when a bit is clear it indicates that no entities are scheduled at that priority. This object provides the fundamental logic required to implement efficient priority-based scheduling for the thread + coroutine schedulers in the kernel.

The L2 version of the datastructure uses a two-layer nested map structure, where a first layer bitmap contains a single unsigned integer of type "T", where each bit corresponds to an array entry in the second layer table. The second layer consists of an array of unsigned integers of type "T", where each bit in each element corresponds to a level of priority supported by the map structure. As a result, the maximum number of priorities ("C") supported by the object is n*n, where n is the number of bits in the "T" parameter. i.e., if an 8-bit unsigned int is used, this object supports up to 64 priorities; and if a 32-bit unsigned int is used, the object supports up to 1024 priorities.

Definition at line 50 of file priomapl2.h.

Constructor & Destructor Documentation

◆ PriorityMapL2()

template<typename T , size_t C>
Mark3::PriorityMapL2< T, C >::PriorityMapL2 ( )
inline

PriorityMap Initialize the priority map object, clearing the bitamp data to all 0's.

Definition at line 57 of file priomapl2.h.

Member Function Documentation

◆ Clear()

template<typename T , size_t C>
void Mark3::PriorityMapL2< T, C >::Clear ( uXPrio_)
inline

Clear Clear the priority map bitmap data, at all levels, for the given priority.

Parameters
uXPrio_Priority level to clear the bitmap data for.

Definition at line 82 of file priomapl2.h.

◆ HighestPriority()

template<typename T , size_t C>
T Mark3::PriorityMapL2< T, C >::HighestPriority ( void  )
inline

HighestPriority Computes the numeric priority of the highest-priority thread represented in the priority map.

Returns
Highest priority ready-thread's number.

Definition at line 100 of file priomapl2.h.

◆ PrioBit()

template<typename T , size_t C>
static T Mark3::PriorityMapL2< T, C >::PrioBit ( prio)
inlinestaticprivate

Definition at line 113 of file priomapl2.h.

◆ PrioMapWordIndex()

template<typename T , size_t C>
static T Mark3::PriorityMapL2< T, C >::PrioMapWordIndex ( prio)
inlinestaticprivate

Definition at line 115 of file priomapl2.h.

◆ PriorityFromBitmap()

template<typename T , size_t C>
static T Mark3::PriorityMapL2< T, C >::PriorityFromBitmap ( uXPrio_)
inlinestaticprivate

Definition at line 117 of file priomapl2.h.

◆ Set()

template<typename T , size_t C>
void Mark3::PriorityMapL2< T, C >::Set ( uXPrio_)
inline

Set Set the priority map bitmap data, at all levels, for the given priority.

Parameters
uXPrio_Priority level to set the bitmap data for.

Definition at line 68 of file priomapl2.h.

Member Data Documentation

◆ m_auXPriorityMap

template<typename T , size_t C>
T Mark3::PriorityMapL2< T, C >::m_auXPriorityMap[m_uXPrioMapNumWords]
private

Definition at line 148 of file priomapl2.h.

◆ m_uXPrioMapBitMask

template<typename T , size_t C>
constexpr auto Mark3::PriorityMapL2< T, C >::m_uXPrioMapBitMask = T { (1 << m_uXPrioMapWordShift) - 1 }
staticprivate

Definition at line 142 of file priomapl2.h.

◆ m_uXPrioMapBits

template<typename T , size_t C>
constexpr auto Mark3::PriorityMapL2< T, C >::m_uXPrioMapBits = T { 8 * sizeof(T) }
staticprivate

Definition at line 141 of file priomapl2.h.

◆ m_uXPrioMapNumWords

template<typename T , size_t C>
constexpr auto Mark3::PriorityMapL2< T, C >::m_uXPrioMapNumWords = T { (C + (m_uXPrioMapBits - 1)) / m_uXPrioMapBits }
staticprivate

Definition at line 146 of file priomapl2.h.

◆ m_uXPrioMapShiftLUT

template<typename T , size_t C>
constexpr size_t Mark3::PriorityMapL2< T, C >::m_uXPrioMapShiftLUT[9] = {0, 3, 4, 0, 5, 0, 0, 0, 6}
staticprivate

Definition at line 139 of file priomapl2.h.

◆ m_uXPrioMapWordShift

template<typename T , size_t C>
constexpr auto Mark3::PriorityMapL2< T, C >::m_uXPrioMapWordShift = T { m_uXPrioMapShiftLUT[sizeof(T)] }
staticprivate

Definition at line 140 of file priomapl2.h.

◆ m_uXPriorityMapL2

template<typename T , size_t C>
T Mark3::PriorityMapL2< T, C >::m_uXPriorityMapL2
private

Definition at line 149 of file priomapl2.h.


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