RTEMS 6.1-rc2
Loading...
Searching...
No Matches
Modules | Files | Data Structures | Macros | Typedefs | Functions | Variables
Scheduler Handler

This group contains the Scheduler Handler implementation. More...

Modules

 Constant Bandwidth Server (CBS) Scheduler
 This group contains the Constant Bandwidth Server (CBS) Scheduler implementation.
 
 Deterministic Priority Scheduler
 This group contains the Deterministic Priority Scheduler implementation.
 
 EDF Scheduler
 This group contains the EDF Scheduler implementation.
 
 SMP Scheduler
 This group contains the SMP Scheduler implementation.
 
 Simple Priority Scheduler
 This group contains the Simple Priority Scheduler implementation.
 

Files

file  scheduler.h
 This header file provides interfaces of the Scheduler Handler which are used by the implementation and the Application Configuration.
 
file  schedulerimpl.h
 This header file provides interfaces of the Scheduler Handler which are only used by the implementation.
 
file  schedulernode.h
 This header file provides interfaces of the Scheduler Handler related to scheduler nodes which are used by the implementation and the Application Configuration.
 
file  schedulernodeimpl.h
 This header file provides interfaces of the Scheduler Handler related to scheduler nodes which are only used by the implementation.
 
file  scheduleruniimpl.h
 This header file provides interfaces of the supporting the implementation of uniprocessor schedulers.
 
file  sched.c
 This source file contains the implementation of _Sched_Count(), _Sched_Index(), _Sched_Name_to_index(), and _Sched_Processor_count().
 
file  scheduler.c
 This source file contains the implementation of _Scheduler_Handler_initialization().
 
file  schedulerdefaultmakecleansticky.c
 This source file contains the implementation of _Scheduler_default_Sticky_do_nothing().
 
file  schedulerdefaultmappriority.c
 This source file contains the implementation of _Scheduler_default_Map_priority() and _Scheduler_default_Unmap_priority().
 
file  schedulerdefaultnodedestroy.c
 This source file contains the implementation of _Scheduler_default_Node_destroy().
 
file  schedulerdefaultnodeinit.c
 This source file contains the implementation of _Scheduler_default_Node_initialize().
 
file  schedulerdefaultpinunpin.c
 This source file contains the implementation of _Scheduler_default_Pin_or_unpin_not_supported().
 
file  schedulerdefaultpinunpindonothing.c
 This source file contains the implementation of _Scheduler_default_Pin_or_unpin_do_nothing().
 
file  schedulerdefaultreleasejob.c
 This source file contains the implementation of _Scheduler_default_Release_job() and _Scheduler_default_Cancel_job().
 
file  schedulerdefaultschedule.c
 This source file contains the implementation of _Scheduler_default_Schedule().
 
file  schedulerdefaultsetaffinity.c
 This source file contains the implementation of _Scheduler_default_Set_affinity().
 
file  schedulerdefaultstartidle.c
 This source file contains the implementation of _Scheduler_default_Start_idle().
 
file  schedulergetaffinity.c
 This source file contains the implementation of _Scheduler_Get_affinity().
 
file  schedulersetaffinity.c
 This source file contains the implementation of _Scheduler_Set_affinity().
 
file  schedulersmp.c
 This source file contains the implementation of _Scheduler_Request_ask_for_help().
 
file  schedulersmpstartidle.c
 This source file contains the implementation of _Scheduler_SMP_Start_idle().
 

Data Structures

struct  Scheduler_Operations
 The scheduler operations. More...
 
struct  Scheduler_Context
 Scheduler context. More...
 
struct  _Scheduler_Control
 Scheduler control. More...
 
struct  Scheduler_Node
 Scheduler node for per-thread data. More...
 

Macros

#define _Scheduler_Count   ( (size_t) 1 )
 This constant contains the count of configured schedulers.
 
#define SCHEDULER_DEFAULT_SMP_OPERATIONS
 This define provides a set of default implementations for SMP-specific scheduler operations.
 
#define SCHEDULER_DEFAULT_SET_AFFINITY_OPERATION
 This define provides the default implementation for the SMP-specific set affinity operation.
 
#define PRIORITY_MAXIMUM   ( _Scheduler_Table[ 0 ].maximum_priority )
 This defines the lowest (least important) thread priority of the first scheduler instance.
 
#define SCHEDULER_NODE_OF_WAIT_PRIORITY_NODE(node)    RTEMS_CONTAINER_OF( node, Scheduler_Node, Wait.Priority.Node.Node.Chain )
 
#define SCHEDULER_NODE_OF_WAIT_PRIORITY(node)    RTEMS_CONTAINER_OF( node, Scheduler_Node, Wait.Priority )
 
#define SCHEDULER_PRIORITY_MAP(priority)   ( ( priority ) << 1 )
 Maps a priority value to support the append indicator.
 
#define SCHEDULER_PRIORITY_UNMAP(priority)   ( ( priority ) >> 1 )
 Returns the plain priority value.
 
#define SCHEDULER_PRIORITY_PURIFY(priority)    ( ( priority ) & ~( (Priority_Control) PRIORITY_GROUP_LAST ) )
 Clears the priority append indicator bit.
 
#define SCHEDULER_PRIORITY_APPEND(priority)    ( ( priority ) | ( (Priority_Control) PRIORITY_GROUP_LAST ) )
 Returns the priority control with the append indicator bit set.
 
#define SCHEDULER_PRIORITY_IS_APPEND(priority)    ( ( ( priority ) & ( (Priority_Control) PRIORITY_GROUP_LAST ) ) != 0 )
 Returns true, if the item should be appended to its priority group, otherwise returns false and the item should be prepended to its priority group.
 

Typedefs

typedef struct _Scheduler_Control Scheduler_Control
 
typedef struct Scheduler_Context Scheduler_Context
 Scheduler context.
 
typedef struct Scheduler_Node Scheduler_Node
 

Functions

Priority_Control _Scheduler_default_Map_priority (const Scheduler_Control *scheduler, Priority_Control priority)
 Returns the scheduler internal thread priority mapped by SCHEDULER_PRIORITY_MAP().
 
Priority_Control _Scheduler_default_Unmap_priority (const Scheduler_Control *scheduler, Priority_Control priority)
 Returns the user visible thread priority unmapped by SCHEDULER_PRIORITY_UNMAP().
 
void _Scheduler_default_Schedule (const Scheduler_Control *scheduler, Thread_Control *the_thread)
 Does nothing.
 
void _Scheduler_default_Node_initialize (const Scheduler_Control *scheduler, Scheduler_Node *node, Thread_Control *the_thread, Priority_Control priority)
 Performs the scheduler base node initialization.
 
void _Scheduler_default_Node_destroy (const Scheduler_Control *scheduler, Scheduler_Node *node)
 Does nothing.
 
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.
 
void _Scheduler_default_Cancel_job (const Scheduler_Control *scheduler, Thread_Control *the_thread, Priority_Node *priority_node, Thread_queue_Context *queue_context)
 Does nothing.
 
void _Scheduler_default_Start_idle (const Scheduler_Control *scheduler, Thread_Control *the_thread, struct Per_CPU_Control *cpu)
 Starts an idle thread.
 
void _Scheduler_Handler_initialization (void)
 Initializes the scheduler to the policy chosen by the user.
 
Status_Control _Scheduler_Get_affinity (Thread_Control *the_thread, size_t cpusetsize, cpu_set_t *cpuset)
 Copies the thread's scheduler's affinity to the given cpuset.
 
Status_Control _Scheduler_Set_affinity (Thread_Control *the_thread, size_t cpusetsize, const cpu_set_t *cpuset)
 Sets the thread's scheduler's affinity.
 

Variables

const Scheduler_Control _Scheduler_Table []
 This table contains the configured schedulers.
 

Detailed Description

This group contains the Scheduler Handler implementation.

This handler encapsulates functionality related to managing sets of threads that are ready for execution.

Schedulers are used by the system to manage sets of threads that are ready for execution. A scheduler consists of

Each thread uses exactly one scheduler as its home scheduler. Threads may temporarily use another scheduler due to actions of locking protocols.

All properties of a scheduler can be configured and controlled by the user. Some properties are fixed at link time (defined by application configuration options), other properties can be changed at runtime through directive calls.

The scheduler index, name, and initial processor set are defined for a particular application by the application configuration. The schedulers are registered in the _Scheduler_Table which has _Scheduler_Count entries.

Macro Definition Documentation

◆ _Scheduler_Count

#define _Scheduler_Count   ( (size_t) 1 )

This constant contains the count of configured schedulers.

In SMP configurations, the constant is defined by <rtems/confdefs.h> through the count of entries of the CONFIGURE_SCHEDULER_TABLE_ENTRIES application configuration option.

In uniprocessor configurations, this is a compile time constant set to one. This is important so that the compiler can optimize some loops away.

See also
_Scheduler_Table.

◆ SCHEDULER_DEFAULT_SET_AFFINITY_OPERATION

#define SCHEDULER_DEFAULT_SET_AFFINITY_OPERATION

This define provides the default implementation for the SMP-specific set affinity operation.

The default implementation _Scheduler_default_Set_affinity() is intended for uniprocessor schedulers and SMP schedulers which only support an affinity to all online processors.

If SMP support is disabled, the define evaluates to nothing.

◆ SCHEDULER_DEFAULT_SMP_OPERATIONS

#define SCHEDULER_DEFAULT_SMP_OPERATIONS

This define provides a set of default implementations for SMP-specific scheduler operations.

The default implementations are intended for uniprocessor schedulers. SMP schedulers shall implement the operations properly.

If SMP support is disabled, the define evaluates to nothing.

If SMP support is enabled and the system has exactly one processor, then it may use an uniprocessor scheduler. The ask for help, reconsider help request, and withdraw node operations are NULL, since they are only used if a thread has at least one helping scheduler node. At least two schedulers are required to get a helping node and each scheduler involved must own at least one processor. This is not possible on a system with exactly one processor. The processor add operation is NULL, since there is no other processor to add. The processor remove operation is NULL, since the one and only processor cannot be removed.

Typedef Documentation

◆ Scheduler_Context

Scheduler context.

The scheduler context of a particular scheduler implementation must place this structure at the begin of its context structure.

Function Documentation

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

Parameters
schedulerThis parameter is unused.
the_threadThis parameter is unused.
priority_nodeThis parameter is unused.
queue_contextThis parameter is unused.
Returns
Always returns NULL.

◆ _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().

Parameters
schedulerUnused.
priorityThe user visible thread priority.
Returns
The scheduler internal thread priority.

◆ _Scheduler_default_Node_destroy()

void _Scheduler_default_Node_destroy ( const Scheduler_Control scheduler,
Scheduler_Node node 
)

Does nothing.

Parameters
schedulerThis parameter is unused.
nodeThis parameter is unused.

◆ _Scheduler_default_Node_initialize()

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

Performs the scheduler base node initialization.

Parameters
schedulerThis parameter is unused.
[out]nodeThe node to initialize.
the_threadThis parameter is unused.
priorityThe thread priority.

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

Parameters
schedulerThis parameter is unused.
the_threadThis parameter is unused.
priority_nodeThis parameter is unused.
deadlineThis parameter is unused.
queue_contextThis parameter is unused.
Returns
Always returns NULL.

◆ _Scheduler_default_Schedule()

void _Scheduler_default_Schedule ( const Scheduler_Control scheduler,
Thread_Control the_thread 
)

Does nothing.

Parameters
schedulerThis parameter is unused.
the_threadThis parameter is unused.

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

Parameters
schedulerThis parameter is unused.
[in,out]the_threadAn idle thread.
cpuThis parameter is unused.

◆ _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().

Parameters
schedulerUnused.
priorityThe scheduler internal thread priority.
Returns
priority The user visible thread priority.

◆ _Scheduler_Get_affinity()

Status_Control _Scheduler_Get_affinity ( Thread_Control the_thread,
size_t  cpusetsize,
cpu_set_t *  cpuset 
)

Copies the thread's scheduler's affinity to the given cpuset.

Parameters
the_threadThe thread to get the affinity of its scheduler.
cpusetsizeThe size of cpuset.
[out]cpusetThe cpuset that serves as destination for the copy operation
Return values
STATUS_SUCCESSFULThe operation succeeded.
STATUS_INVALID_SIZEThe processor set was too small.

◆ _Scheduler_Handler_initialization()

void _Scheduler_Handler_initialization ( void  )

Initializes the scheduler to the policy chosen by the user.

This routine initializes the scheduler to the policy chosen by the user through confdefs, or to the priority scheduler with ready chains by default.

◆ _Scheduler_Set_affinity()

Status_Control _Scheduler_Set_affinity ( Thread_Control the_thread,
size_t  cpusetsize,
const cpu_set_t *  cpuset 
)

Sets the thread's scheduler's affinity.

Parameters
[in,out]the_threadThe thread to set the affinity of.
cpusetsizeThe size of cpuset.
cpusetThe cpuset to set the affinity.
Return values
STATUS_SUCCESSFULThe operation succeeded.
STATUS_INVALID_NUMBERThe processor set was not a valid new processor affinity set for the thread.

Variable Documentation

◆ _Scheduler_Table

const Scheduler_Control _Scheduler_Table[]
extern

This table contains the configured schedulers.

The table is defined by <rtems/confdefs.h> through the CONFIGURE_SCHEDULER_TABLE_ENTRIES application configuration option.

See also
_Scheduler_Count.