rtel wrote on Thursday, May 17, 2018:
BTW I measured how much portYIELD() takes to switch back to the same
task (as no other task is scheduled). It is 170 clocks.
That sounds about right. The numbers here are for the context switch
only: FreeRTOS FAQ relating to FreeRTOS memory management and usage. FreeRTOS is an Open Source RTOS Kernel for small embedded systems and, although
shorter than your measured time (84 clocks), that will probably just be
due to different configurations.
Regarding the semaphore times. The semaphores are relatively heavy
weight objects as they are feature rich - you can have any number of
tasks blocked to give, any number blocked to take, and the blocked tasks
are in priority order, etc. The yield, which you listed separately,
occurs within that too. In most cases a direct to task notification can
be used for a much lighter weight and faster signalling mechanism.