The zombie isn't waiting for its child. Like any zombie process, it stays around until its parent collects it.
You should display all the processes involved to understand what's going on, and look at the PPID as well. Use this command line:
ps -t $(tty) -O ppid,pgid
The parent of the process you're killing is cat
. What happens is that bash runs the background command cat <( sleep 100 & wait )
in a subshell. Since the only thing this subshell does is to set up some redirection and then run an external command, this subshell is replaced by the external command. Here's the rundown:
- The original bash (12126) calls
fork
to execute the background command cat <( sleep 100 & wait )
in a child (14247).
- The child (14247) calls
pipe
to create a pipe, then fork
to create a child to run the process substitution sleep 100 & wait
.
- The grandchild (14248) calls
fork
to run sleep 100
in the background. Since the grandchild isn't interactive, the background process doesn't run in a separate process group. Then the grandchild waits for sleep
to exit.
- The child (14247) calls
setpgid
(it's a background job in an interactive shell so it gets its own process group), then execve
to run cat
. (I'm a bit surprised that the process substitution isn't happening in the background process group.)
- You kill the grandchild (14248). Its parent is running
cat
, which knows nothing about any child process and has no business calling wait
. Since the grandchild's parent doesn't reap it, the grandchild stays behind as a zombie.
- Eventually,
cat
exits — either because you kill it, or because sleep
returns and closes the pipe so cat
sees the end of its input. At that point, the zombie's parent dies, so the zombie is collected by init and init reaps it.
If you change the command to
{ cat <( sleep 100 & wait ); echo done; } &
then cat
runs in a separate process, not in the child of the original bash process: the first child has to stay behind to run echo done
. In this case, if you kill the grandchild, it doesn't stay on as a zombie, because the child (which is still running bash at that point) reaps it.
See also How does linux handles zombie process and Can a zombie have orphans? Will the orphan children be disturbed by reaping the zombie?
Best Answer
I checked uname manual (man uname) and it says the following for the "-a" option:
In Ubuntu, I guess, options "-m", "-p" and "-i" (machine, processor and hardware-platform) are returning the machine architecture. For example, if you use the command
You will see:
On the other hand, if you choose all the option:
You will get the same result as:
Output:
I also executed "uname" with options "-m", "-p" and "-i" on an ARCHLINUX distro and I got a different answer:
In fact, when I asked for "uname -a" on the ARCHLINUX distro the answer was:
While when executed "uname -snrvmpio" on the ARCHLINUX distro I got: