I have several tasks of same priority. Each time slot is 10msec (ticks is 100Hz). If a task needs only 6msec (of 10msec). I would like to give rest of time to other tasks instead of waiting next tick (assuming no active high priority task take over on next tick). As per the maual, taskYIELD will cause OS to switch to other tasks. The next task will only have 4msec of work before next context switch because of SysTick. Assuming above is correct, (1) Is there a way to make OS not to context switch on next tick? (2) If a high priority task wants to allow lower priority tasks to do some work until next tick, will vTaskDelayUntil(&var, 1) block running task immediately and allow lower priority tasks do work until next tick? Thanks.
1) If you disable Time Slicing then tasks of the same priority will not rotate on ticks, but only when yeilding or blocking. 2) If you have Preemption enabled, then the higher priority task will startup as soon as it is ready (which if it is doing a delay, will be on the timer tick). One note, if you really want to delay till the next timer tick, use vTaskDelay(1), vTaskDelayUntil(&var, 1) will only delay if the task has ‘caught up’ to the tick counter.
for (1) I am working on preemption. Assuming no higher priority tasks. So, will taskYIELD allow next (same priority) task to run until next tick or for whole time slice? Thanks.
Until the next tick.
thanks. that is short and clear answer.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.