1,719 questions
4
votes
2
answers
155
views
how to check if pid has rolled over?
I am writing a program that will periodically scan all processes on a machine. I want to cache as much as possible to avoid any system load.
I can list all available pids on a machine with ls /proc/[0-...
0
votes
1
answer
105
views
Pass a process its own process id on the command line
In shell scripting, or interactive use, I sometimes want to get the process id of a command I run, and pass that process id to the command on its own command line. Imagine:
% /bin/echo I am process $...
0
votes
0
answers
48
views
Node process keeps respawning after killing
I have a node process that was originally started with the following command line:
nohup npm run serve-prod &
The process runs on port 5003 and I can see it listed with ps as follows:
ps -ef | ...
1
vote
0
answers
24
views
psutil.children() - how does it deal with PID reuse?
Looking at the psutil's implementation of Process.children(), I see the following code:
# if child happens to be older than its parent
# (self) it means child's PID has been reused
intime = self....
1
vote
0
answers
37
views
How to Properly Stop a GNU screen Session and Ensure All Running Processes Are Killed?
I’m using GNU screen to run a service, but when I stop the session, the processes running inside it are not always terminated properly. This results in ports remaining occupied and prevents the ...
0
votes
0
answers
41
views
While running iOS build for debug getting Pid issue ...This pid numbers keep getting changes
While running iOS build for debug getting Pid issue ...This pid numbers keep getting change and build keep failing . How to resolved this , Thanks in Adv
Selected dev provision profile and trying to ...
-2
votes
1
answer
132
views
Why does launching socat with some arguments result in two processes? [closed]
Open 3 terminals, which I'll call A, B, and C, and execute the following:
socat TCP-LISTEN:12345,fork - in A,
pidof socat in B,
socat TCP-CONNECT:localhost:12345 - in C,
pidof socat again in B.
Step ...
3
votes
1
answer
111
views
Signal propagation not working between child processes in multi-process C program
I'm working on a C program that creates three processes to read and process a file:
Process 1 reads the file line by line
Process 2 counts the lines
Process 3 (main process) maintains the final ...
0
votes
0
answers
14
views
Definition of Wind Up limits for the integral term. how to express the max integral=10 cycles each iteration, min integral=0 output power
I am trying to determine the saturation of Integral Term. The goal is to determine the maximum value of integral with the maximum output power. Output power is controlles by how many cycle we send to ...
0
votes
0
answers
16
views
I have a software that will only accept input from a specific game controller and i want that to change
So I work for a company and we have just recently purchased an ROV. The controller the ROV company gave us upon purchase isnt fit for use and i want to use a different one, preferably a flight stick. ...
1
vote
1
answer
44
views
Parent pid dismatch in Minix2
I faced the following problem. I need to write a system call in the Minix2(minix204) operating system that would return the pid of the process with the biggest number of children. I managed to write ...
0
votes
0
answers
40
views
Issues with setpgid and Terminal Control in a Custom Shell Implementation
I'm working on building a custom command line interpreter in C, and I'm running into issues with process group management and terminal control when executing commands. Below is the main code I'm using:...
3
votes
1
answer
105
views
Saving $! (process ID of last background command) as an array element
I can't understand the way zsh 5.9 behaves when assigning $! to an array:
unset a b c
sleep 3 &
a=$!
b[1]=$!
c[1]=${!}
typeset -p a b c
output:
typeset a=21391
typeset -a b=( '$!' )
typeset -a ...
0
votes
1
answer
50
views
If the Linux kernel reassigns a PID, can this cause errors/UB when using C pthread mutexes?
If I'm getting it right, is it possible in the Linux pthread C API to use robust mutexes, that can be shared across processes (by placing them in shared memory), and that allows you to acquire the ...
-2
votes
3
answers
397
views
if(fork()) and if(!fork()) - how do they work?
Let's say we have the following:
pid_t pid;
pid = fork();
if(pid == 0) {
if(fork()) printf("A");
else printf("B");
printf("C");
}
else {
...
0
votes
1
answer
78
views
How do I determine thread index in its thread group from inside of the kernel?
I need, for a given thread group, to get each of its member threads sequential index to store some data about each thread from inside of the kernel, I have access to task_struct. Something like "...
2
votes
1
answer
76
views
How to get the PID of a process launched from another process with the execlp c function?
I am working with a Debian (Linux like) OS writing code in c.
I am a running process (let's call it "A") which needs to launch an executable program AND to get its PID when the new process &...
1
vote
0
answers
55
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 ...
1
vote
0
answers
49
views
Finding pid for python script B execution on a terminal using popen from python script A
I have a python script "A" that uses subprocess.Popen to launch a gnome-terminal and then executes a different python script "B" in there. I am stuck with retrieving the pid for ...
0
votes
1
answer
77
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 ...
1
vote
0
answers
138
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
1
answer
702
views
Managing Query Cancellation in TypeORM & PostgreSQL: Retrieving PID for Long-Running Request
I'm currently working on a feature in our TypeORM and PostgreSQL setup where I need to handle cancellation of long-running and time-consuming requests. For this, I believe I need to track the Process ...
0
votes
0
answers
82
views
Is it possible to get file path (not application path) from process ID using python?
I have a file saved to desktop. I can get the process ID of the file using the python code below. However, in my case, there user might need to select a particular application instance from a list of ...
-1
votes
1
answer
668
views
Difference between lsof -i :<port> & socket statistics ss -lp | grep <port>?
I'm using AWS linux / RHEL and I am trying to identify & remove zombie PIDs that are hogging ports to ensure clean start/stopping of application services.
man lsof -i : will give me the "...
2
votes
2
answers
474
views
How can I get PID(process id) of window/tab I'm currently active in Flutter windows application?
import 'dart:io'
...
print(pid);
This code print the pid of my Flutter application. But I want to get the other apps' pid when I switch on that app.
Suppose, I am now on skype app. So this print(pid) ...