yield_to(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… yield_to(9) β€” aka the "let your bestie have the CPU" syscall

okay so welcome to the Kernel API Manual bestie, this is the yield_to(9) page and honestly? it's giving main character energy πŸŽ€ every detail is staying, the vibe is just getting a glow-up ✨


🌸 NAME 🌸

yield_to β€” yield the current processor to another thread in your thread group, or accelerate that thread toward the processor it's on.

no cap, that's literally what it does πŸ’–


✨ SYNOPSIS ✨

int yield_to (struct task_struct *p , bool preempt );

like, that's the whole signature, she's simple and she knows it 🫢


🧚 ARGUMENTS 🧚

  • p β€” target task πŸ’« (the one you're being nice to)
  • preempt β€” whether task preemption is allowed or not πŸ‘€ (as in, does anybody get to interrupt anybody here)

πŸ’… DESCRIPTION πŸ’…

so listen, this is important, don't @ me: it's the caller's job to make sure the target task_struct can't go away on us before we can do any checks. periodt πŸ’€ like if it vanishes mid-check that's on you, not on the kernel, and nobody wants that.


πŸ”₯ RETURN πŸ”₯

  • true (>0) if we actually boosted the target task β€” slay, we ate πŸ‘‘
  • false (0) if we failed to boost the target β€” it's giving flop, but respectfully πŸ™ˆ
  • -ESRCH if there's literally no task to yield to β€” nobody's home bestie 😭

πŸ¦‹ SEE ALSO πŸ¦‹

kernel file ./kernel/sched/syscalls.c, plus the whole friend group: task_prio(9), idle_cpu(9), idle_task(9), find_process_by_pid(9), sched_setscheduler(9), sched_setscheduler_nocheck(9), sys_sched_setscheduler(9), sys_sched_setparam(9), sys_sched_setattr(9), sys_sched_getscheduler(9), sys_sched_getparam(9), sys_sched_getattr(9), sys_sched_setaffinity(9), sys_sched_getaffinity(9), sys_sched_yield(9), yield(9), sys_sched_get_priority_max(9), sys_sched_get_priority_min(9), sys_sched_rr_get_interval(9)


so yeah, that's the whole page, go forth and yield responsibly 🌈

okay bye bestie, this one's coming to you straight from ./kernel/sched β€” version dated October 2026 β€” mwah πŸ’œπŸ§š

πŸ“¦ where this page comes from