When a task blocks because a semaphore isn't available to take, does the context immediately switch to another task? Or does the OS pend until the next systick after which a context switch occurs?
I need to sample something at 1000 hz, but my systick is also at 1000 hz. I'm worried that my sampling task will starve all other tasks of processing time.
Thanks in advance.
FreeRTOS, by default, uses a prioritised pre-emptive scheduler. It will
always run the highest priority task that is able to run.
If a task enters the Blocked state (because it is waiting for an event,
be that a message on a queue, or a direct to task notification, or
whatever) the scheduler will immediately select another task.
If a task sends an event to a higher priority task that causes the
higher priority task to exit the Blocked state, then the scheduler will
immediately switch to the unblocked task.