Questions tagged [process-group]

In POSIX-conformant operating systems, a process group denotes a collection of one or more processes.

In POSIX-conformant operating systems, a process group denotes a collection of one or more processes. For details please read here: http://www.cs.ucsb.edu/~almeroth/classes/W99.276/assignment1/signals.html#Pgrps

29 questions
37
votes
6 answers

How to set process group of a shell script

How to set process group of a shell script ? Also I want all the child process to be in the same process group I expect something similar to setpgid() in C.
Jacob
  • 785
  • 2
  • 10
  • 17
25
votes
1 answer

What should interactive shells do in orphaned process groups?

The short question is, what should a shell do if it is in an orphaned process group that doesn't own the tty? But I recommend reading the long question because it's amusing. Here is a fun and exciting way to turn your laptop into a portable space…
ridiculous_fish
  • 17,273
  • 1
  • 54
  • 61
20
votes
1 answer

What do the identifiers PID, PPID, SID, PGID, UID, EUID mean?

I was assigned to Write a C program that prints the following identifiers PID, PPID, SID, PGID, UID, EUID. The assignment then went on to ask What represents each identifier? I have completed the program, but have not found adequate explanations…
David Deme
  • 331
  • 1
  • 2
  • 3
10
votes
2 answers

Does Linux allow process group ids to be reassigned to processes?

Suppose pid X is a process group leader and X terminates, but other processes in the process group remain running (with X as their pgid). Will Linux prevent the value X from being assigned as a pid to a new process? I ask this because of a failure…
R.. GitHub STOP HELPING ICE
  • 208,859
  • 35
  • 376
  • 711
10
votes
3 answers

How to start a process in its own process group?

I would like to start a process in its own process group (or, alternatively, change its group once started) and: have the processes in the group respond to Ctrl + C from the terminal get the id of the process group so that I can terminate all the…
beluchin
  • 12,047
  • 4
  • 24
  • 35
7
votes
3 answers

Sending a process to the background and returning control to my shell

I am programming a shell for my CS class and part of the project involves running a process in the background if the '&' character is passed in by the user. If a process is run in the foreground, I simply execvp the process and it remains in…
user1420913
  • 367
  • 1
  • 5
  • 13
5
votes
1 answer

What is the difference between "kill 0" and "kill -‍- -$$"?

Basically I want a bash script process, upon receiving a SIGINT, to kill all of its subprocesses before exiting. I read here to use something along the lines of: trap "kill -TERM -$$ ; exit 1" INT QUIT I have also read to use kill 0: trap "kill…
Matt
  • 21,026
  • 18
  • 63
  • 115
4
votes
1 answer

Spawning a process with {create_group=True} / set_pgid hangs when starting Docker

Given a Linux system, in Haskell GHCi 8.8.3, I can run a Docker command with: System.Process> withCreateProcess (shell "docker run -it alpine sh -c \"echo hello\""){create_group=False} $ \_ _ _ pid -> waitForProcess pid hello ExitSuccess However,…
Neil Mitchell
  • 9,090
  • 1
  • 27
  • 85
4
votes
1 answer

Why a background ssh can take over the tty from Bash?

(I'm using Bash 4.4.12 on Debian 8. Question also asked in the bash mailing list.) See the following steps to reproduce the problem. From tty #1 (pts/2): [STEP 101] # tty /dev/pts/2 [STEP 102] # ssh -o ControlMaster=yes -o…
pynexj
  • 19,215
  • 5
  • 38
  • 56
4
votes
4 answers

How to get pids in one process group in Linux OS

I have one question on Linux pid things. How to get pids in one same group? It seems easy to get all pids or pgid with 'ps' command in Linux, but how to get the pids that belong to same group, or in other words, how to get the pids of one same…
dylanoo
  • 45
  • 1
  • 2
  • 6
4
votes
3 answers

Process group for child processes of a library

I'm working on a library (C++) that will be integrated into clients code. This lib will spawn a few child processes and must monitor them to respawn them as soon as they die (for any reason). I need to use vfork and exec to spawn those child…
Marcus
  • 1,675
  • 3
  • 18
  • 29
3
votes
2 answers

How to get the session id of the session associated with a terminal?

In Linux, each terminal is associated with only one session (a session has one or more process groups, and a process group has one or more processes). Is there some function (or a command) that takes a tty device file (for example: /dev/tty1 or…
user8437463
  • 357
  • 3
  • 6
3
votes
1 answer

Getting a user ID and a process group ID from a task_struct and a pid_namespace

I'm trying to modify Linux kernel and I need to get the user ID and the process group ID from a task_struct and a pid_namespace. Although I searched their definitions in the source code, I couldn't find any global variables or functions (maybe I am…
user5508821
  • 33
  • 1
  • 3
2
votes
1 answer

Conventional practice for signal handling/child processes

EDIT: If managing child processes for a shell script is really purely a matter of "opinion"......no wonder there are so many terrible shell scripts. Thanks for continuing that. I'm having trouble understanding how SIGTERM is conventionally handled…
Paul Draper
  • 78,542
  • 46
  • 206
  • 285
2
votes
1 answer

How to kill a forked child and its jackd subprocess in python

I am trying to implement a tray icon, that lets me control a process (jackd). Most notably I want to read the processes stdout and stderr for logging purposes I want to be able to kill the process from a menu entry of the main program The killing…
Martin Drautzburg
  • 5,143
  • 1
  • 27
  • 39
1
2