I've noticed, that all mate-terminal instances I start, be it inside a mate-terminal or via a link button, have the same PID.
For example, I got something like
$ wmctrl -lp
<omitted lines that don't matter>
0x03c0001f 1 7411 <hostname> Terminal
0x03c06b9f 1 7411 <hostname> Terminal
0x03c07349 1 7411 <hostname> Terminal
0x03c073f4 1 7411 <hostname> Terminal
0x03c0749f 1 7411 <hostname> Terminal
0x03c0754c 1 7411 <hostname> Terminal
0x03c075f9 1 7411 <hostname> Terminal
0x03c076a6 1 7411 <hostname> Terminal
0x0340000b 1 <pid1> <hostname> xeyes
0x0460000b 1 <pid2> <hostname> xeyes
which clearly shows that there are multiple Terminal windows, all with the same PID. As stated above, it didn't matter, whether or not the process was started inside a terminal or by clicking a menu bar link. Neither did it matter, whether or not I started the process in the background inside the terminal.
What is the applied rule here, or "why is this so"?
My understanding used to be that every command I start in a shell would obtain a unique PID.
Isn't it kind of impractical to have multiple terminals with the same PID?
I can't kill them individually by PID anymore.
Edit: Kernel version: 3.16.0-4-amd64
Best Answer
All the instances of Mate Terminal have the same PID because they are in fact a single process which happens to display multiple windows. Mate Terminal runs in a single process because that's the way the application is designed. When you run the command
mate-terminal
, it contacts the existing process and sends it an instruction to open a new window.As of Mate Terminal 1.8.1, you can run
mate-terminal --disable-factory
to open a new window in a new process. Beware that this option has been removed from the Gnome version in 3.10; I don't know whether the Mate developers have decided to merge that change. See Run true multiple process instances of gnome-terminal for a similar question regarding Gnome-terminal.