Questions tagged [process-management]
Use this tag when the topic is about system process management. Commands used for this are like ps and kill -9 xxxx and service xyz start|stop|restart and htop, for example. Often used in conjunction with memory management.
368 questions
0 votes
0 answers
100 views
Under which conditions does the OS kill child processes when their parent exits?
I am new to Linux and attempting to understand its management of child processes. I have read that child processes do not necessarily exit when their parent does, but I have observed mostly contrary ...
1 vote
0 answers
205 views
How to wait the end of a non-child process?
I have here a not really fine app, partially out of my control. Sometimes it stops and I want to restart it, and some extra options. So, if it exists, I want to start my script. Poor man solution ...
2 votes
1 answer
151 views
Why does bash (executing the script) stay in the foreground group when executing commands in a script?
I am using the following version of the bash: GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu) When I start some command (e.g. ./hiprogram) directly from the terminal, then bash forks itself,...
0 votes
0 answers
68 views
Override GDB taking over controlling terminal and its SIGINT
I have a Python script that is running subprocesses that calls gdb --batch. That script needs to handle Control-C (SIGINT). While one of the GDB subprocesses is running, if I send a Control-C on the ...
0 votes
3 answers
144 views
Is it possible to find the complete command list to be executed in a sub-shell?
I face a situation that features Bash scripts on a Linux installation that asynchronously run system tools with a delay, via a ( sleep 10 ; some_command ) & construct. The scripts that perform ...
2 votes
1 answer
98 views
Why does the termination of the parent terminate the child when it is in the suspend (T) state?
I am using Ubuntu (linux). I have the following two simple programs. Parent: package main import ( "fmt" "syscall" "time" ) func main() { attr := &...
0 votes
0 answers
70 views
Why does sudo change process session id using setsid()?
I've been writing a script that spawns a child process as a different user via sudo then I realized that my script is not getting SIGINT as opposed to when I run it without sudo. As suspected strace ...
1 vote
1 answer
113 views
Prevent SIGINT propagation from subshell to parent shell in Zsh
I need to prevent SIGINT (Ctrl-C) from propagating from a subshell to its parent shell functions in Zsh. Here's a minimal example: function sox-record { local output="${1:-$(mktemp).wav}"...
1 vote
1 answer
266 views
A few potential race conditions with signals and PIDs
I'm aware that because of PID-reuse on Unix-like kernels, signals can be delivered to the wrong process if they are sent after the PID has already been reaped. Discussion of what follows will probably ...
2 votes
5 answers
2k views
Continuously monitor a process and all its children with `top`?
I want to run a process that spawns children, e.g., for i in {1..4}; do sh -c 'echo $$; for j in {1..3}; do sh -c "echo ...\$\$; sleep 1" done' done and I would like to monitor the ...
1 vote
1 answer
344 views
Reliably run, wait for, and kill a tree of processes
I'm looking for a way to run a process, which itself may spawn off more child / grandchild / etc. subprocesses. Then: Be able to send a signal (e.g. TERM or KILL) to all descendants. Be able to ...
1 vote
1 answer
743 views
Getting all pids in a systemd unit
I'm using the Linux Citrix client and the latest versions has a tendency to leave processes behind. I came up with a little script to kill them using old-school unix commands and it works very well. ...
1 vote
1 answer
300 views
Understanding memory limits in a systemd service: Are they per-process or combined?
I have a systemd service named vcoagent.service running on my Linux system, and I'm trying to understand how memory limits specified for the service (Memory: 300.3M (limit: 500.0M)) apply to the ...
3 votes
1 answer
446 views
Thread Name: Is /proc/pid/comm always identical to the Name: line of /proc/pid/status and the second field of /proc/pid/stat?
A Linux thread or forked process may change its name and/or its commandline as visible by ps or in the /proc filesystem. When using the python-setproctitle package, the same change occurs on /proc/pid/...
0 votes
0 answers
65 views
Why does a program launched by echoing into sh persist after parent termination?
I was looking at dmenu_run, which is the default dmenu script to launch a program, and saw this part of it that intrigued me: [..other stuff..] | dmenu | sh & So I did some testing. Prerequisites ...