Timeline for Command substitution. Spawned process name is identical to the parent one
Current License: CC BY-SA 3.0
8 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| May 8, 2016 at 19:52 | comment | added | Gilles 'SO- stop being evil' |
@Tagwint The command listed by ps changes when the process calls the execve system call to load a new program image into the existing process. When the shell launches an external program, it first calls fork to create a new process (which doesn't change the command line) and then execve (which loads code from an executable file, and at the same time changes the command line).
|
|
| May 8, 2016 at 1:50 | vote | accept | Tagwint | ||
| May 8, 2016 at 1:49 | comment | added | Tagwint | Yes, that's the point i missed - spawning is not necessarily forking. Finally got it. Thank you for making me get it. | |
| May 8, 2016 at 1:38 | comment | added | DopeGhoti |
ps -ef | sort | less is a pipeline; the processes are not forked from bash; in this cash bash is spawning entirely new processes, not forks of itself.
|
|
| May 8, 2016 at 1:32 | comment | added | Tagwint | I am afraid I am still missing the gist. When I see ps -ef output I can see children of same parent having different names. Here's my sample hastebin.com/enawowoweh.hs Following your last comment, how can i interpret that? Are they a) not new | b) not spawned | c) spawned not by fork ? | |
| May 8, 2016 at 0:54 | comment | added | DopeGhoti |
Only new processes spawned by fork() inherit the name of their parents. All processes do have a parent, which will become init if the parent dies without reaping its child.
|
|
| May 7, 2016 at 23:27 | comment | added | Tagwint | Thanks for the good reference, Does Parent-Child relation mean there's always a fork behind it? That would mean children always have parent's name (CMD in ps notation), which is apparently false. otherwise all the linux processes would be named init. Is there something bash-specific in my case? Could you explain that please? | |
| May 7, 2016 at 22:41 | history | answered | DopeGhoti | CC BY-SA 3.0 |