Questions tagged [process]
A process is an instance of a computer program that is being executed.
2,600
questions
1
vote
0
answers
21
views
Retrieving the process descriptor during syscall
In Linux, there is a per-process kernel stack that stores at the bottom of it (or top if the stack grows upwards) a small struct named thread_info, which in turn points to the task_struct of the ...
0
votes
1
answer
17
views
why nr_involuntary_switches of a process runs on an isolated cpu is constantly increasing?
I have a server (linux 4.18+intel xeon) which has isolated cpus for latency-sensitive service.
I noticed that the service process's nr_involuntary_switches is gradually increasing every a few seconds ...
0
votes
0
answers
21
views
dbus shows a registered service provided by a PID that doesn't exist?
Consider this:
> dbus-send --session --print-reply --dest=org.freedesktop.DBus / org.freedesktop.DBus.GetConnectionUnixProcessID string:org.gnome.keyring
method return time=1724158870.854936 sender=...
1
vote
1
answer
45
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 ...
3
votes
2
answers
519
views
Get GNU tar PID inside of --to-command
We have this GNU tar command as shown:
$ tar -xjf /dev/st0 --to-command='sh -c '\''printf "%s\n" "$TAR_SIZE $TAR_REALNAME" >> "$TAR_ARCHIVE.sizes.txt"'\'
Is there ...
0
votes
1
answer
38
views
How to get PID of running sh script if I run process in background there?
I wish to ping my router in background process. Also I want to control ping process as a service: start, status, stop. So, I create lock file and store PID in it. But actually PID is changing, and I ...
0
votes
1
answer
58
views
How can I make bluetoothctl quit running?
I have been experimenting with bluetoothctl and blueman. I have closed the window of blueman. I have also typed quit in bluetoothctl's command line interface. I have also run systemctl stop bluetooth. ...
0
votes
1
answer
55
views
After using the timeout command in the container of the alpine image, a dead process will be left
I ran a container using the alpine image and used timeout to run a command in it. After the timeout command ran, there is a dead process left in alpine, and I cannot kill it using the kill command. My ...
0
votes
0
answers
53
views
How to limit ram usage of a process in Linux?
Consider a Linux process that is currently running. We want to limit the amount of RAM used by this process so that it does not interfere with the operation of the system. What tools or commands can ...
0
votes
2
answers
46
views
What other channels besides /proc are there to obtain process information?
We know that process information can be obtained from the /proc directory, such as being able to see the PID of all processes, etc.
And many user commands, such as top, ps, and so on, essentially ...
0
votes
1
answer
24
views
Limiting a process to only allowed to use specified network interface
I have binary program named wstunnel.
That program has no option to specify outgoing traffic. By default it will use ens3. I expect the program will use warp interface.
I'm not sure iptables can solve ...
0
votes
1
answer
37
views
Is there a way to find out which process is writing to a file on a server with restricted permissions?
Let's say I have a file named "app.log" and I want to find out which process is writing the log, but I have restricted permissions, I have tried the following:
lsof /path/to/file, which I ...
0
votes
1
answer
51
views
FUSE filesystems look at saved UID/GID?
While attempting to create a program that reads some configuration before launching programs as a normal user and then as the root user, I noticed this odd behavior. I can't seem to find mention of it ...
0
votes
1
answer
102
views
process ID of process launched with system command
Suppose I open a shell on ubuntu OS, then open a software such as matlab via
matlab &
In the matlab GUI, I do a system command
system('/path/to/my/cppprog') % <-- PID of this running program?
...
1
vote
0
answers
33
views
Send Input to Interactive Process via File Descriptor
How can I find the file descriptor that a process reads input from?
Background
I run a Vite (pronounced veet) server when developing in an Alpine container. Currently I login to the container and ...
-3
votes
1
answer
99
views
why don't we create processes from scratch and make it a "fork", in linux? [duplicate]
why in Linux do we not create a process from scratch, as "init" is created, but create a "fork" of it by the method of branching?
0
votes
0
answers
48
views
What killed my process? No relevant entries seen via dmesg or journalctl on Rocky Linux 9.2 (Blue Onyx)
A program from a vendor gets killed instantly. I need to know why. Log shows nothing relevant. Any advice? I looked into OOM killer etc. Added tons of swap. Did not specify log in journalctl so I ...
1
vote
0
answers
41
views
mysqld thread count exceeds max_connections
As the question title suggests: I have set max_connections = 2 in my my.cnf file, but when I activate my mysql daemon, the thread count sits at 37. I am searching online but cannot find indication my ...
0
votes
1
answer
43
views
Run Additional Commands on a Specific PID
I'm completely new with Linux so forgive me if this seems like an absurd question.
I am trying to open new tabs on Firefox without a url from the terminal. So my command is:
$ firefox -new-tab -search ...
1
vote
1
answer
282
views
Capturing output from a bash function without using a subshell [closed]
I have a bash script listening on a pipe for commands. When it sees a command it runs it. However, I would like it to support the "sideloading" of bash functions that can be called at a ...
0
votes
0
answers
39
views
User space swap
I have low physical memory 1GB in my VPS container based (LXC), therefore I can't change kernel parameter such as swap memory swappiness. Even though there is swap allocated from built-in VPS when I ...
0
votes
0
answers
47
views
Prevent OOM killer inside guest in LXC
I have a python program myprogram.py. I realized that my python program is being killed due to Out Of Memory (OOM). But, I noticed also that my VPS is inside LXC and has swap 1GB, when the memory full ...
2
votes
1
answer
109
views
How to pass a parameter to a command that's being executed by exec in bash?
I'm trying to start a subprocess with a unique process name from a bash script. This works:
bash -c "exec -a MyUniqueProcessName './start_service' &"
but my problem is that I want to ...
0
votes
0
answers
19
views
Identification of processes that are not terminated by logging out
I'm trying to better understand how to terminate all undesired processes and start a Linux session fresh. By "undesired", I mean any processes left over from applications that have crashed.
...
2
votes
1
answer
180
views
When SIGTERM is received by a process, what happens to its children?
I am wondering what happens when a process receives SIGTERM and it has children spawned (e.g. JVM that has /bin/sh commands running).
Is there some sort of automatism or does the parent simply exit ...
0
votes
0
answers
39
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 ...
0
votes
1
answer
69
views
How to detect if a process runs longer than X seconds, then do something with it?
I’m on debian.
I am calling a ffmpeg process to generate a mp3. this gets called from a php script using shell_exec. This works fine 99% of the time.
Sometimes, the ffmpeg process doesn’t exit and I’m ...
0
votes
0
answers
13
views
Log PID and TCP Listen
I'm trying find, how can I log all process activites, for logging all TCP Listen syscalls. System is linux.
My main problem, I need do some logging for passive FTP connections, but with time occurence,...
0
votes
2
answers
138
views
What happens when I give the shell a "command" versus a script?
A variant of this question has been asked a few times (here and here, for instance) but I'm afraid that the answers either didn't fully capture my question here or else perhaps assumed more than I ...
0
votes
0
answers
48
views
List processes by cpu system time
I have a Node exporter up and running on my server, on my dashboard I see that my CPU time is mostly (+40%) spent in system mode which is not normal.
How can I list processes sorting them by CPU ...
1
vote
1
answer
58
views
Count the total processes spawned using /proc/loadavg
In a Red Hat Linux 8 operating system, I examined the output of cat /proc/loadavg and obtained "5.20 5.78 8.04 16/1596 1954863".
After 4 minutes, I rechecked the /proc/loadavg output and ...
1
vote
3
answers
96
views
is there a way to allow only a single proccess to delete a file?
Is there a way to allow only a single main process to delete an original file?
Other processes may read and modify it, but not delete. I know a process can empty its contents but there is no problem ...
0
votes
1
answer
27
views
When does a hup signal affect the parent process? [duplicate]
If I run ./script.sh &, where script is the following:
#!/bin/bash
echo "hello"
sleep 30
echo "hello again"
sleep 30
touch /root/foo.txt
Then I use ps au, to identify the &...
1
vote
3
answers
202
views
start multiple terminal windows in a "process group" so that remaining processes can be killed, if any one of the processes terminates
I have a script which starts 3 terminal emulator windows:
#!/bin/sh
terminator --role='terminator-left' 2>/dev/null &
sleep 0.1
terminator --role='terminator-center' 2>/dev/null &
sleep ...
0
votes
1
answer
146
views
How to get PID of last process run from bash script?
I am trying to get the process ID of the last executed command from within a bash script. Normally I would do:
$ nohup ./test > nhout &
nohup: redirecting stderr to stdout
$ echo $!
3006196 #...
1
vote
1
answer
269
views
How do I configure auditd to print the ppid name, not just the ppid?
OS is Debian. I have set up auditd to try and determine what is rebooting a system.
I have the following rule:
-a exit,always -F arch=b64 -S execve -F path=/bin/systemctl -k debug_test
Creating a ...
1
vote
2
answers
325
views
System calls involved in stack and heap allocation
In the process address space, there is the stack and the heap. When a function is called, or even when a local variable is declared, it uses the stack; the kernel must assign physical address and ...
0
votes
1
answer
43
views
Is there a maximum number of group process ID?
The following post What is the maximum value of the Process ID? mentions how to get the maximum value for a process ID.
Is the maximum value for a group process ID similar? Or is there another file to ...
0
votes
2
answers
225
views
How to make command `id` print different real and effective UID in Ubuntu
The info page of command id states that it will output the effective user ID if different from the real user ID. I have been trying to achieve that somehow, running the command with the Bash shell as ...
0
votes
0
answers
29
views
why does ZSH pass # and arguments following to process? [duplicate]
I did some experimenting and:
alex.mills@alex wss % node /Users/alex.mills/codes/vibeirl/wss/scripts/arg-test.js -v a # 3
[
'/Users/alex.mills/.nodenv/versions/14.17.0/bin/node',
'/Users/alex....
0
votes
0
answers
36
views
pgrep returns correct results only for partial script name [duplicate]
I have a script called synchronize_dirs.sh which just wraps a call to sleep:
-bash-4.2$ cat synchronize_dirs.sh
#!/bin/bash
sleep 60
-bash-4.2$
What's confusing to me is the behavior of pgrep in the ...
1
vote
1
answer
42
views
Discover the PID of a child process before it starts or after it finished
I wrote a shell script to start a program ${programName}.
This program happens to creates temporary work files in a folder, <workFolderLocation>/SAS_work<randomHex>00<pidHex>_<...
0
votes
0
answers
51
views
How to run a process in the background using a bash script? [duplicate]
When I run the command in the terminal: sudo badvpn-tun2socks --tundev tun0 --netif-ipaddr 10.0.0.2 --netif-netmask 255.255.255.0 --socks-server-addr 127.0.0.1:8080 I get a terminal with packet data ...
1
vote
1
answer
213
views
Process appears with square brackets ([]) around name after being SIGKILL'd
I am executing and killing a process as follows:
python some_script.py &; pid=$!; sleep 5; kill -9 $!; ps -o pid,sid,uid,state,start,command
In other words: I execute a script in the background, ...
0
votes
0
answers
133
views
How to reown a process?
when i run this script with a shortcut(sxhkd):
#!/bin/sh
MUSIC_DIR="$HOME/music"
songs=$(ls "$MUSIC_DIR")
filename=$( echo -e "random\n$songs" | dmenu -l 30 -i -p &...
0
votes
0
answers
362
views
How to catch the memory leakage of a process in Linux?
I am working on an embedded Linux system (kernel-5.24.0), where is 128MB RAM in it.
Now I found a process has memory leakage (from the free and available output of free -k), and I am trying to figure ...
0
votes
1
answer
144
views
Is the information read in /proc/*pid*/stat updated by a timer interrupt?
As documented in https://www.kernel.org/doc/Documentation/cpu-load.txt the information in the pseudo file /proc/stat is updated by a timer interrupt, which means that /proc/stat may not give a ...
0
votes
1
answer
65
views
why ulimit restriction is affect by other processes?
I have some processes creating large amount of threads (using python ray module), like 32 (proc) * 120 (thread per proc).
Then I found other processes would fail on creating threads while their nTH is ...
1
vote
1
answer
2k
views
trying to make my own shell handle ctrl+c properly
I am trying to understand how shells are set up so that the programs they are running receive the SIGINT when you press ctrl C but the shell doesn't, because when you are running bash, and run another ...
1
vote
1
answer
449
views
Where does the signal that causes EINTR come from?
I Understand that EINTR is an error which so-called interruptible system calls may return. My question is where does the signal that causes EINTR come from?
I faced this quite often when using fnctl ...