Re: [gentoo-user] Any utility to forcibly freeze or swap out a specific pid?
Hello, On Tue, 03 Jul 2018, Walter Dnes wrote: > Thanks; this could be interesting. Run "ps x", grep for specific >commands in the output, read the pid at the start of the line, and >autofreeze those processes.. Use 'pgrep [-u UID/USERNAME] pattern' or adjust ps output to only display what interests you, e.g.: $ ps -eo pid,cmd $ ps -eo pid,cmd | awk '$2 ~ /pattern/ { print $1; }' $ ps -eo pid,cmd | awk '$2 == "string" { print $1; }' etc. Or try 'pidof' (which needs the exact command-name and might return mismatches). HTH, -dnh -- printk (KERN_DEBUG "Somebody wants the port\n"); linux-2.6.6/drivers/parport/parport_pc.c
Re: [gentoo-user] Any utility to forcibly freeze or swap out a specific pid?
Thanks; this could be interesting. Run "ps x", grep for specific commands in the output, read the pid at the start of the line, and autofreeze those processes.. -- Walter Dnes I don't run "desktop environments"; I run useful applications
Re: [gentoo-user] Any utility to forcibly freeze or swap out a specific pid?
I just noticed something "interesting". I don't know if it's strictly gnumeric under ICEWM, or if it's more generic. Open several gnumeric spreadsheets. Do not minimize, but open one over top of the other. Run "top" in an xterm in that same workspace... == top - 00:19:02 up 1:53, 11 users, load average: 2.45, 1.52, 0.85 Tasks: 138 total, 5 running, 133 sleeping, 0 stopped, 0 zombie %Cpu(s): 89.0 us, 2.3 sy, 0.0 ni, 8.7 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st MiB Mem : 3027.5 total, 1799.7 free,616.7 used,611.1 buff/cache MiB Swap: 8971.0 total, 8971.0 free, 0.0 used. 2090.4 avail Mem PID USER PR NIVIRTRESSHR S %CPU %MEM TIME+ COMMAND 2832 waltdnes 20 0 277520 177068 40224 S 27.9 5.7 14:43.80 gnumeric 3023 waltdnes 20 0 275568 177184 38972 R 24.6 5.7 3:56.60 gnumeric 2857 waltdnes 20 0 142636 99552 25156 R 21.9 3.2 10:17.00 gnumeric 3067 waltdnes 20 0 179712 83760 37612 R 17.6 2.7 2:41.60 gnumeric 2997 waltdnes 20 0 85600 42292 24940 S 16.6 1.4 2:59.22 gnumeric 3009 waltdnes 20 0 73508 39312 24936 S 16.6 1.3 2:45.92 gnumeric 3001 waltdnes 20 0 82096 38696 24940 S 16.3 1.2 2:53.78 gnumeric 3005 waltdnes 20 0 81976 38392 24628 S 16.3 1.2 2:48.61 gnumeric 2879 waltdnes 20 0 92976 45972 26060 S 12.6 1.5 5:23.20 gnumeric 2660 root 20 0 323680 95236 82776 S 12.3 3.1 3:26.55 X == ...but switch over to another workspace, and cpu usage plummets... == top - 00:23:27 up 1:57, 11 users, load average: 0.11, 0.84, 0.75 Tasks: 138 total, 1 running, 137 sleeping, 0 stopped, 0 zombie %Cpu(s): 0.2 us, 0.0 sy, 0.0 ni, 99.8 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st MiB Mem : 3027.5 total, 1920.0 free,616.4 used,491.1 buff/cache MiB Swap: 8971.0 total, 8971.0 free, 0.0 used. 2210.8 avail Mem PID USER PR NIVIRTRESSHR S %CPU %MEM TIME+ COMMAND 1 root 20 02392 1488 1408 S 0.0 0.0 0:00.76 init 2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd 4 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/0+ 6 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 mm_percpu+ 7 root 20 0 0 0 0 S 0.0 0.0 0:00.01 ksoftirqd+ 8 root 20 0 0 0 0 S 0.0 0.0 0:00.55 rcu_sched 9 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcu_bh 10 root rt 0 0 0 0 S 0.0 0.0 0:00.00 migration+ 11 root 20 0 0 0 0 S 0.0 0.0 0:00.00 cpuhp/0 == Actually, minimizing all the spreadsheets and remaining in the same workspace similarly reduces cpu usage. Why would gnumeric spreadsheets be using cpu just sitting there, visible or behind another program? -- Walter Dnes I don't run "desktop environments"; I run useful applications
Re: [gentoo-user] Any utility to forcibly freeze or swap out a specific pid?
On Sun, Jul 1, 2018 at 9:40 PM Andrew Udvare wrote: > > YMMV on what processes will actually work properly after a SIGCONT. If > anything a process does is not re-entrant, then you could have very > unpredictable things happen including corruption of data. > If a process corrupts data of any significance after being stopped it should be considered a bug. Obviously if the process has sockets open there is a good chance that timeouts/etc will happen, and the process needs to handle that. However, the same is true if the network goes down/etc, or the system is suspended, or even if the system just gets really highly loaded and doesn't give the process much time. As others have pointed out, once the process stops running it is going to be a relatively high priority for swapping without having to try to do anything else to force things, and it won't come back unless you wake it up. -- Rich
Re: [gentoo-user] Any utility to forcibly freeze or swap out a specific pid?
Den 02. juli 2018 11:34, skrev Vadim A. Misbakh-Soloviov: >> kill -s SIGSTOP >> kill -s SIGCONT > Although, such a "freezing" doesn't free any RAM :-/ > > > It will allow the process to be swapped out without provoking thrashing. Should work, plugins might give you some grief though.
Re: [gentoo-user] Any utility to forcibly freeze or swap out a specific pid?
> kill -s SIGSTOP > kill -s SIGCONT Although, such a "freezing" doesn't free any RAM :-/
Re: [gentoo-user] Any utility to forcibly freeze or swap out a specific pid?
On Sun, Jul 1, 2018 at 9:16 PM Walter Dnes wrote: > > There are some programs that I would much rather keep open, versus > shutting down and restarting all over again. But keeping them all open > uses resources, especially on a 10-year-old CORE2 with 3 gigabytes of > RAM (The thing refuses to die). Is there a way to forcibly swap out or > freeze a specific PID, until I need to get back to it again? > kill -s SIGSTOP to resume: kill -s SIGCONT man kill man 7 signal YMMV on what processes will actually work properly after a SIGCONT. If anything a process does is not re-entrant, then you could have very unpredictable things happen including corruption of data. Andrew
[gentoo-user] Any utility to forcibly freeze or swap out a specific pid?
If you run the command... ps axo %cpu,%mem,pid,cmd | grep -v "^.CPU" | sort -nr | head -n 10 ...you'll get a list of processes sorted by cpu and memory consumption. In my case, I get... [d531][waltdnes][~] ps axo %cpu,%mem,pid,cmd | grep -v "^.CPU" | sort -nr | head -n 10 43.6 12.4 13976 /home/waltdnes/pm/palemoon/palemoon -new-instance -p slashdot 1.0 4.2 2650 /usr/bin/X :0 -nosilk -config xorg.conf -auth /home/waltdnes/.serverauth.2629 0.9 6.8 5278 /home/waltdnes/pm/palemoon/palemoon -new-instance -p palemoon 0.8 7.0 7127 /home/waltdnes/pm/palemoon/palemoon -new-instance -p dslr 0.4 5.4 13912 /home/waltdnes/pm/palemoon/palemoon -new-instance -p graphs 0.1 30.2 4981 /usr/bin/gnumeric worldtemps/netair/danomnick1000.gnumeric 0.1 4.8 5383 /home/waltdnes/pm/palemoon/palemoon -new-instance -p puppy 0.0 5.2 6765 /usr/bin/gnumeric /home/waltdnes/worldtemps/solarflux/solarflux.gnumeric 0.0 2.5 5106 /usr/bin/gnumeric worldtemps/netair/monuah.gnumeric 0.0 2.5 5075 /usr/bin/gnumeric worldtemps/netair/monrss4.gnumeric There are some programs that I would much rather keep open, versus shutting down and restarting all over again. But keeping them all open uses resources, especially on a 10-year-old CORE2 with 3 gigabytes of RAM (The thing refuses to die). Is there a way to forcibly swap out or freeze a specific PID, until I need to get back to it again? -- Walter Dnes I don't run "desktop environments"; I run useful applications