RTEMS: Simple Priority SMP Scheduler

| RTEMS 5.4-rc2

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

Simple Priority SMP Scheduler. More...

## Files
file | schedulersimplesmp.h
| Simple SMP Scheduler API.
file | schedulersimplesmp.c
| Simple SMP Scheduler Implementation.

## Data Structures
struct | Scheduler_simple_SMP_Context

## Macros
#define | SCHEDULER_SIMPLE_SMP_MAXIMUM_PRIORITY 255
#define | SCHEDULER_SIMPLE_SMP_ENTRY_POINTS
| Entry points for the Simple SMP Scheduler.

## Functions
void | _Scheduler_simple_SMP_Initialize (const Scheduler_Control *scheduler)
| Initializes the scheduler's context.
void | _Scheduler_simple_SMP_Node_initialize (const Scheduler_Control *scheduler, Scheduler_Node *node, Thread_Control *the_thread, Priority_Control priority)
| Initializes the node with the given attributes.
void | _Scheduler_simple_SMP_Block (const Scheduler_Control *scheduler, Thread_Control *thread, Scheduler_Node *node)
| Blocks a thread.
void | _Scheduler_simple_SMP_Unblock (const Scheduler_Control *scheduler, Thread_Control *thread, Scheduler_Node *node)
| Unblocks a thread.
void | _Scheduler_simple_SMP_Update_priority (const Scheduler_Control *scheduler, Thread_Control *the_thread, Scheduler_Node *node)
| Updates the priority of the node.
bool | _Scheduler_simple_SMP_Ask_for_help (const Scheduler_Control *scheduler, Thread_Control *the_thread, Scheduler_Node *node)
| Asks for help.
void | _Scheduler_simple_SMP_Reconsider_help_request (const Scheduler_Control *scheduler, Thread_Control *the_thread, Scheduler_Node *node)
| Reconsiders help.
void | _Scheduler_simple_SMP_Withdraw_node (const Scheduler_Control *scheduler, Thread_Control *the_thread, Scheduler_Node *node, Thread_Scheduler_state next_state)
| Withdraws node.
void | _Scheduler_simple_SMP_Add_processor (const Scheduler_Control *scheduler, Thread_Control *idle)
| Adds idle to scheduler.
Thread_Control * | _Scheduler_simple_SMP_Remove_processor (const Scheduler_Control *scheduler, struct Per_CPU_Control *cpu)
| Removes an idle thread from the given cpu.
void | _Scheduler_simple_SMP_Yield (const Scheduler_Control *scheduler, Thread_Control *thread, Scheduler_Node *node)

## Detailed Description

Simple Priority SMP Scheduler.

The Simple Priority SMP Scheduler allocates a processor for the processor count highest priority ready threads. The thread priority and position in the ready chain are the only information to determine the scheduling decision. Threads with an allocated processor are in the scheduled chain. After initialization the scheduled chain has exactly processor count nodes. Each processor has exactly one allocated thread after initialization. All enqueue and extract operations may exchange threads with the scheduled chain. One thread will be added and another will be removed. The scheduled and ready chain is ordered according to the thread priority order. The chain insert operations are O(count of ready threads), thus this scheduler is unsuitable for most real-time applications.

The thread preempt mode will be ignored.

## Macro Definition Documentation

## ◆ SCHEDULER_SIMPLE_SMP_ENTRY_POINTS

#define SCHEDULER_SIMPLE_SMP_ENTRY_POINTS

Value:
{ \
_Scheduler_simple_SMP_Initialize, \
_Scheduler_default_Schedule, \
_Scheduler_simple_SMP_Yield, \
_Scheduler_simple_SMP_Block, \
_Scheduler_simple_SMP_Unblock, \
_Scheduler_simple_SMP_Update_priority, \
_Scheduler_default_Map_priority, \
_Scheduler_default_Unmap_priority, \
_Scheduler_simple_SMP_Ask_for_help, \
_Scheduler_simple_SMP_Reconsider_help_request, \
_Scheduler_simple_SMP_Withdraw_node, \
_Scheduler_default_Pin_or_unpin, \
_Scheduler_default_Pin_or_unpin, \
_Scheduler_simple_SMP_Add_processor, \
_Scheduler_simple_SMP_Remove_processor, \
_Scheduler_simple_SMP_Node_initialize, \
_Scheduler_default_Node_destroy, \
_Scheduler_default_Release_job, \
_Scheduler_default_Cancel_job, \
_Scheduler_default_Tick, \
_Scheduler_SMP_Start_idle \
SCHEDULER_OPERATION_DEFAULT_GET_SET_AFFINITY \
}
_Scheduler_simple_SMP_Node_initialize
void _Scheduler_simple_SMP_Node_initialize(const Scheduler_Control *scheduler, Scheduler_Node *node, Thread_Control *the_thread, Priority_Control priority)
Initializes the node with the given attributes.
Definition: schedulersimplesmp.c:45
_Scheduler_simple_SMP_Ask_for_help
bool _Scheduler_simple_SMP_Ask_for_help(const Scheduler_Control *scheduler, Thread_Control *the_thread, Scheduler_Node *node)
Asks for help.
Definition: schedulersimplesmp.c:280
_Scheduler_simple_SMP_Yield
void _Scheduler_simple_SMP_Yield(const Scheduler_Control *scheduler, Thread_Control *thread, Scheduler_Node *node)
Definition: schedulersimplesmp.c:359
_Scheduler_simple_SMP_Block
void _Scheduler_simple_SMP_Block(const Scheduler_Control *scheduler, Thread_Control *thread, Scheduler_Node *node)
Blocks a thread.
Definition: schedulersimplesmp.c:165
_Scheduler_simple_SMP_Remove_processor
Thread_Control * _Scheduler_simple_SMP_Remove_processor(const Scheduler_Control *scheduler, struct Per_CPU_Control *cpu)
Removes an idle thread from the given cpu.
Definition: schedulersimplesmp.c:344
_Scheduler_simple_SMP_Reconsider_help_request
void _Scheduler_simple_SMP_Reconsider_help_request(const Scheduler_Control *scheduler, Thread_Control *the_thread, Scheduler_Node *node)
Reconsiders help.
Definition: schedulersimplesmp.c:291
_Scheduler_simple_SMP_Withdraw_node
void _Scheduler_simple_SMP_Withdraw_node(const Scheduler_Control *scheduler, Thread_Control *the_thread, Scheduler_Node *node, Thread_Scheduler_state next_state)
Withdraws node.
Definition: schedulersimplesmp.c:307
_Scheduler_simple_SMP_Unblock
void _Scheduler_simple_SMP_Unblock(const Scheduler_Control *scheduler, Thread_Control *thread, Scheduler_Node *node)
Unblocks a thread.
Definition: schedulersimplesmp.c:224
_Scheduler_simple_SMP_Update_priority
void _Scheduler_simple_SMP_Update_priority(const Scheduler_Control *scheduler, Thread_Control *the_thread, Scheduler_Node *node)
Updates the priority of the node.
Definition: schedulersimplesmp.c:260
_Scheduler_simple_SMP_Initialize
void _Scheduler_simple_SMP_Initialize(const Scheduler_Control *scheduler)
Initializes the scheduler's context.
Definition: schedulersimplesmp.c:36
_Scheduler_simple_SMP_Add_processor
void _Scheduler_simple_SMP_Add_processor(const Scheduler_Control *scheduler, Thread_Control *idle)
Adds idle to scheduler.
Definition: schedulersimplesmp.c:328
_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_Release_job
void _Scheduler_default_Release_job(const Scheduler_Control *scheduler, Thread_Control *the_thread, Priority_Node *priority_node, uint64_t deadline, Thread_queue_Context *queue_context)
Does nothing.
Definition: schedulerdefaultreleasejob.c:24
_Scheduler_default_Node_destroy
void _Scheduler_default_Node_destroy(const Scheduler_Control *scheduler, Scheduler_Node *node)
Does nothing.
Definition: schedulerdefaultnodedestroy.c:24
_Scheduler_default_Map_priority
Priority_Control _Scheduler_default_Map_priority(const Scheduler_Control *scheduler, Priority_Control priority)
Returns the scheduler internal thread priority mapped by SCHEDULER_PRIORITY_MAP().
Definition: schedulerdefaultmappriority.c:15
_Scheduler_default_Schedule
void _Scheduler_default_Schedule(const Scheduler_Control *scheduler, Thread_Control *the_thread)
Does nothing.
Definition: schedulerdefaultschedule.c:15
_Scheduler_default_Unmap_priority
Priority_Control _Scheduler_default_Unmap_priority(const Scheduler_Control *scheduler, Priority_Control priority)
Returns the user visible thread priority unmapped by SCHEDULER_PRIORITY_UNMAP().
Definition: schedulerdefaultmappriority.c:23
_Scheduler_default_Cancel_job
void _Scheduler_default_Cancel_job(const Scheduler_Control *scheduler, Thread_Control *the_thread, Priority_Node *priority_node, Thread_queue_Context *queue_context)
Does nothing.
Definition: schedulerdefaultreleasejob.c:39

Entry points for the Simple SMP Scheduler.

## Function Documentation

## ◆ _Scheduler_simple_SMP_Add_processor()

void _Scheduler_simple_SMP_Add_processor | ( | const Scheduler_Control * | scheduler,
|  | Thread_Control * | idle
| ) |  |

Adds idle to scheduler.

Parameters

  [in,out] | scheduler | The scheduler instance to add the processor to.
  | idle | The idle thread control.

## ◆ _Scheduler_simple_SMP_Ask_for_help()

bool _Scheduler_simple_SMP_Ask_for_help | ( | const Scheduler_Control * | scheduler,
|  | Thread_Control * | the_thread,
|  | Scheduler_Node * | node
| ) |  |

Asks for help.

Parameters

  scheduler | The scheduler instance to ask for help.
  the_thread | The thread needing help.
  node | The scheduler node.

Return values

  true | Ask for help was successful.
  false | Ask for help was not successful.

## ◆ _Scheduler_simple_SMP_Block()

void _Scheduler_simple_SMP_Block | ( | const Scheduler_Control * | scheduler,
|  | Thread_Control * | thread,
|  | Scheduler_Node * | node
| ) |  |

Blocks a thread.

Parameters

  | scheduler | The scheduler instance.
  [in,out] | thread | The thread to block.
  [in,out] | node | The scheduler node of thread.

## ◆ _Scheduler_simple_SMP_Initialize()

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

Initializes the scheduler's context.

Parameters

  scheduler | The scheduler instance to initialize the context of.

## ◆ _Scheduler_simple_SMP_Node_initialize()

void _Scheduler_simple_SMP_Node_initialize | ( | const Scheduler_Control * | scheduler,
|  | Scheduler_Node * | node,
|  | Thread_Control * | the_thread,
|  | Priority_Control | priority
| ) |  |

Initializes the node with the given attributes.

Parameters

  | scheduler | The scheduler instance.
  [out] | node | The node to initialize.
  | the_thread | The user of the node, if RTEMS_SMP is defined.
  | priority | The priority of the node to initialize.

## ◆ _Scheduler_simple_SMP_Reconsider_help_request()

void _Scheduler_simple_SMP_Reconsider_help_request | ( | const Scheduler_Control * | scheduler,
|  | Thread_Control * | the_thread,
|  | Scheduler_Node * | node
| ) |  |

Reconsiders help.

Parameters

  scheduler | The scheduler instance to reconsider the help request.
  the_thread | The thread reconsidering a help request.
  node | The scheduler node.

## ◆ _Scheduler_simple_SMP_Remove_processor()

Thread_Control * _Scheduler_simple_SMP_Remove_processor | ( | const Scheduler_Control * | scheduler,
|  | struct Per_CPU_Control * | cpu
| ) |  |

Removes an idle thread from the given cpu.

Parameters

  scheduler | The scheduler instance.
  cpu | The cpu control to remove from scheduler.

Returns
  The idle thread of the processor.

## ◆ _Scheduler_simple_SMP_Unblock()

void _Scheduler_simple_SMP_Unblock | ( | const Scheduler_Control * | scheduler,
|  | Thread_Control * | thread,
|  | Scheduler_Node * | node
| ) |  |

Unblocks a thread.

Parameters

  | scheduler | The scheduler instance.
  [in,out] | thread | The thread to unblock.
  [in,out] | node | The scheduler node of thread.

## ◆ _Scheduler_simple_SMP_Update_priority()

void _Scheduler_simple_SMP_Update_priority | ( | const Scheduler_Control * | scheduler,
|  | Thread_Control * | the_thread,
|  | Scheduler_Node * | node
| ) |  |

Updates the priority of the node.

Parameters

  scheduler | The scheduler instance.
  the_thread | The thread of node.
  node | The node to update the priority of.

## ◆ _Scheduler_simple_SMP_Withdraw_node()

void _Scheduler_simple_SMP_Withdraw_node | ( | const Scheduler_Control * | scheduler,
|  | Thread_Control * | the_thread,
|  | Scheduler_Node * | node,
|  | Thread_Scheduler_state | next_state
| ) |  |

Withdraws node.

Parameters

  scheduler | The scheduler instance to withdraw the node.
  the_thread | The thread using the node.
  node | The scheduler node to withdraw.
  next_state | The next thread scheduler state in the case the node is scheduled.

## ◆ _Scheduler_simple_SMP_Yield()

void _Scheduler_simple_SMP_Yield | ( | const Scheduler_Control * | scheduler,
|  | Thread_Control * | thread,
|  | Scheduler_Node * | node
| ) |  |

Performs a yield operation for the thread.

Parameters

  | scheduler | The scheduler instance.
  | thread | The thread to yield.
  [in,out] | node | The node of the thread to perform a yield.