tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: RFC: import of posix_spawn GSoC results



On Mon, Dec 19, 2011 at 04:56:08PM -0500, Thor Lancelot Simon wrote:
> > I prefer a clean posix_spawn over a vfork hack any time.
> 
> What's clean about importing the VMS process model to Unix?

vfork and multi-threading don't play well with each other. Essentially
there are three options without posix_spawn:

(1) vfork without stopping all other LWPs. This kills performance for
multi-threaded servers.

(2) vfork without stopping all other LWPs. This is asking for nasty race
conditions, if both child and parent want to access a protected data
structure (malloc, anyone?).

(3) fork. This is requires cloning the pmap, which can be quite
expensive due to the IPIs involved.

posix_spawn allows the performance of vfork without the race conditions.
It's a trade off between safety, performance and orthogonality.

Joerg


Home | Main Index | Thread Index | Old Index