-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Closed
Labels
EnhancementChanges/Updates/Additions to existing featuresChanges/Updates/Additions to existing featuresarea: Documentationarea: Kernel
Description
Zephyr has never been good about documenting its schedule points, where a call to z_swap() (via the z_reschedule family of internal utilities) can be made and a new thread can be selected to run. This complicates user analysis, especially in the case of cooperative/non-preemptible threads, and can lead to surprising behavior (see for example #20802, where a priority change due to mutex release is not immediately honored by the scheduler).
We should be rigorous about this and document all the circumstances under which each API can reschedule. For example:
- k_sem_take() will swap only on an empty semaphore
- k_sem_give() will always reschedule, even if no other threads were waiting
- k_mutex_unlock() will not swap, even if the priority changes (reschedule not done after mutex unlock #20802)
- k_pipe_put() will not swap, except if an async message is queued
And lots more...
The lack of documentation here is blocking work on existing code, so we really need to get this fixed.
Metadata
Metadata
Assignees
Labels
EnhancementChanges/Updates/Additions to existing featuresChanges/Updates/Additions to existing featuresarea: Documentationarea: Kernel