How can I explicitly perform a task switch?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How can I explicitly perform a task switch?

ソリューションへジャンプ
1,213件の閲覧回数
panpwr
Contributor IV

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.

タグ(3)
0 件の賞賛
返信
1 解決策
927件の閲覧回数
Martin_
NXP Employee
NXP Employee

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.

元の投稿で解決策を見る

0 件の賞賛
返信
1 返信
928件の閲覧回数
Martin_
NXP Employee
NXP Employee

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.

0 件の賞賛
返信