I have few tasks run in parallel, and I want to let the MQX OS manage the task queue according to task's priorities, without my interference.
Thus, I do not want task A to block itself (by using _task_block), come back to life only when Task B will set it ready (by using _task_ready).
Currently, when I wish to switch tasks, I use _time_delay(1) - which is pretty bad programming practice, since this task will wake up after a whole millisecond at the minimum, and not when it is needed.
So, How can I explicitly perform a task switch?
Thanks,
Lior.
已解决! 转到解答。
Hi Lior,
With FIFO scheduling, the active task runs, until any of the following occurs:
-the active task voluntarily relinquishes the processor, because it calls a blocking MQX function
-an interrupt occurs that has higher priority than the active task
-a task that has priority higher than the active task, becomes ready
There exists _time_delay_ticks() function which gets parameter in minimum number of ticks to suspend the task.
MQX supports also Round Robin scheduling, which 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. When the time slice expires, the MQX then performs a dispatch operation to determine, which task should become active.
Hi Lior,
With FIFO scheduling, the active task runs, until any of the following occurs:
-the active task voluntarily relinquishes the processor, because it calls a blocking MQX function
-an interrupt occurs that has higher priority than the active task
-a task that has priority higher than the active task, becomes ready
There exists _time_delay_ticks() function which gets parameter in minimum number of ticks to suspend the task.
MQX supports also Round Robin scheduling, which 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. When the time slice expires, the MQX then performs a dispatch operation to determine, which task should become active.