richard_damon wrote on Monday, March 31, 2014:
The system will run the highest task that is available to run, and when that task blocks the system will switch to the next task (that is now the highest ready to run). If two tasks are the same priority, then FreeRTOS will switch between them (if you allow preemption) every timer tick, or on a call to vTaskYield.
You talk about a task running x ms “a loop”, if by that you mean that it computes for x ms to get a result, and then would naturally immediately start a new computation again (without blocking), THIS IS BAD. Such a task will monopolize the system and any tasks of lower priority will never run.
Tasks of this sort really, if you really need them, should only exist at the idle priority, so there can be no tasks of lower priority, and then let freeRTOS switch between them with preemption, or have Yields in the loop.
Generally, tasks “do their thing” in response to something, be it a semaphore being set or data being put in a queue, either from another task or an interrupt. Sometime it might just be on a periodic basis based on timer ticks, and the task will block when done waiting for the conditions to arise when it should do its thing again.