Scheduling lists in GeMRTOS #
In GeMRTOS, each task is assigned to a scheduling list and one or more processors may serve that scheduling list. Processors may serve one or more scheduling lists, thereby allowing the predictability of partitioned scheduling with a flexible balance of processor loads. Scheduling overhead is reduced using a timer-tickless scheduler. Floating scheduling reduces the overhead for the highest priority tasks and isolates the design of the system from the number of processors of the hardware architecture. The generic feature allows partial configuring, global and partitioned scheduling. Hybrid partition scheduling are based on scheduling lists which allow assigning tasks and processors to scheduling the different subsystems of the application.
Resources may be shared among tasks from several scheduling lists, as shown in the figure. Each scheduling list may implement a different scheduling priority and task may be migrated from one scheduling list to another scheduling list during runtime. Processors may be assigned to several scheduling lists, and their assignment may change at any time during runtime.
Types of GeMRTOS scheduling lists #
The following are the type of tasks in GeMRTOS, but more can be defined:
GS_LCBTypeEDF: The GS_LCBTypeEDF scheduling list type implements the Earliest Deadline First (EDF) discipline among the tasks assigned to the scheduling list. In the EDF discipline, the earliest deadline, the highest priority. In order to maintain consistency, tasks that are assigned to an EDF scheduled list should be of the periodic type, with the deadline taken into account starting from the release time.
GS_LCBTypeFP: The GS_LCBTypeFP scheduling list type implements the Fixed Priority (FP) discipline among the tasks assigned to the scheduling list. In the FP discipline, a priority is assigned to each task. Task priority may be modified during runtime. In order to maintain consistency, tasks that are assigned to an FP scheduled list should not be of the infinite-loop type without waiting for event suspension in order to avoid starving lower-priority tasks. Only the lowest-priority task could be implemented as an infinite-loop code.
Main scheduling list related functions #
Creating and initializing a scheduling list #
A scheduling list can easily be created using:
GS_LCB *gu_SchedulingListCreate(enum lcbtype lcbtype);
The gu_SchedulingListCreate function creates a new scheduling list. The type of scheduling discipline used by the list is determined by the lcbtype parameter.The task is created with the following parameters:
lcbtype: An enumeration value specifying the type of scheduling list to create. This defines the scheduling discipline that will govern task scheduling within the new scheduling list.
The gu_SchedulingListCreate function returns a pointer (GS_LCB *) to the newly created GS_LCB structure. This pointer is essential for all subsequent operations involving this specific scheduling list. A '(GS_LCB *) 0' return value indicates failure to create the scheduling list.Scheduling list / Processor association #
A processor is associated with a scheduling list with the following function:
G_INT32 gu_SchedulingListAssociateProcessor(GS_LCB *plcb, G_INT32 CPUID, G_INT32 priority);
The gu_SchedulingListAssociateProcessor function associates a system processor with a specified scheduling list. The priority is assigned to the association between the processor and the scheduling list. When tasks are ready to execute, the processor will select and execute the task from the highest priority scheduling list that it is associated with. The association with the lowest numerical value indicates the highest priority, ensuring that tasks in the most critical scheduling lists are prioritized for execution.The processor is associated with the following parameters:
plcb: A pointer to the GS_LCB structure representing the scheduling list to be associated with the processor.
CPUID: The ID of the processor to be associated with the scheduling list.
priority: The priority level for the association. A lower value indicates a higher priority, and the processor will first search the scheduling lists associated with the highest priority tasks that are ready to execute.
The gu_SchedulingListAssociateProcessor function returns G_TRUE if the association is successful. It returns G_FALSE if the association fails.Task / Scheduling list association #
A task is assigned to a scheduling list with the following function:
G_INT32 gu_SchedulingListAssociateTask(struct gs_tcb *ptcb, struct gs_lcb *plcb);
The gu_SchedulingListAssociateTask function assigns a task to a specific scheduling list. Once assigned, the task will be scheduled according to the priority discipline defined for that scheduling list.The task is assigned tothe scheduling list with the following parameters:
ptcb: A pointer to the GS_TCB structure representing the task to be assigned.
plcb: A pointer to the GS_LCB structure representing the scheduling list to which the task should be added.
The gu_SchedulingListAssociateTask function returns G_TRUE if the task was successfully assigned to the scheduling list, and G_FALSE otherwise.