All Questions
368
questions
0
votes
0
answers
17
views
How to avoid races with process IDs when reading /proc
As I understand it, on Linux process IDs are reused, and also the only API for a lot of process-related stuff (e.g. finding child processes of a specific process) is /proc/<pid>/....
But don't ...
1
vote
0
answers
48
views
from where the child process will get informations about other variables that are before the fork()?
in my case i have a code where there are mentioned many fork() (8 times) functions so many child processes are going to be created , so let's imagine the every fork() is related to its variable like ...
0
votes
0
answers
23
views
the process made twice, when i execute my program once
In Linux, I have just simple test code to testing process made
once or twice.
when I execute my program
program is just sleep 2seconds and print something inside for loop
sudo ./test &
the ...
0
votes
1
answer
42
views
I need to kill a process in windows but i have 2 scripts under the same process id
i've the next issue: i'm running through an url a php script, this script makes a query to mongoDb and brings a loooot of registers, this takes almost an hour to finish. To this point everything goes ...
0
votes
0
answers
9
views
Storing Process Ids for transient processes on Windows strategy?
I have a low level application that that stores process IDs (PID) for running processes on Windows, such as those belonging to connhost or svchost for example. I gather these at the start of my ...
1
vote
0
answers
52
views
How is Unix signal propagated to PGID in namespaces and what is the impact of NSpgid on process signal handling?
I'm working with Unix signal handling and trying to understand the mechanism behind signal propagation to process groups, especially in the context of Linux namespaces. When I run cat /proc/[pid]/...
0
votes
0
answers
33
views
Why does sudo kill -15 on sh and docker-compose PIDs not stop Docker containers?
I am running docker-compose up using the following command to set up my Docker containers:
sudo -E env PATH="$PATH" sh -c "docker-compose up"
When I check the processes using ps ...
0
votes
1
answer
1k
views
Get process (service) name or description from PID in linux terminal
I have multiple java applications that run on my ubuntu server, all have their *.service file and start at boot.
When I try to get the process names with top or with ls -l /proc/191358/exe the process ...
0
votes
2
answers
77
views
Why does the fork() function return the PID of the main process with a value that is 1 greater?
I tried to write my "getpid" clone because i have a school project and getpid is forbidden function. So, i wrote this code:
pid_t mini_getpid(void)
{
pid_t id;
id = fork();
...
0
votes
2
answers
95
views
does bash promise to optimize -c into plain exec in simple cases?
Consider the following invocation of bash
bash -c 'sleep 99'
Suppose I run that, and while waiting for it to finish sleeping, I run ps in another terminal. In that case, I do indeed find sleep 99 ...
1
vote
1
answer
806
views
How to wait for a non-child process?
Currently I do:
while [ -d "/proc/$PID" ]; do
sleep 1
done
Since I cannot use wait as it is a non-child process.
The problem is that sleep blocks any signal trap handlers (for example ...
0
votes
1
answer
156
views
Tail vs sleep to wait on process
Currently I do:
while [ -d "/proc/$PID" ]; do
sleep 1
done
To wait for a process to exit. If I would replace it with:
tail --pid=$PID -f /dev/null
Would that be more efficient for the ...
0
votes
0
answers
75
views
How get pid/name of process that launched this process
Process A (pid 1, name "progA") launches process B (pid 2, name "progB"). Is there a way for process B to get the pid / name of the process that launched it?
I'm working in Qt5/C++...
1
vote
1
answer
23
views
Is there any inheritance between two process with pid 50142 and 150142?
I am using a tool and monitoring its resource usage; I got this at certain point with 'top' command, the 1st and 2nd entry here with pid 50142 and 150142 respectively are the one I am interested in, ...
0
votes
3
answers
74
views
How can I store a subshell PID in a variable so that I can kill the subshell and its background process later?
So, let us say I am running a subshell with a background process as follows:
(command &)
I want to be able to store the PID of this subprocess into a bash variable so that I can kill the subshell ...