RTEMS: EDF Scheduler

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
Files | Data Structures | Macros | Functions
EDF Scheduler
Internal » SuperCore » Scheduler Handler

EDF Scheduler. More...

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

## Data Structures
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.
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.
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.
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.
void | _Scheduler_EDF_Unblock (const Scheduler_Control *scheduler, Thread_Control *the_thread, Scheduler_Node *node)
| Performs an unblocking of the thread.
void | _Scheduler_EDF_Update_priority (const Scheduler_Control *scheduler, Thread_Control *the_thread, Scheduler_Node *node)
| Updates the priority of the scheduler node.
Priority_Control | _Scheduler_EDF_Map_priority (const Scheduler_Control *scheduler, Priority_Control priority)
| Gets the mapped priority map of the priority control.
Priority_Control | _Scheduler_EDF_Unmap_priority (const Scheduler_Control *scheduler, Priority_Control priority)
| Gets the unmapped priority map of the priority control.
void | _Scheduler_EDF_Yield (const Scheduler_Control *scheduler, Thread_Control *the_thread, Scheduler_Node *node)
| Executes a thread yield for the thread.
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.
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.
RTEMS_INLINE_ROUTINE Scheduler_EDF_Context * | _Scheduler_EDF_Get_context (const Scheduler_Control *scheduler)
| Gets the context of the scheduler.
RTEMS_INLINE_ROUTINE Scheduler_EDF_Node * | _Scheduler_EDF_Thread_get_node (Thread_Control *the_thread)
| Gets the scheduler EDF node of the thread.
RTEMS_INLINE_ROUTINE Scheduler_EDF_Node * | _Scheduler_EDF_Node_downcast (Scheduler_Node *node)
| Returns the scheduler EDF node for the scheduler node.
RTEMS_INLINE_ROUTINE bool | _Scheduler_EDF_Less (const void *left, const RBTree_Node *right)
| Checks if left is less than the priority of the node right.
RTEMS_INLINE_ROUTINE 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.
RTEMS_INLINE_ROUTINE 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.
RTEMS_INLINE_ROUTINE void | _Scheduler_EDF_Extract (Scheduler_EDF_Context *context, Scheduler_EDF_Node *node)
| Extracts the scheduler node from the ready queue of the context.
RTEMS_INLINE_ROUTINE 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.
RTEMS_INLINE_ROUTINE void | _Scheduler_EDF_Schedule_body (const Scheduler_Control *scheduler, Thread_Control *the_thread, bool force_dispatch)
| Schedules the next ready thread as the heir.

## 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_OPERATION_DEFAULT_ASK_FOR_HELP \
_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 \
}
_Scheduler_EDF_Unblock
void _Scheduler_EDF_Unblock(const Scheduler_Control *scheduler, Thread_Control *the_thread, Scheduler_Node *node)
Performs an unblocking of the thread.
Definition: scheduleredfunblock.c:26
_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.
Definition: scheduleredfyield.c:24
_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.
Definition: scheduleredfreleasejob.c:77
_Scheduler_EDF_Initialize
void _Scheduler_EDF_Initialize(const Scheduler_Control *scheduler)
Initializes EDF scheduler.
Definition: scheduleredf.c:24
_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.
Definition: scheduleredfreleasejob.c:40
_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 executi...
Definition: scheduleredfblock.c:24
_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.
Definition: scheduleredfreleasejob.c:24
_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.
Definition: scheduleredfreleasejob.c:32
_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.
Definition: scheduleredfchangepriority.c:23
_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.
Definition: scheduleredfschedule.c:23
_Scheduler_default_Tick
void _Scheduler_default_Tick(const Scheduler_Control *scheduler, Thread_Control *executing)
Performs tick operations depending on the CPU budget algorithm for each executing thread.
Definition: schedulerdefaulttick.c:27
_Scheduler_default_Node_destroy
void _Scheduler_default_Node_destroy(const Scheduler_Control *scheduler, Scheduler_Node *node)
Does nothing.
Definition: schedulerdefaultnodedestroy.c:24
_Scheduler_default_Start_idle
void _Scheduler_default_Start_idle(const Scheduler_Control *scheduler, Thread_Control *the_thread, struct Per_CPU_Control *cpu)
Starts an idle thread.
Definition: schedulerdefaultstartidle.c:15

Entry points for the Earliest Deadline First Scheduler.

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

## 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] | scheduler | The scheduler for the operation.
  | the_thread | The thread to operate upon.
  [in,out] | node | The 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

  | scheduler | The scheduler instance.
  | the_thread | The thread for the operation.
  [in,out] | priority_node | The corresponding priority node.
  [in,out] | queue_context | The thread queue context.

## ◆ _Scheduler_EDF_Enqueue()

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

Parameters

  [in,out] | context | The context to insert the node in.
  | node | The node to be inserted.
  | insert_priority | The priority with which the node will be inserted.

## ◆ _Scheduler_EDF_Extract()

RTEMS_INLINE_ROUTINE void _Scheduler_EDF_Extract | ( | Scheduler_EDF_Context * | context,
|  | Scheduler_EDF_Node * | node
| ) |  |

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

Parameters

  [in,out] | context | The context to extract the node from.
  [in,out] | node | The node to extract.

## ◆ _Scheduler_EDF_Extract_body()

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

Parameters

  | scheduler | The scheduler instance.
  | the_thread | The thread is not used in this method.
  [in,out] | node | The node to be extracted.

## ◆ _Scheduler_EDF_Get_context()

RTEMS_INLINE_ROUTINE Scheduler_EDF_Context * _Scheduler_EDF_Get_context | ( | const Scheduler_Control * | scheduler | ) |

Gets the context of the scheduler.

Parameters

  scheduler | The scheduler instance.

Returns
  The scheduler context of scheduler.

## ◆ _Scheduler_EDF_Initialize()

void _Scheduler_EDF_Initialize | ( | const Scheduler_Control * | scheduler | ) |

Initializes EDF scheduler.

This routine initializes the EDF scheduler.

Parameters

  [in,out] | scheduler | The scheduler instance.

## ◆ _Scheduler_EDF_Less()

RTEMS_INLINE_ROUTINE bool _Scheduler_EDF_Less | ( | const void * | left,
|  | const RBTree_Node * | right
| ) |  |

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

Parameters

  left | The priority on the left hand side of the comparison.
  right | The node of which the priority is compared to left.

Return values

  true | left is less than the priority of right.
  false | left is greater or equal than the priority of right.

## ◆ _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

  scheduler | Not used in this operation.
  priority | The priority control to get the priority map of.

Returns
  The mapped priority map of priority.

## ◆ _Scheduler_EDF_Node_downcast()

RTEMS_INLINE_ROUTINE Scheduler_EDF_Node * _Scheduler_EDF_Node_downcast | ( | Scheduler_Node * | node | ) |

Returns the scheduler EDF node for the scheduler node.

Parameters

  node | The scheduler node of which the scheduler EDF node is returned.

Returns
  The corresponding scheduler EDF node.

## ◆ _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

  scheduler | The scheduler instance.
  node | The node being initialized.
  the_thread | The thread of the node.
  priority | The thread priority.

## ◆ _Scheduler_EDF_Priority_less_equal()

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

Parameters

  left | The priority on the left hand side of the comparison.
  right | The node of which the priority is compared to left.

Return values

  true | left is less or equal than the priority of right.
  false | left is greater than the priority of right.

## ◆ _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

  | scheduler | The scheduler instance
  | the_thread | The thread
  [in,out] | priority_node | The priority node for the operation.
  | deadline | The deadline for the job.
  [in,out] | queue_context | The thread queue context.

## ◆ _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] | scheduler | The scheduler instance.
  | the_thread | The thread being scheduled.

## ◆ _Scheduler_EDF_Schedule_body()

RTEMS_INLINE_ROUTINE void _Scheduler_EDF_Schedule_body | ( | const Scheduler_Control * | scheduler,
|  | Thread_Control * | the_thread,
|  | bool | force_dispatch
| ) |  |

Schedules the next ready thread as the heir.

Parameters

  scheduler | The scheduler instance to schedule the minimum of the context of.
  the_thread | This parameter is not used.
  force_dispatch | Indicates whether the current heir is blocked even if it is not set as preemptible.

## ◆ _Scheduler_EDF_Thread_get_node()

RTEMS_INLINE_ROUTINE Scheduler_EDF_Node * _Scheduler_EDF_Thread_get_node | ( | Thread_Control * | the_thread | ) |

Gets the scheduler EDF node of the thread.

Parameters

  the_thread | The thread to get the scheduler node of.

Returns
  The EDF scheduler node of the_thread.

## ◆ _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] | scheduler | The scheduler instance.
  | the_thread | The unblocking thread. May be set as new heir.
  [in,out] | node | The 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

  scheduler | Not used in this operation.
  priority | The priority control to get the priority map of.

Returns
  The unmapped priority map of priority.

## ◆ _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

  | scheduler | The scheduler instance.
  | the_thread | The thread for the operation.
  [in,out] | node | The 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] | scheduler | The scheduler instance.
  | the_thread | The thread that performs the yield.
  [in,out] | node | The scheduler node for this thread.