>On 12/21/06, huy vu <[EMAIL PROTECTED]> wrote: >> Could someone tell me why one must use vfork() if one is to call exec right >> after? I am seeing e xec fails right after doing a fork() and would like to under stand why before trying vfork() >> >> Thanks, >> Huy >vfork() is not thread safe and you should not use it. fork() and >vfork() return twice, once for the parent and once for the child >process, the difference is that vfork does not clone the address space >of the parent process. Solaris unlike linux will fail if there is not >enough memory to host both the parent and the child address space.
In the case of fork(); not in the case of vfork(). (Fork() reserves all required swap; vfork() does not require additional swap because no COW faults wil happen) This is why the system calls system, popen(), etc all use vfork() underneath. Only the C library can use vfork() in a thread safe manner. Casper _______________________________________________ opensolaris-discuss mailing list [email protected]
