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

Thomas Doerfler Thomas.Doerfler at imd-systems.de
Fri May 1 08:59:00 UTC 2020


Fernando,

a second guess: which systems calls are you doing in your Task1 and
task2? Obviously your are sending events (which is not preempting) and
doing console output (which is questionable regarding preemption), but
which other calls are involved?

wkr,

Thomas.

Am 30.04.20 um 17:14 schrieb Fernando Domínguez Pousa:
> 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.
> 
>  
> 
> 
> PPlease consider the environment before printing this e-mail.
> 
> _______________________________________________
> users mailing list
> users at rtems.org
> http://lists.rtems.org/mailman/listinfo/users
> 

-- 
IMD Ingenieurbuero fuer Microcomputertechnik
Thomas Doerfler           Herbststrasse 8
D-82178 Puchheim          Germany
email:    Thomas.Doerfler at imd-systems.de
PGP public key available on request


More information about the users mailing list