Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 10-03-2004, 07:26 PM   #1
Registered: Aug 2004
Location: Chicago
Distribution: Debian testing/unstable
Posts: 82

Rep: Reputation: 15
Parent PIDs

When I run a program, is there a way I can specify a parent PID for that program? I want all of my X programs (yammi, thunderbird, various dockapps, etc) to be parented to .xsession.
Old 10-03-2004, 07:50 PM   #2
LQ Guru
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 250Reputation: 250Reputation: 250
My first question is why? And no, well at least not that I know of. It all depends on how the program is designed to run, etc. But I'm still wondering why you'd want a parent PID for all your X related programs, etc.
Old 10-04-2004, 06:22 PM   #3
Registered: Aug 2004
Location: Chicago
Distribution: Debian testing/unstable
Posts: 82

Original Poster
Rep: Reputation: 15
Why? Because when I end my X session, I sometimes have a bunch of programs floating around still running that chew up memory and sometimes interfere with new instances.
Old 10-04-2004, 06:34 PM   #4
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 911Reputation: 911Reputation: 911Reputation: 911Reputation: 911Reputation: 911Reputation: 911Reputation: 911
And having the PPID will change that how?

If a program is written badly and goes AWOL on
exit you won't benefit from all having the same PPID
because in that situation they probably won't respond
to a kill either ...

Old 10-05-2004, 08:32 PM   #5
Registered: Aug 2004
Location: Chicago
Distribution: Debian testing/unstable
Posts: 82

Original Poster
Rep: Reputation: 15
Hmm... I thought that when a process is killed, all its child processes are killed as well. So right now i've got
  |               |-fluxbox---xterm---bash---vi
  |               `-xscreensaver
and when .xsession terminates i have:


What I want is:
Not possible?
Old 10-05-2004, 09:45 PM   #6
Senior Member
Registered: Dec 2001
Location: 35.7480 N, 95.3690 W
Distribution: Debian, Gentoo, Red Hat, Solaris
Posts: 2,070

Rep: Reputation: 47
For a process to be a child of a parent process, that parent has to spawn that process. I don't know of any way you can start a process and force it to attach itself to a parent.

I guess you could try to put everything you want to start in a ~/.xsession file to start when X does. But just starting a process once X is already started which seems to be what you want to do is not going to work.
Old 10-05-2004, 11:46 PM   #7
Senior Member
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,284

Rep: Reputation: 371Reputation: 371Reputation: 371Reputation: 371
Besides, this won't work anyhow since children are definitely not killed when their parents exit.* Instead they are "adopted" by init, which will clean them up when they exit.

* Unless, in some situations, when you get an entire process group orphaned. See section 9.10 of W. Richard Stevens Advanced Programming the Unix Environment for all the gory details.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Process and thread PIDs msriram_linux Programming 4 11-27-2004 11:43 AM
C++ and PIDs dbcoder Programming 1 07-15-2004 08:58 PM
killing pids i_is_cat Linux - Newbie 6 05-01-2003 11:07 AM
Samba multiple pids The Jesus Linux - Software 1 12-11-2002 10:46 AM
Multiple PIDs ? Si|entKey Linux - General 0 03-27-2001 11:03 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:30 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration