LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 10-03-2004, 07:26 PM   #1
Sinope
Member
 
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
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
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
Sinope
Member
 
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
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
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 ...


Cheers,
Tink
 
Old 10-05-2004, 08:32 PM   #5
Sinope
Member
 
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
Code:
init
  |-kdm---.xsession
  |               |-fluxbox---xterm---bash---vi
  |               `-xscreensaver
  `-juk
and when .xsession terminates i have:

Code:
init
  |-kdm
  `-juk
Blecch.

What I want is:
Code:
init
  `-kdm---.xsession
                  |-fluxbox
                  |-xterm--bash---vi
                  |-juk
                  `-xscreensaver
Not possible?
 
Old 10-05-2004, 09:45 PM   #6
darthtux
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
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
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.
 
  


Reply



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:00 PM.

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