Very interesting, thanks.See here, especially the subsection titled "Why is the kernel killing my processes?":
Exploring Swap on FreeBSD
Answer burning FreeBSD memory questions like when to use swap space and how, but also kernel reactions to the shortages of free memory. Check out our 2021 guide to using swap space in FreeBSD.klarasystems.com
protect
ed? ps
, any other tool? procstat
within the memory section does show different flags with or without protect
in place, at least I'm not able to see the differences.One question: how I can get information about a running process that has beenprotect
ed?
I mean, I cannot find any flag inps
, any other tool?
flags The flags associated with the process as in the include file <sys/proc.h>:
[…]
P_PROTECTED 0x100000 Do not kill on memory overcommit
P_SIGEVENT 0x200000 Process pending signals changed
P_SINGLE_BOUNDARY 0x400000 Threads should suspend at user boundary
P_HWPMC 0x800000 Process is using HWPMCs
[…]
ps ux -o flags
, you'll see those flags at the end of each line. If I'm reading the manpage correctly, then a process is protected when a 1 (or any odd number?) appears as the third digit from the left in that column. syslog
, sshd
and cron
as protected (and nothing else), which makes sense (emphasis mine):root 406 0.0 0.0 12556 3664 - Is Tue19 0:00.02 /usr/sbin/mountd 10000000
root 497 0.0 0.0 6416 1636 - Ss 18Mar21 0:22.97 /usr/sbin/syslog 10100000
root 620 0.0 0.0 6372 1072 - Ss 18Mar21 3:51.92 /usr/sbin/powerd 10000000
root 672 0.0 0.0 12856 2396 - Ss 18Mar21 0:00.33 /usr/sbin/sshd 10100100
root 699 0.0 0.0 6456 776 - Is 18Mar21 0:08.26 /usr/sbin/cron - 10100000
root 766 0.0 0.0 0 16 - DL 18Mar21 14:33.93 [g_eli[0] gpt/ha 10000204