public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [Q] why switch_exec_pids() changes thread group leader pid?
@ 2004-09-20 11:29 Kirill Korotaev
  2004-09-20 11:46 ` William Lee Irwin III
  0 siblings, 1 reply; 4+ messages in thread
From: Kirill Korotaev @ 2004-09-20 11:29 UTC (permalink / raw)
  To: linux-kernel

Hello,

I've been looking through switch_exec_pids() function and found that it 
changes thread group leader PID/TGID. Is it really a good idea to change 
  pid of the process during it's lifetime? I could understand if it was 
happenning in the context of that process, but pid changes everytime a 
thread calls do_execve().

As far as I can see, leader doesn't have to do any of detach_pid()'s. 
Instead thread should change it's PID/TGID.

Am I wrong?

Kirill


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Q] why switch_exec_pids() changes thread group leader pid?
  2004-09-20 11:29 [Q] why switch_exec_pids() changes thread group leader pid? Kirill Korotaev
@ 2004-09-20 11:46 ` William Lee Irwin III
  2004-09-20 12:07   ` Kirill Korotaev
  0 siblings, 1 reply; 4+ messages in thread
From: William Lee Irwin III @ 2004-09-20 11:46 UTC (permalink / raw)
  To: Kirill Korotaev; +Cc: linux-kernel

On Mon, Sep 20, 2004 at 03:29:47PM +0400, Kirill Korotaev wrote:
> I've been looking through switch_exec_pids() function and found that it 
> changes thread group leader PID/TGID. Is it really a good idea to change 
>  pid of the process during it's lifetime? I could understand if it was 
> happenning in the context of that process, but pid changes everytime a 
> thread calls do_execve().
> As far as I can see, leader doesn't have to do any of detach_pid()'s. 
> Instead thread should change it's PID/TGID.

It's only done when a thread that is not a thread group leader
execve()'s. This is actually pretty rare and confined to threaded
applications, so it should be almost never called.


-- wli

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Q] why switch_exec_pids() changes thread group leader pid?
  2004-09-20 11:46 ` William Lee Irwin III
@ 2004-09-20 12:07   ` Kirill Korotaev
  2004-09-20 12:24     ` William Lee Irwin III
  0 siblings, 1 reply; 4+ messages in thread
From: Kirill Korotaev @ 2004-09-20 12:07 UTC (permalink / raw)
  To: William Lee Irwin III; +Cc: linux-kernel

William Lee Irwin III wrote:
> On Mon, Sep 20, 2004 at 03:29:47PM +0400, Kirill Korotaev wrote:
> 
>>I've been looking through switch_exec_pids() function and found that it 
>>changes thread group leader PID/TGID. Is it really a good idea to change 
>> pid of the process during it's lifetime? I could understand if it was 
>>happenning in the context of that process, but pid changes everytime a 
>>thread calls do_execve().
>>As far as I can see, leader doesn't have to do any of detach_pid()'s. 
>>Instead thread should change it's PID/TGID.
> 
> 
> It's only done when a thread that is not a thread group leader
> execve()'s. This is actually pretty rare and confined to threaded
> applications, so it should be almost never called.
Heh, rare doesn't mean correct, yeah? :)

Kirill


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Q] why switch_exec_pids() changes thread group leader pid?
  2004-09-20 12:07   ` Kirill Korotaev
@ 2004-09-20 12:24     ` William Lee Irwin III
  0 siblings, 0 replies; 4+ messages in thread
From: William Lee Irwin III @ 2004-09-20 12:24 UTC (permalink / raw)
  To: Kirill Korotaev; +Cc: linux-kernel

On Mon, Sep 20, 2004 at 03:29:47PM +0400, Kirill Korotaev wrote:
>>> I've been looking through switch_exec_pids() function and found that it 
>>> changes thread group leader PID/TGID. Is it really a good idea to change 
>>> pid of the process during it's lifetime? I could understand if it was 
>>> happenning in the context of that process, but pid changes everytime a 
>>> thread calls do_execve().
>>> As far as I can see, leader doesn't have to do any of detach_pid()'s. 
>>> Instead thread should change it's PID/TGID.

William Lee Irwin III wrote:
>> It's only done when a thread that is not a thread group leader
>> execve()'s. This is actually pretty rare and confined to threaded
>> applications, so it should be almost never called.

On Mon, Sep 20, 2004 at 04:07:33PM +0400, Kirill Korotaev wrote:
> Heh, rare doesn't mean correct, yeah? :)

The semantic it implements is that the thread calling execve() kills
all other threads of the process and assumes the identity of the thread
group leader. It should be clear that when the thread were already the
group leader, such as it is for unthreaded processes, one need only
kill the other threads, of which there are none for unthreaded
processes. I'm largely not involved with the implementation of POSIX
threading semantics, so there is some limit regarding the amount of
detail in which I can go on about it without resorting to research.

Ingo Molnar, Roland McGrath, and Ulrich Drepper will likely have more
information if you should care to question so deeply as to ask e.g.
whether this is actually faithful to whatever standard they followed.


-- wli

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-09-20 12:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-20 11:29 [Q] why switch_exec_pids() changes thread group leader pid? Kirill Korotaev
2004-09-20 11:46 ` William Lee Irwin III
2004-09-20 12:07   ` Kirill Korotaev
2004-09-20 12:24     ` William Lee Irwin III

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox