<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.pre
        {mso-style-name:pre;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 3.0cm 70.85pt 3.0cm;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="ES" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-GB">Hello,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">I am executing a program which executes four different task with testing operations. These tasks were created and launched in this way:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">status = rtems_task_create(Task_name[i], (rtems_task_priority) 2, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">            (i%2) == 0 ? RTEMS_FLOATING_POINT : RTEMS_DEFAULT_ATTRIBUTES, &Task_id[i]);<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">status = rtems_task_start(Task_id[i], (i%2) == 0 ? Task1_EntryPoint : Task2_EntryPoint, i);<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">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:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">The expected result:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">[MAIN] Waiting for testing tasks to complete...<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">[TASK 0] Starting...<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">[TASK 0] Computed the correct floating point result.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">[TASK 1] Starting...<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">[TASK 1] Computed the correct integer result.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">[TASK 2] Starting...<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">[TASK 2] Computed the correct floating point result.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">[TASK 3] Starting...<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">[TASK 3] Computed the correct integer result.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">[MAIN] All testing tasks completed.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">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.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">The actual result:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">[MAIN] Waiting for testing tasks to complete...<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">[TASK 0] Starting...<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">[TASK 1] Starting...<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">[TASK 2] Starting...<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">[TASK 3] Starting...<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">[TASK 0] Computed the correct floating point result.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">[TASK 1] Computed the correct integer result.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">[TASK 2] Computed the correct floating point result.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">[TASK 3] Computed the correct integer result.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">[MAIN] All testing tasks completed.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">At RTEMS API Guide:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-family:"Arial",sans-serif;color:#404040;background:#FCFCFC">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 (</span><span class="pre"><span lang="EN-GB" style="font-family:Consolas;color:#2A8E1D;border:none windowtext 1.0pt;padding:0cm;background:#FCFCFC">RTEMS_TIMESLICE</span></span><span lang="EN-GB" style="font-family:"Arial",sans-serif;color:#404040;background:#FCFCFC">),
 then RTEMS will limit the amount of time the task can execute before the processor is allocated to another ready task of equal priority.
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-family:"Arial",sans-serif;color:#404040;background:#FCFCFC"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span lang="EN-GB" style="font-family:"Arial",sans-serif;color:#404040;background:#FCFCFC">The length of the timeslice is application dependent and specified in the Configuration Table. If timeslicing is disabled (</span></b><span class="pre"><b><span lang="EN-GB" style="font-family:Consolas;color:#2A8E1D;border:none windowtext 1.0pt;padding:0cm;background:#FCFCFC">RTEMS_NO_TIMESLICE</span></b></span><b><span lang="EN-GB" style="font-family:"Arial",sans-serif;color:#404040;background:#FCFCFC">),
 then the task will be allowed to execute until a task of higher priority is made ready.
</span></b><span lang="EN-GB" style="font-family:"Arial",sans-serif;color:#404040;background:#FCFCFC">However I have not any task with higher priority, Init task priority is lower.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-family:"Arial",sans-serif;color:#404040;background:#FCFCFC"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-family:"Arial",sans-serif;color:#404040;background:#FCFCFC">If </span><span class="pre"><span lang="EN-GB" style="font-family:Consolas;color:#2A8E1D;border:none windowtext 1.0pt;padding:0cm;background:#FCFCFC">RTEMS_NO_PREEMPT</span></span><span lang="EN-GB" style="font-family:"Arial",sans-serif;color:#404040;background:#FCFCFC"> is
 selected, then the timeslicing component is ignored by the scheduler.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-family:"Arial",sans-serif;color:#404040;background:#FCFCFC"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">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,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Fer.</span><span lang="EN-GB" style="mso-fareast-language:ES">
</span><span style="mso-fareast-language:ES"><o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<span style=""><br>
</span><span style="font-size:18.0pt; line-height:125%; font-family:Webdings; color:green">P<span style=""></span>
<span style="font-size:7.0pt; line-height:125%; font-family:"Arial","sans-serif"; color:green">
Please consider the environment before printing this e-mail.</span></span><span style=""></span>
</body>
</html>