You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Yield the current thread. This routine causes the current thread to yield execution to another thread of the same or higher priority. If there are no other ready threads of the same or higher priority, the routine returns immediately.
... but the SMP scheduler (on a single-processor system) does not appear to yield control to other equal-priority threads.
Basically, two threads are created of equal priority which busy-loop and print an identifying number periodically, yielding each time through the loop. (thread_func0 exists solely in case the main thread has a low priority.) With the old scheduler (CONFIG_SMP=n), this works as expected, with the two threads interleaving --
Using the latest master (currently 536e785).
The documentation for
k_yield()
says:... but the SMP scheduler (on a single-processor system) does not appear to yield control to other equal-priority threads.
Sample program:
Basically, two threads are created of equal priority which busy-loop and print an identifying number periodically, yielding each time through the loop. (
thread_func0
exists solely in case the main thread has a low priority.) With the old scheduler (CONFIG_SMP=n
), this works as expected, with the two threads interleaving --On a qemu_x86 target (
CONFIG_SMP=n
obviously):etc.
On a qemu_x86_64 target (
CONFIG_SMP=n
):etc.
On a qemu_x86_64 target (
CONFIG_SMP=y CONFIG_MP_NUM_CPUS=1
):The second thread is never scheduled.
The text was updated successfully, but these errors were encountered: