Duplication of all threads or A new process with only one thread - Embedded

This is a discussion on Duplication of all threads or A new process with only one thread - Embedded ; 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...

+ Reply to Thread
Results 1 to 7 of 7

Thread: Duplication of all threads or A new process with only one thread

  1. 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

  2. Re: Duplication of all threads or A new process with only one thread

    On May 3, 12:19*am, karthikbalaguru
    wrote:
    > 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 ?
    >

    I got the below info from http://tldp.org/FAQ/Threads-FAQ/Problems.html
    " 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

  3. Re: Duplication of all threads or A new process with only one thread


    > " 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."
    >


    OOps ?!?!

    Hence it would be impossible to spawn a new process from a multithreaded
    process.

    How would you do this ?

    -Michael


  4. Re: Duplication of all threads or A new process with only one thread

    On 4 Mai, 23:20, Michael Schnell
    wrote:
    > > " 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."

    >
    > OOps ?!?!
    >
    > Hence it would be impossible to spawn a new process from a multithreaded
    > process.
    >
    > How would you do this ?
    >
    > -Michael


    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

  5. Re: Duplication of all threads or A new process with only one thread

    Michael Schnell wrote:

    >
    >> " 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."
    >>

    >
    > OOps ?!?!
    >
    > Hence it would be impossible to spawn a new process from a
    > multithreaded process.
    >
    > How would you do this ?


    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: hexarith@jabber.org, ICQ: 134682867


  6. Re: Duplication of all threads or A new process with only one thread

    >
    > 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.


    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

  7. Re: Duplication of all threads or A new process with only one thread

    >
    > The usual way:
    >
    > fork (creates a new process with only one thread running) ->
    > execve (replaces the process image).


    Thanks. hat is how I had supposed it would be done. I was confused by
    the cited text.

    -Michael

+ Reply to Thread