PREEMPT(9)

๐Ÿ“ฆ version 11.0, in nixpkgs unstable

๐Ÿ‘‘ PREEMPT(9) โ€” Kernel Developerโ€™s Manual energy ๐Ÿ‘‘

okay so this page is literally named preempt, and itโ€™s from the Kernel Developerโ€™s Manual. Weโ€™re talking general preempt and yield functions, bestie. ๐Ÿซถ

โœจ NAME โœจ

preempt, yield โ€” general preempt and yield functions

๐ŸŽ€ SYNOPSIS ๐ŸŽ€

#include <sys/sched.h>

void
preempt(void);

#include <sys/proc.h>

void
yield(void);

๐ŸŒธ DESCRIPTION ๐ŸŒธ

So preempt() takes the current LWP and puts it back on the system run queue, then performs an involuntary context switch. Thatโ€™s the whole flex. ๐Ÿ’…

yield() is mostly the same as preempt() โ€” the key difference is that it performs a voluntary context switch. Yes bestie, voluntary vs. involuntary is the vibe check here. โœจ

Both of these functions drop the kernel lock before switching, and they re-acquire it before returning. no cap. ๐Ÿ”ฅ


okay thatโ€™s the page, bestie ๐Ÿซถ โ€” source/version is Debian, the date is July 3, 2007, and the manual slot is literally PREEMPT(9). periodt ๐Ÿ’–

๐Ÿ“ฆ where this page comes from