Query: proc_compare
OS: netbsd
Section: 3
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
PROC_COMPARE(3) BSD Library Functions Manual PROC_COMPARE(3)NAMEproc_compare -- compare two processes' interactivityLIBRARYSystem Utilities Library (libutil, -lutil)SYNOPSIS#include <sys/sysctl.h> int proc_compare(const struct kinfo_proc2 *p1, const struct kinfo_lwp *l1, const struct kinfo_proc2 *p2, const struct kinfo_lwp *l2);DESCRIPTIONThe proc_compare() function compares two processes that are on the same terminal for their interactivity. This means that the process returned is the one that has a better chance being the active foreground process on that tty. This algorithm is used in the kernel for SIGINFO reporting and in userland by w(1). The algorithm used is as follows: o If one of them is runnable, it is preferred. o If both are runnable, the one with the largest CPU percent is preferred. o In a CPU percent tie, the one started more recently wins. o If none are runnable, and one of them is a zombie, the non-zombie is preferred o If both are zombies, the one started more recently wins. o If neither is a zombie, the one with the smaller sleep time wins. o In a tie, and one is sleeping in non-interruptible sleep, prefer that one. o If both are in the same state, the one started more recently is preferred. In all cases where the most recently started wins, if there was no winner, the one with the largest PID wins.RETURN VALUESThe proc_compare() function returns 0 if p1 is to be preferred and 1 if p2 is to be preferred.SEE ALSOw(1)HISTORYThe proc_compare() was extracted from src/sys/kern/tty.c and src/usr.bin/w/proc_compare.c and merged in NetBSD 6.0.BSDOctober 20, 2011 BSD
Related Man Pages |
---|
kvm_getenvv2(3) - netbsd |
proc_compare(3) - netbsd |
kinfo_getallproc(3) - freebsd |
runqueue(9) - freebsd |
choosethread(9) - freebsd |
Similar Topics in the Unix Linux Community |
---|
zombie program |
zombie process |
Re: How do I recognize a zombie process? |
Ways to eliminate Zombies? |
Winning Lotto... |