Duplication of all threads or A new process with only one thread
Hi,
Will there be duplication of all threads OR a new process with only
one thread be created
for a fork call by a thread in a process ?
Thx in advans,
Karthik Balaguru
Re: Duplication of all threads or A new process with only one thread
On May 3, 12:19*am, karthikbalaguru <karthikbalagur...@gmail.com>
wrote:[color=blue]
> Hi,
>
> Will there be duplication of all threads OR a new process with only
> one thread be created
> for a fork call by a thread in a process ?
>[/color]
I got the below info from [url]http://tldp.org/FAQ/Threads-FAQ/Problems.html[/url]
" The POSIX 1c standard defines a thread calling fork() to duplicate
only the calling thread in the new process; and an execve() from a
thread would stop all threads of that process."
Thx,
Karthik Balaguru
Re: Duplication of all threads or A new process with only one thread
[color=blue]
> " The POSIX 1c standard defines a thread calling fork() to duplicate
> only the calling thread in the new process; and an execve() from a
> thread would stop all threads of that process."
>[/color]
OOps ?!?!
Hence it would be impossible to spawn a new process from a multithreaded
process.
How would you do this ?
-Michael
Re: Duplication of all threads or A new process with only one thread
On 4 Mai, 23:20, Michael Schnell <mschnell_at_bschnell_dot...@aol.com>
wrote:[color=blue][color=green]
> > " The POSIX 1c standard defines a thread calling fork() to duplicate
> > only the calling thread in the new process; and an execve() from a
> > thread would stop all threads of that process."[/color]
>
> OOps ?!?!
>
> Hence it would be impossible to spawn a new process from a multithreaded
> process.
>
> How would you do this ?
>
> -Michael[/color]
Usually, the new forked process (inheriting only one thread) is
calling execve() and not the multithreaded process that calls fork()
in one of its threads.
-- hns
Re: Duplication of all threads or A new process with only one thread
Michael Schnell wrote:
[color=blue]
>[color=green]
>> " The POSIX 1c standard defines a thread calling fork() to
>> duplicate only the calling thread in the new process; and an
>> execve() from a thread would stop all threads of that
>> process."
>>[/color]
>
> OOps ?!?!
>
> Hence it would be impossible to spawn a new process from a
> multithreaded process.
>
> How would you do this ?[/color]
The usual way:
fork (creates a new process with only one thread running) ->
execve (replaces the process image).
Wolfgang Draxinger
--
E-Mail address works, Jabber: [email]hexarith@jabber.org[/email], ICQ: 134682867
Re: Duplication of all threads or A new process with only one thread
>[color=blue]
> Usually, the new forked process (inheriting only one thread) is
> calling execve() and not the multithreaded process that calls fork()
> in one of its threads.[/color]
I see: the child created with fork is considered to be a new process and
not a thread of the parent process.
That brings up the question: how to create a new thread. But don't
bother, I'll be using the pthread library to do that for me :).
Thanks,
-Michael
Re: Duplication of all threads or A new process with only one thread
>[color=blue]
> The usual way:
>
> fork (creates a new process with only one thread running) ->
> execve (replaces the process image).[/color]
Thanks. hat is how I had supposed it would be done. I was confused by
the cited text.
-Michael