Timeline for how does a process group have process id?
Current License: CC BY-SA 4.0
7 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Sep 11, 2020 at 8:44 | comment | added | Stephen Kitt |
init’s in pgid 1, not 10. Shells create their own process groups, see this answer for details; in the picture, the shell’s pgid is 10 because its pid is 10.
|
|
| Sep 11, 2020 at 8:15 | comment | added | secondimage |
thanks. Last question, we know that init process is the first process in the beginning , the shell process is a child of it. Does it mean that init process create a process group whose Id is 10, then the shell just inhertits this Id as process group, that's why the pgid of the shell is 10?
|
|
| Sep 11, 2020 at 7:26 | vote | accept | secondimage | ||
| Sep 11, 2020 at 6:55 | comment | added | Stephen Kitt |
Yes, the job in the picture is the first process in the process group. Try running (sleep 10 & sleep 10 & sleep 10) & and then pstree -p $$ to see an example; there will be a single job with four processes (a shell and the three sleeps), and the job will be identified by its first process (the shell).
|
|
| Sep 11, 2020 at 6:15 | comment | added | secondimage | thanks for your answer. So is a job also a process?Can I say the job in the picture is the first process in the process group? | |
| Sep 11, 2020 at 6:13 | vote | accept | secondimage | ||
| Sep 11, 2020 at 6:17 | |||||
| Sep 11, 2020 at 4:44 | history | answered | Stephen Kitt | CC BY-SA 4.0 |