RTEMS tasks timesliced instead of running to completion. TIMESLICE flag is not active!

Fernando Domínguez Pousa fdpousa at gmv.com
Thu Apr 30 15:14:12 UTC 2020


Hello,

I am executing a program which executes four different task with testing operations. These tasks were created and launched in this way:

status = rtems_task_create(Task_name[i], (rtems_task_priority) 2, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES,
            (i%2) == 0 ? RTEMS_FLOATING_POINT : RTEMS_DEFAULT_ATTRIBUTES, &Task_id[i]);

status = rtems_task_start(Task_id[i], (i%2) == 0 ? Task1_EntryPoint : Task2_EntryPoint, i);

As you can see all task are created with the same priority, and launched one after the other inside a for loop. They are configured in default modes, so time slicing is disabled by default  (all mode bits are 0). This result would be expected due to each task would run-to-completion because all tasks have the same priority:

The expected result:
[MAIN] Waiting for testing tasks to complete...
[TASK 0] Starting...
[TASK 0] Computed the correct floating point result.
[TASK 1] Starting...
[TASK 1] Computed the correct integer result.
[TASK 2] Starting...
[TASK 2] Computed the correct floating point result.
[TASK 3] Starting...
[TASK 3] Computed the correct integer result.
[MAIN] All testing tasks completed.

Nevertheless, using RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_MODES | RTEMS_TIMESLICE or RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT either as rtems_mode, the result is always the same.

The actual result:
[MAIN] Waiting for testing tasks to complete...
[TASK 0] Starting...
[TASK 1] Starting...
[TASK 2] Starting...
[TASK 3] Starting...
[TASK 0] Computed the correct floating point result.
[TASK 1] Computed the correct integer result.
[TASK 2] Computed the correct floating point result.
[TASK 3] Computed the correct integer result.
[MAIN] All testing tasks completed.

At RTEMS API Guide:

The timeslicing component is used by the RTEMS scheduler to determine how the processor is allocated to tasks of equal priority. If timeslicing is enabled (RTEMS_TIMESLICE), then RTEMS will limit the amount of time the task can execute before the processor is allocated to another ready task of equal priority.

The length of the timeslice is application dependent and specified in the Configuration Table. If timeslicing is disabled (RTEMS_NO_TIMESLICE), then the task will be allowed to execute until a task of higher priority is made ready. However I have not any task with higher priority, Init task priority is lower.

If RTEMS_NO_PREEMPT is selected, then the timeslicing component is ignored by the scheduler.

How can I execute this tasks in a run to completion fashion for same priority tasks? Task 0 starts and ends, then Task1 starts and ends... etc,

Regards,

Fer.


P Please consider the environment before printing this e-mail.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20200430/ee47b7e0/attachment.html>


More information about the users mailing list