Why do multiple instances of Mate-terminal have the same PID?

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

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

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.

Method 2

Trying to really answer the question “why”:

If every window were handled by a different process, you wouldn’t be able to drag-n-drop a tab from one window to another, or drop on the desktop to create a new window for that.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x