4.2. Using sched_yield and Other Synchronization Mechanisms
The sched_yield system call is used by a thread allowing other threads a chance to run. Often when sched_yield is used, the thread can go to the end of the run queues, taking a long time to be scheduled again, or it can be rescheduled straight away, creating a busy loop on the CPU. The scheduler is better able to determine when and if there are actually other threads wanting to run.
POSIX Threads (Pthreads) have abstractions that will provide more consistent behavior across kernel versions. However, this can also mean that the system has less time to process networking packets, leading to considerable performance loss. This type of loss can be difficult to diagnose as there are no significant changes in the networking components of the system. It can also result in a change in behavior of some applications.
For more information, see Arnaldo Carvalho de Melo's paper on Earthquaky kernel interfaces.
For more information, or for further reading, the following man pages are related to the information given in this section.
pthread.h(P)
sched_yield(2)
sched_yield(3p)