PHOLD(9)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1

πŸ’… PHOLD(9) β€” the "hold a process" manual, bestie edition πŸ’…

okay so this is a Kernel Developer's Manual page, and today's main character is PHOLD β€” the macro that literally just holds a process. iconic behaviour honestly.


🌸 NAME 🌸

PHOLD β€” hold a process 🫢


✨ SYNOPSIS ✨

like, here's the whole cast, no cap:

#include <sys/proc.h>

PHOLD(struct proc *p);

_PHOLD(struct proc *p);

PRELE(struct proc *p);

_PRELE(struct proc *p);

PROC_ASSERT_HELD(struct proc *p);

PROC_ASSERT_NOT_HELD(struct proc *p);

πŸ’– DESCRIPTION πŸ’–

so the PHOLD() macro increments the hold count of a process, and the PRELE() macro decrements the hold count of a process. that's it, that's the vibe. πŸ’…

and here's the part where it gets kind of serious, so listen up bestie 🫢 β€” if a process with a non-zero hold count tries to exit, it will sleep until its hold count has reached zero before the kernel begins releasing resources associated with the process. the way I think about it: nobody leaves the group chat until everyone's done holding. 😭

once a process has started exiting, it is invalid to increase its hold count. so callers must not attempt to hold a process that has the P_WEXIT flag set. 🚫 (fr fr, don't do it.)

also the VM daemon will not swap out the kernel stack of a thread belonging to a process with a non-zero hold count. so that stack is staying right where it is, periodt. πŸ‘‘

The _PHOLD() and _PRELE() macros are identical to PHOLD() and PRELE(), except that they must be called with the process lock held. πŸ”’ iykyk.


πŸŽ€ AUTHORS πŸŽ€

This manual page was written by Mark Johnston <markj@FreeBSD.org>. slay, thank you Mark. πŸ’–


that's the whole page, bestie β€” go forth and hold those processes responsibly βœ¨πŸ¦‹πŸŒΈ

Debian Β· November 7, 2015 πŸŽ€ β€” mwah, that's a wrap on the PHOLD(9) page, version and date and all πŸ’œ

πŸ“¦ where this page comes from