How to used MQX without Raud robin?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to used MQX without Raud robin?

564 Views
profprogrammer
Contributor III

I use KSDK 1.3 with MQX.

it is necessary for me that the task would receive so much time of the microcontroller how many to it it will be required.

and the task gave control following independently.

task1 -> task2 -> task3 ->

<-       <-      <-       <-

it is possible?

0 Kudos
1 Reply

308 Views
soledad
NXP Employee
NXP Employee

Hello,

MQX RTOS provides these task-scheduling policies:

• FIFO

• Round Robin

• Explicit, using task queues

You can set the scheduling policy to FIFO or round robin for the processor and separately for each task.

FIFO is the default scheduling policy. With FIFO scheduling, the task that runs (becomes active) next is the highest-priority task that has been waiting the longest time. The active task runs, until any of the following occurs:

• The active task voluntarily relinquishes the processor, because it calls a blocking MQX RTOS function.

• An interrupt occurs that has higher priority than the active task.

• A task that has priority higher than the active task, becomes ready.

Round robin scheduling is similar to FIFO scheduling, but with the additional constraint that each round robin task has a maximum amount of time (the time slice), during which it can be active.

A task uses round robin scheduling only if the MQX_TIME_SLICE_TASK attribute is set in its task template. The task's time slice is determined by the value of the template's DEFAULT_TIME_SLICE. However, if the value is zero, the task's time slice is the default time slice for the processor. Initially, the default time slice for the processor is ten times the interval of the periodic timer interrupt. Since the interval on most BSPs is five milliseconds, the initial default time slice for the processor is usually 50 milliseconds.

When the time slice expires for an active round robin task, MQX RTOS saves the task's context. MQX RTOS then performs a dispatch operation, in which it examines the ready queues to determine, which task should become active. MQX RTOS moves the expired task to the end of the task's ready queue, an action that causes control to pass to the next task in the ready queue. If there are no other tasks in the ready queue, the expired task continues to run.

With round robin scheduling, tasks of the same priority can share the processor in a timeequitable manner.

Example FIFO:

  /* Task Index,  Function,  Stack,  Priority,    Name,       Attributes,                      Param,  Time Slice */  

{ADC_TASK,      adc_task,  1000,      7,        "Adc",      MQX_AUTO_START_TASK,    0,      0           },

    {0}

Example Round Robin:

  /* Task Index,  Function,  Stack,  Priority,    Name,       Attributes,                      Param,  Time Slice */  

     { HELLO,    hello_task, 2000,      7,       "hello_task", MQX_TIME_SLICE_TASK,  0,         100},

Please let me know if this helps!!

Have a great day,

Sol

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos