RTEMS
Files | Classes | Macros | Functions

EDF Scheduler. More...

Files

file  scheduleredf.h
 Data Related to the Manipulation of Threads for the EDF Scheduler.
 
file  scheduleredfimpl.h
 EDF Scheduler Implementation.
 

Classes

struct  Scheduler_EDF_Context
 
struct  Scheduler_EDF_Node
 Scheduler node specialization for EDF schedulers. More...
 

Macros

#define SCHEDULER_EDF_MAXIMUM_PRIORITY   INT_MAX
 
#define SCHEDULER_EDF_ENTRY_POINTS
 
#define SCHEDULER_EDF_PRIO_MSB   0x8000000000000000
 

Functions

void _Scheduler_EDF_Initialize (const Scheduler_Control *scheduler)
 Initializes EDF scheduler. More...
 
void _Scheduler_EDF_Block (const Scheduler_Control *scheduler, Thread_Control *the_thread, Scheduler_Node *node)
 Removes the blocking thread from the ready queue and schedules is only again if the thread is executing or the heir thread. More...
 
void _Scheduler_EDF_Schedule (const Scheduler_Control *scheduler, Thread_Control *the_thread)
 Sets the heir thread to be the next ready thread in the rbtree ready queue. More...
 
void _Scheduler_EDF_Node_initialize (const Scheduler_Control *scheduler, Scheduler_Node *node, Thread_Control *the_thread, Priority_Control priority)
 Initializes an EDF specific scheduler node of the_thread. More...
 
void _Scheduler_EDF_Unblock (const Scheduler_Control *scheduler, Thread_Control *the_thread, Scheduler_Node *node)
 Performs an unblocking of the thread. More...
 
void _Scheduler_EDF_Update_priority (const Scheduler_Control *scheduler, Thread_Control *the_thread, Scheduler_Node *node)
 Updates the priority of the scheduler node. More...
 
Priority_Control _Scheduler_EDF_Map_priority (const Scheduler_Control *scheduler, Priority_Control priority)
 Gets the mapped priority map of the priority control. More...
 
Priority_Control _Scheduler_EDF_Unmap_priority (const Scheduler_Control *scheduler, Priority_Control priority)
 Gets the unmapped priority map of the priority control. More...
 
void _Scheduler_EDF_Yield (const Scheduler_Control *scheduler, Thread_Control *the_thread, Scheduler_Node *node)
 Executes a thread yield for the thread. More...
 
void _Scheduler_EDF_Release_job (const Scheduler_Control *scheduler, Thread_Control *the_thread, Priority_Node *priority_node, uint64_t deadline, Thread_queue_Context *queue_context)
 Releases a EDF job. More...
 
void _Scheduler_EDF_Cancel_job (const Scheduler_Control *scheduler, Thread_Control *the_thread, Priority_Node *priority_node, Thread_queue_Context *queue_context)
 Cancels a job and removes the thread from the queue context. More...
 
static __inline__ Scheduler_EDF_Context_Scheduler_EDF_Get_context (const Scheduler_Control *scheduler)
 Gets the context of the scheduler. More...
 
static __inline__ Scheduler_EDF_Node_Scheduler_EDF_Thread_get_node (Thread_Control *the_thread)
 Gets the scheduler EDF node of the thread. More...
 
static __inline__ Scheduler_EDF_Node_Scheduler_EDF_Node_downcast (Scheduler_Node *node)
 Returns the scheduler EDF node for the scheduler node. More...
 
static __inline__ bool _Scheduler_EDF_Less (const void *left, const RBTree_Node *right)
 Checks if left is less than the priority of the node right. More...
 
static __inline__ bool _Scheduler_EDF_Priority_less_equal (const void *left, const RBTree_Node *right)
 Checks if left is less or equal than the priority of the node right. More...
 
static __inline__ void _Scheduler_EDF_Enqueue (Scheduler_EDF_Context *context, Scheduler_EDF_Node *node, Priority_Control insert_priority)
 Inserts the scheduler node with the given priority in the ready queue of the context. More...
 
static __inline__ void _Scheduler_EDF_Extract (Scheduler_EDF_Context *context, Scheduler_EDF_Node *node)
 Extracts the scheduler node from the ready queue of the context. More...
 
static __inline__ void _Scheduler_EDF_Extract_body (const Scheduler_Control *scheduler, Thread_Control *the_thread, Scheduler_Node *node)
 Extracts the node from the context of the given scheduler. More...
 
static __inline__ void _Scheduler_EDF_Schedule_body (const Scheduler_Control *scheduler, Thread_Control *the_thread, bool force_dispatch)
 Schedules the next ready thread as the heir. More...
 

Detailed Description

EDF Scheduler.

Macro Definition Documentation

◆ SCHEDULER_EDF_ENTRY_POINTS

#define SCHEDULER_EDF_ENTRY_POINTS
Value:
{ \
_Scheduler_EDF_Initialize, /* initialize entry point */ \
_Scheduler_EDF_Schedule, /* schedule entry point */ \
_Scheduler_EDF_Yield, /* yield entry point */ \
_Scheduler_EDF_Block, /* block entry point */ \
_Scheduler_EDF_Unblock, /* unblock entry point */ \
_Scheduler_EDF_Update_priority, /* update priority entry point */ \
_Scheduler_EDF_Map_priority, /* map priority entry point */ \
_Scheduler_EDF_Unmap_priority, /* unmap priority entry point */ \
_Scheduler_EDF_Node_initialize, /* node initialize entry point */ \
_Scheduler_default_Node_destroy, /* node destroy entry point */ \
_Scheduler_EDF_Release_job, /* new period of task */ \
_Scheduler_EDF_Cancel_job, /* cancel period of task */ \
_Scheduler_default_Tick, /* tick entry point */ \
_Scheduler_default_Start_idle /* start idle entry point */ \
SCHEDULER_OPERATION_DEFAULT_GET_SET_AFFINITY \
}
void _Scheduler_EDF_Node_initialize(const Scheduler_Control *scheduler, Scheduler_Node *node, Thread_Control *the_thread, Priority_Control priority)
Initializes an EDF specific scheduler node of the_thread.

Entry points for the Earliest Deadline First Scheduler.

Definition at line 55 of file scheduleredf.h.

◆ SCHEDULER_EDF_PRIO_MSB

#define SCHEDULER_EDF_PRIO_MSB   0x8000000000000000

This is just a most significant bit of Priority_Control type. It distinguishes threads which are deadline driven (priority represented by a lower number than SCHEDULER_EDF_PRIO_MSB) from those ones who do not have any deadlines and thus are considered background tasks.

Definition at line 41 of file scheduleredfimpl.h.

Function Documentation

◆ _Scheduler_EDF_Block()

void _Scheduler_EDF_Block ( const Scheduler_Control scheduler,
Thread_Control the_thread,
Scheduler_Node node 
)

Removes the blocking thread from the ready queue and schedules is only again if the thread is executing or the heir thread.

Parameters
[in,out]schedulerThe scheduler for the operation.
the_threadThe thread to operate upon.
[in,out]nodeThe scheduler node for this thread.

◆ _Scheduler_EDF_Cancel_job()

void _Scheduler_EDF_Cancel_job ( const Scheduler_Control scheduler,
Thread_Control the_thread,
Priority_Node priority_node,
Thread_queue_Context queue_context 
)

Cancels a job and removes the thread from the queue context.

Parameters
schedulerThe scheduler instance.
the_threadThe thread for the operation.
[in,out]priority_nodeThe corresponding priority node.
[in,out]queue_contextThe thread queue context.

Definition at line 77 of file scheduleredfreleasejob.c.

◆ _Scheduler_EDF_Enqueue()

static __inline__ void _Scheduler_EDF_Enqueue ( Scheduler_EDF_Context context,
Scheduler_EDF_Node node,
Priority_Control  insert_priority 
)
static

Inserts the scheduler node with the given priority in the ready queue of the context.

Parameters
[in,out]contextThe context to insert the node in.
nodeThe node to be inserted.
insert_priorityThe priority with which the node will be inserted.

Definition at line 148 of file scheduleredfimpl.h.

◆ _Scheduler_EDF_Extract()

static __inline__ void _Scheduler_EDF_Extract ( Scheduler_EDF_Context context,
Scheduler_EDF_Node node 
)
static

Extracts the scheduler node from the ready queue of the context.

Parameters
[in,out]contextThe context to extract the node from.
[in,out]nodeThe node to extract.

Definition at line 168 of file scheduleredfimpl.h.

◆ _Scheduler_EDF_Extract_body()

static __inline__ void _Scheduler_EDF_Extract_body ( const Scheduler_Control scheduler,
Thread_Control the_thread,
Scheduler_Node node 
)
static

Extracts the node from the context of the given scheduler.

Parameters
schedulerThe scheduler instance.
the_threadThe thread is not used in this method.
[in,out]nodeThe node to be extracted.

Definition at line 183 of file scheduleredfimpl.h.

◆ _Scheduler_EDF_Get_context()

static __inline__ Scheduler_EDF_Context* _Scheduler_EDF_Get_context ( const Scheduler_Control scheduler)
static

Gets the context of the scheduler.

Parameters
schedulerThe scheduler instance.
Returns
The scheduler context of scheduler.

Definition at line 51 of file scheduleredfimpl.h.

◆ _Scheduler_EDF_Initialize()

void _Scheduler_EDF_Initialize ( const Scheduler_Control scheduler)

Initializes EDF scheduler.

This routine initializes the EDF scheduler.

Parameters
[in,out]schedulerThe scheduler instance.

◆ _Scheduler_EDF_Less()

static __inline__ bool _Scheduler_EDF_Less ( const void *  left,
const RBTree_Node right 
)
static

Checks if left is less than the priority of the node right.

Parameters
leftThe priority on the left hand side of the comparison.
rightThe node of which the priority is compared to left.
Return values
trueleft is less than the priority of right.
falseleft is greater or equal than the priority of right.

Definition at line 93 of file scheduleredfimpl.h.

◆ _Scheduler_EDF_Map_priority()

Priority_Control _Scheduler_EDF_Map_priority ( const Scheduler_Control scheduler,
Priority_Control  priority 
)

Gets the mapped priority map of the priority control.

Parameters
schedulerNot used in this operation.
priorityThe priority control to get the priority map of.
Returns
The mapped priority map of priority.

Definition at line 24 of file scheduleredfreleasejob.c.

◆ _Scheduler_EDF_Node_downcast()

static __inline__ Scheduler_EDF_Node* _Scheduler_EDF_Node_downcast ( Scheduler_Node node)
static

Returns the scheduler EDF node for the scheduler node.

Parameters
nodeThe scheduler node of which the scheduler EDF node is returned.
Returns
The corresponding scheduler EDF node.

Definition at line 77 of file scheduleredfimpl.h.

◆ _Scheduler_EDF_Node_initialize()

void _Scheduler_EDF_Node_initialize ( const Scheduler_Control scheduler,
Scheduler_Node node,
Thread_Control the_thread,
Priority_Control  priority 
)

Initializes an EDF specific scheduler node of the_thread.

Parameters
schedulerThe scheduler instance.
nodeThe node being initialized.
the_threadThe thread of the node.
priorityThe thread priority.

◆ _Scheduler_EDF_Priority_less_equal()

static __inline__ bool _Scheduler_EDF_Priority_less_equal ( const void *  left,
const RBTree_Node right 
)
static

Checks if left is less or equal than the priority of the node right.

Parameters
leftThe priority on the left hand side of the comparison.
rightThe node of which the priority is compared to left.
Return values
trueleft is less or equal than the priority of right.
falseleft is greater than the priority of right.

Definition at line 121 of file scheduleredfimpl.h.

◆ _Scheduler_EDF_Release_job()

void _Scheduler_EDF_Release_job ( const Scheduler_Control scheduler,
Thread_Control the_thread,
Priority_Node priority_node,
uint64_t  deadline,
Thread_queue_Context queue_context 
)

Releases a EDF job.

Parameters
schedulerThe scheduler instance
the_threadThe thread
[in,out]priority_nodeThe priority node for the operation.
deadlineThe deadline for the job.
[in,out]queue_contextThe thread queue context.

Definition at line 40 of file scheduleredfreleasejob.c.

◆ _Scheduler_EDF_Schedule()

void _Scheduler_EDF_Schedule ( const Scheduler_Control scheduler,
Thread_Control the_thread 
)

Sets the heir thread to be the next ready thread in the rbtree ready queue.

This kernel routine sets the heir thread to be the next ready thread in the rbtree ready queue.

Parameters
[in,out]schedulerThe scheduler instance.
the_threadThe thread being scheduled.

◆ _Scheduler_EDF_Schedule_body()

static __inline__ void _Scheduler_EDF_Schedule_body ( const Scheduler_Control scheduler,
Thread_Control the_thread,
bool  force_dispatch 
)
static

Schedules the next ready thread as the heir.

Parameters
schedulerThe scheduler instance to schedule the minimum of the context of.
the_threadThis parameter is not used.
force_dispatchIndicates whether the current heir is blocked even if it is not set as preemptible.

Definition at line 206 of file scheduleredfimpl.h.

◆ _Scheduler_EDF_Thread_get_node()

static __inline__ Scheduler_EDF_Node* _Scheduler_EDF_Thread_get_node ( Thread_Control the_thread)
static

Gets the scheduler EDF node of the thread.

Parameters
the_threadThe thread to get the scheduler node of.
Returns
The EDF scheduler node of the_thread.

Definition at line 63 of file scheduleredfimpl.h.

◆ _Scheduler_EDF_Unblock()

void _Scheduler_EDF_Unblock ( const Scheduler_Control scheduler,
Thread_Control the_thread,
Scheduler_Node node 
)

Performs an unblocking of the thread.

Parameters
[in,out]schedulerThe scheduler instance.
the_threadThe unblocking thread. May be set as new heir.
[in,out]nodeThe scheduler node for the thread.

◆ _Scheduler_EDF_Unmap_priority()

Priority_Control _Scheduler_EDF_Unmap_priority ( const Scheduler_Control scheduler,
Priority_Control  priority 
)

Gets the unmapped priority map of the priority control.

Parameters
schedulerNot used in this operation.
priorityThe priority control to get the priority map of.
Returns
The unmapped priority map of priority.

Definition at line 32 of file scheduleredfreleasejob.c.

◆ _Scheduler_EDF_Update_priority()

void _Scheduler_EDF_Update_priority ( const Scheduler_Control scheduler,
Thread_Control the_thread,
Scheduler_Node node 
)

Updates the priority of the scheduler node.

Parameters
schedulerThe scheduler instance.
the_threadThe thread for the operation.
[in,out]nodeThe priority node to update the priority of.

◆ _Scheduler_EDF_Yield()

void _Scheduler_EDF_Yield ( const Scheduler_Control scheduler,
Thread_Control the_thread,
Scheduler_Node node 
)

Executes a thread yield for the thread.

Parameters
[in,out]schedulerThe scheduler instance.
the_threadThe thread that performs the yield.
[in,out]nodeThe scheduler node for this thread.