Thank you for the explanation.

Olga

2010/7/15 Nicolas Williams <nicolas.willi...@oracle.com>:
> On Thu, Jul 15, 2010 at 12:45:54AM +0200, ольга крыжановская wrote:
>> The posix_spawn implementation in libc uses vfork. How is the POSIX
>> requirement that posix_spawn must be safe in multi threaded
>> application met if it relies on vfork which is *not* reliable in multi
>> threaded applications?
>
> vfork()/vforkx() can be used in thread-unsafe ways.  Therefore they
> marked as MT-Unsafe.
>
> They can also be used in thread-safe ways.  posix_spawn(3C) does use
> vforkx() in a thread-safe way.  How?  By not doing anything to interfere
> with the state of the parent[*] while the child is still executing in the
> borrowed address space.
>
> [*] Well, posix_spawn() does make use of stack space on the thread in
>    which it was called, but unless there's code in the parent that
>    makes use of uninitialized local variables, the parent won't be
>    affected by this.  And the function call frame of posix_spawn() may
>    be modified, but not in any way that will cause any errors in the
>    parent.
>



-- 
      ,   _                                    _   ,
     { \/`o;====-    Olga Kryzhanovska   -====;o`\/ }
.----'-/`-/     olga.kryzhanov...@gmail.com   \-`\-'----.
 `'-..-| /       http://twitter.com/fleyta     \ |-..-'`
      /\/\     Solaris/BSD//C/C++ programmer   /\/\
      `--`                                      `--`
_______________________________________________
perf-discuss mailing list
perf-discuss@opensolaris.org

Reply via email to