Re: is it possible to create an orphaned process?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 05Sep2008 19:40, Konstantin Svist <fry.kun@xxxxxxxxx> wrote:
| I have an odd application that has threads which hang around until all
| child processes have finished executing.
| I'd like to create a background process that isn't a child of said
| thread, so that the thread can exit.

Fork twice when you make the children. The immediate child should exit.
The grandchild should exec your "child" process. Since its parent exited
(the imediate child) it becomes inherited by init. Your main process
will be fine.

However, I would dig a bit into why the threads hang around (if you
have the source, or can play with strace and lsof). Why? Because it is
possible for a process to have children unknowingly. Like this:

  sleep 3600 &          # makes "sleep" a child of the current process
  exec your-app ...     # now you app has "sleep" as a child

Provided you started the app itself as a child (no "exec") you're fine.
Just something to keep in mind.

Cheers,
-- 
Cameron Simpson <cs@xxxxxxxxxx> DoD#743
http://www.cskk.ezoshosting.com/cs/

There's no trick to being a humorist when you have the whole government
working for you.        - Will Rogers

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux