Scroll to navigation

SCHED_YIELD(2) Podręcznik programisty Linuksa SCHED_YIELD(2)

NAZWA

sched_yield - oddanie procesora

SKŁADNIA

#include <sched.h>

int sched_yield(void);

OPIS

sched_yield() causes the calling thread to relinquish the CPU. The thread is moved to the end of the queue for its static priority and a new thread gets to run.

WARTOŚĆ ZWRACANA

Po pomyślnym zakończeniu sched_yield() zwraca zero. Po błędzie zwracane jest -1 i odpowiednio ustawiane errno.

BŁĘDY

In the Linux implementation, sched_yield() always succeeds.

ZGODNE Z

POSIX.1-2001, POSIX.1-2008.

UWAGI

If the calling thread is the only thread in the highest priority list at that time, it will continue to run after a call to sched_yield().

Systemy POSIX-owe, na których dostępny jest sched_yield() definiują w <unistd.h> _POSIX_PRIORITY_SCHEDULING.

Strategic calls to sched_yield() can improve performance by giving other threads or processes a chance to run when (heavily) contended resources (e.g., mutexes) have been released by the caller. Avoid calling sched_yield() unnecessarily or inappropriately (e.g., when resources needed by other schedulable threads are still held by the caller), since doing so will result in unnecessary context switches, which will degrade system performance.

sched_yield() is intended for use with real-time scheduling policies (i.e., SCHED_FIFO or SCHED_RR). Use of sched_yield() with nondeterministic scheduling policies such as SCHED_OTHER is unspecified and very likely means your application design is broken.

ZOBACZ TAKŻE

sched(7)

O STRONIE

Angielska wersja tej strony pochodzi z wydania 5.10 projektu Linux man-pages. Opis projektu, informacje dotyczące zgłaszania błędów oraz najnowszą wersję oryginału można znaleźć pod adresem https://www.kernel.org/doc/man-pages/.

TŁUMACZENIE

Autorami polskiego tłumaczenia niniejszej strony podręcznika są: Przemek Borys <pborys@dione.ids.pl>

Niniejsze tłumaczenie jest wolną dokumentacją. Bliższe informacje o warunkach licencji można uzyskać zapoznając się z GNU General Public License w wersji 3 lub nowszej. Nie przyjmuje się ŻADNEJ ODPOWIEDZIALNOŚCI.

Błędy w tłumaczeniu strony podręcznika prosimy zgłaszać na adres listy dyskusyjnej manpages-pl-list@lists.sourceforge.net.

15 września 2017 r. Linux