Subject: Re: proposal for Linux exit_group emulation
To: Emmanuel Dreyfus <manu@NetBSD.org>
From: Jaromir Dolecek <jdolecek@NetBSD.org>
List: tech-kern
Date: 12/02/2005 14:56:26
On Thu, Dec 01, 2005 at 10:26:13PM +0000, Emmanuel Dreyfus wrote:
> Hello
>
> Please find attached a proposal for emulating Linux exit_group(). I'm not
> sur it follows The Right Way.
>
> exit_group is supposed to exit all threads of a group. We emulate Linux
> threads as processes with shared memory.
>
> In order to exit all the processes in a group:
> - I awake sleeping processes
> - I tag processes as doomed by exit_grouo
> - a test in syscall and userret checks the tag and call exit1 if nescessary.
>
> I'm not sure the test in syscall is a good idea.
It's not - that is no-starter.
Furthermore, you do not want to use PROCLIST_FOREACH(), or anything other
with O(n) characteristics. The lwps in the thread group should be connected
via a linked list, and you should only handle processes in the exiting
thread group.
I also note exit_group() is still broken in regards to group_pid
setting. It would cause exit of all threads within the process
no matter if created with CLONE_THREAD flag or not. This means
the infamous openoffice2-bin 'Killed' problem will resurface again.
This needs to be adressed, too.
Jaromir
--
Jaromir Dolecek <jdolecek@NetBSD.org> http://www.NetBSD.cz/
-=- We can walk our road together if our goals are all the same; -=-
-=- We can run alone and free if we pursue a different aim. -=-