RTEMS CPU Kit with SuperCore  4.11.3
Data Structures | Macros | Functions
Deterministic Priority Scheduler
Collaboration diagram for Deterministic Priority Scheduler:

Data Structures

struct  Scheduler_priority_Context
 
struct  Scheduler_priority_Ready_queue
 Data for ready queue operations. More...
 
struct  Scheduler_priority_Node
 Scheduler node specialization for Deterministic Priority schedulers. More...
 

Macros

#define SCHEDULER_PRIORITY_ENTRY_POINTS
 Entry points for the Deterministic Priority Based Scheduler. More...
 

Functions

void _Scheduler_priority_Initialize (const Scheduler_Control *scheduler)
 Initializes the priority scheduler. More...
 
void _Scheduler_priority_Block (const Scheduler_Control *scheduler, Thread_Control *the_thread)
 Removes the_thread from the scheduling decision. More...
 
void _Scheduler_priority_Schedule (const Scheduler_Control *scheduler, Thread_Control *the_thread)
 Sets the heir thread to be the next ready thread. More...
 
void _Scheduler_priority_Update_priority (const Scheduler_Control *scheduler, Thread_Control *the_thread, Priority_Control new_priority)
 Updates the scheduler node to reflect the new priority of the thread.
 
Scheduler_Void_or_thread _Scheduler_priority_Unblock (const Scheduler_Control *scheduler, Thread_Control *the_thread)
 Add the_thread to the scheduling decision. More...
 
Scheduler_Void_or_thread _Scheduler_priority_Change_priority (const Scheduler_Control *scheduler, Thread_Control *the_thread, Priority_Control new_priority, bool prepend_it)
 
Scheduler_Void_or_thread _Scheduler_priority_Yield (const Scheduler_Control *scheduler, Thread_Control *the_thread)
 The specified THREAD yields. More...
 
int _Scheduler_priority_Priority_compare (Priority_Control p1, Priority_Control p2)
 Compare two priorities. More...
 
RTEMS_INLINE_ROUTINE Scheduler_priority_Context_Scheduler_priority_Get_context (const Scheduler_Control *scheduler)
 
RTEMS_INLINE_ROUTINE Scheduler_priority_Node_Scheduler_priority_Thread_get_node (Thread_Control *the_thread)
 
RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_initialize (Chain_Control *ready_queues)
 Ready queue initialization. More...
 
RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_enqueue (Chain_Node *node, Scheduler_priority_Ready_queue *ready_queue, Priority_bit_map_Control *bit_map)
 Enqueues a node on the specified ready queue. More...
 
RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_enqueue_first (Chain_Node *node, Scheduler_priority_Ready_queue *ready_queue, Priority_bit_map_Control *bit_map)
 Enqueues a node on the specified ready queue as first. More...
 
RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_extract (Chain_Node *node, Scheduler_priority_Ready_queue *ready_queue, Priority_bit_map_Control *bit_map)
 Extracts a node from the specified ready queue. More...
 
RTEMS_INLINE_ROUTINE void _Scheduler_priority_Extract_body (const Scheduler_Control *scheduler, Thread_Control *the_thread)
 
RTEMS_INLINE_ROUTINE Chain_Node_Scheduler_priority_Ready_queue_first (Priority_bit_map_Control *bit_map, Chain_Control *ready_queues)
 Return a pointer to the first node. More...
 
RTEMS_INLINE_ROUTINE void _Scheduler_priority_Schedule_body (const Scheduler_Control *scheduler, Thread_Control *the_thread, bool force_dispatch)
 Scheduling decision logic. More...
 
RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_update (Scheduler_priority_Ready_queue *ready_queue, Priority_Control new_priority, Priority_bit_map_Control *bit_map, Chain_Control *ready_queues)
 Updates the specified ready queue data according to the new priority value. More...
 
RTEMS_INLINE_ROUTINE int _Scheduler_priority_Priority_compare_body (Priority_Control p1, Priority_Control p2)
 Priority comparison. More...
 

Detailed Description

Macro Definition Documentation

◆ SCHEDULER_PRIORITY_ENTRY_POINTS

#define SCHEDULER_PRIORITY_ENTRY_POINTS
Value:
{ \
_Scheduler_priority_Initialize, /* initialize entry point */ \
_Scheduler_priority_Schedule, /* schedule entry point */ \
_Scheduler_priority_Yield, /* yield entry point */ \
_Scheduler_priority_Block, /* block entry point */ \
_Scheduler_priority_Unblock, /* unblock entry point */ \
_Scheduler_priority_Change_priority, /* change priority entry point */ \
_Scheduler_default_Node_initialize, /* node initialize entry point */ \
_Scheduler_default_Node_destroy, /* node destroy entry point */ \
_Scheduler_priority_Update_priority, /* update priority entry point */ \
_Scheduler_priority_Priority_compare, /* compares two priorities */ \
_Scheduler_default_Release_job, /* new 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_default_Node_initialize(const Scheduler_Control *scheduler, Thread_Control *the_thread)
Does nothing.
Definition: schedulerdefaultnodeinit.c:24

Entry points for the Deterministic Priority Based Scheduler.

Function Documentation

◆ _Scheduler_priority_Block()

void _Scheduler_priority_Block ( const Scheduler_Control scheduler,
Thread_Control the_thread 
)

Removes the_thread from the scheduling decision.

This routine removes the_thread from the scheduling decision, that is, removes it from the ready queue. It performs any necessary scheduling operations including the selection of a new heir thread.

Parameters
[in]schedulerThe scheduler instance.
[in]the_threadis the thread to be blocked

◆ _Scheduler_priority_Initialize()

void _Scheduler_priority_Initialize ( const Scheduler_Control scheduler)

Initializes the priority scheduler.

This routine initializes the priority scheduler.

◆ _Scheduler_priority_Priority_compare()

int _Scheduler_priority_Priority_compare ( Priority_Control  p1,
Priority_Control  p2 
)

Compare two priorities.

This routine compares two priorities.

Return values
>0for p1 > p2; 0 for p1 == p2; <0 for p1 < p2.

References _Scheduler_priority_Priority_compare_body().

◆ _Scheduler_priority_Priority_compare_body()

RTEMS_INLINE_ROUTINE int _Scheduler_priority_Priority_compare_body ( Priority_Control  p1,
Priority_Control  p2 
)

Priority comparison.

This routine implements priority comparison for priority-based scheduling.

Returns
>0 for higher priority, 0 for equal and <0 for lower priority.

Referenced by _Scheduler_priority_Priority_compare().

◆ _Scheduler_priority_Ready_queue_enqueue()

RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_enqueue ( Chain_Node node,
Scheduler_priority_Ready_queue ready_queue,
Priority_bit_map_Control bit_map 
)

Enqueues a node on the specified ready queue.

The node is placed as the last element of its priority group.

Parameters
[in]nodeThe node to enqueue.
[in]ready_queueThe ready queue.
[in]bit_mapThe priority bit map of the scheduler instance.

References _Chain_Append_unprotected(), _Priority_bit_map_Add(), Scheduler_priority_Ready_queue::Priority_map, and Scheduler_priority_Ready_queue::ready_chain.

◆ _Scheduler_priority_Ready_queue_enqueue_first()

RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_enqueue_first ( Chain_Node node,
Scheduler_priority_Ready_queue ready_queue,
Priority_bit_map_Control bit_map 
)

Enqueues a node on the specified ready queue as first.

The node is placed as the first element of its priority group.

Parameters
[in]nodeThe node to enqueue as first.
[in]ready_queueThe ready queue.
[in]bit_mapThe priority bit map of the scheduler instance.

References _Chain_Prepend_unprotected(), _Priority_bit_map_Add(), Scheduler_priority_Ready_queue::Priority_map, and Scheduler_priority_Ready_queue::ready_chain.

◆ _Scheduler_priority_Ready_queue_extract()

RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_extract ( Chain_Node node,
Scheduler_priority_Ready_queue ready_queue,
Priority_bit_map_Control bit_map 
)

Extracts a node from the specified ready queue.

Parameters
[in]nodeThe node to extract.
[in]ready_queueThe ready queue.
[in]bit_mapThe priority bit map of the scheduler instance.

References _Chain_Has_only_one_node(), _Chain_Initialize_empty(), and Scheduler_priority_Ready_queue::ready_chain.

◆ _Scheduler_priority_Ready_queue_first()

RTEMS_INLINE_ROUTINE Chain_Node* _Scheduler_priority_Ready_queue_first ( Priority_bit_map_Control bit_map,
Chain_Control ready_queues 
)

Return a pointer to the first node.

This routines returns a pointer to the first node on ready_queues.

Parameters
[in]bit_mapThe priority bit map of the scheduler instance.
[in]ready_queuesThe ready queues of the scheduler instance.
Returns
This method returns the first node.

◆ _Scheduler_priority_Ready_queue_initialize()

RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_initialize ( Chain_Control ready_queues)

Ready queue initialization.

This routine initializes ready_queues for priority-based scheduling.

◆ _Scheduler_priority_Ready_queue_update()

RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_update ( Scheduler_priority_Ready_queue ready_queue,
Priority_Control  new_priority,
Priority_bit_map_Control bit_map,
Chain_Control ready_queues 
)

Updates the specified ready queue data according to the new priority value.

Parameters
[in]ready_queueThe ready queue.
[in]new_priorityThe new priority.
[in]bit_mapThe priority bit map of the scheduler instance.
[in]ready_queuesThe ready queues of the scheduler instance.

References Scheduler_priority_Ready_queue::ready_chain.

◆ _Scheduler_priority_Schedule()

void _Scheduler_priority_Schedule ( const Scheduler_Control scheduler,
Thread_Control the_thread 
)

Sets the heir thread to be the next ready thread.

This kernel routine sets the heir thread to be the next ready thread by invoking the_scheduler->ready_queue->operations->first().

References _Scheduler_priority_Schedule_body().

◆ _Scheduler_priority_Schedule_body()

RTEMS_INLINE_ROUTINE void _Scheduler_priority_Schedule_body ( const Scheduler_Control scheduler,
Thread_Control the_thread,
bool  force_dispatch 
)

Scheduling decision logic.

This kernel routine implements scheduling decision logic for priority-based scheduling.

Referenced by _Scheduler_priority_Schedule().

◆ _Scheduler_priority_Unblock()

Scheduler_Void_or_thread _Scheduler_priority_Unblock ( const Scheduler_Control scheduler,
Thread_Control the_thread 
)

Add the_thread to the scheduling decision.

This routine adds the_thread to the scheduling decision, that is, adds it to the ready queue and updates any appropriate scheduling variables, for example the heir thread.

Parameters
[in]schedulerThe scheduler instance.
[in]the_threadwill be unblocked

◆ _Scheduler_priority_Yield()

Scheduler_Void_or_thread _Scheduler_priority_Yield ( const Scheduler_Control scheduler,
Thread_Control the_thread 
)

The specified THREAD yields.

This routine is invoked when a thread wishes to voluntarily transfer control of the processor to another thread in the queue.

This routine will remove the specified THREAD from the ready queue and place it immediately at the rear of this chain. Reset timeslice and yield the processor functions both use this routine, therefore if reset is true and this is the only thread on the queue then the timeslice counter is reset. The heir THREAD will be updated if the running is also the currently the heir.

  • INTERRUPT LATENCY:
    • ready chain
    • select heir
Parameters
[in]schedulerThe scheduler instance.
[in,out]the_threadThe yielding thread.