Re: How to find a father for orphans?

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

 



Hi...

It's hard to resist to not sharing ideas here...so here they come...
On 28/11/2010, Parmenides <mobile.parmenides@xxxxxxxxx> wrote:
> Hi,
>
> According to LKD 2ed, the funciton forget_origianl_parent() is used to
> find a father for orphans when their real father is being exit. The
> relavent code:

In 2.6.36, it's different now (at least, code wise, might be the same
core meaning):
http://lxr.linux.no/linux+v2.6.36/kernel/exit.c#L769

>Actually,
> a more logical seletion is that when the leader is exiting, the init
> process is chosen because there is no other threads in this group
> usually; otherwise, another thread would be the reaper because
> probably the leader exists at least. That is the condition should be
> father->exit_signal == -1. Is that so?

OK, I try to actualize the opinion to reflect current code situation.
I hope I understand your question correctly, thus not giving you
confusing answer:

based on codes in forget_original_parent() and find_new_reaper() (and
the relevant code comments too), I now believe that reparenting
orphaned children to another process in the same thread group might be
the best way to go first.

Maybe it's not optimal, but I believe there are reasons (which might
be not so obviously stated). Here are my guesses:
1.  As threads, they are sharing certain set of properties, very
likely address space. By parenting them to the other process at the
same thread group, they all would still maintain this proprety and
prevent costly memory management work further.

2. still related to #1, as group, quite likely they do collaboration.
Although there is no guarantee that they implement sophisticated
"fault tolerance" algorithm to handle "what to do when parent died"
situation, but it worth to try. By giving it a shot to the other
process in same thread group, we give them chance to automatically
solve such situation by their own.

Only if no such situation exist, reparenting to init is the best way
to do, to make sure child "continue to live". I believe this is also
done to make sure sudden process termination, thus risking some job
progress etc.

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux