On Feb 18, 2011 6:16 PM, "Samuel Adam" <[email protected]> wrote:
> FYI, Windows NT is documented to have light threads and heavy processes.

Windows and Unix processes and threads have similar semantics, and thus
roughly comparable performance envelopes.

> To my knowledge, it just was not designed with the goal of *nix/Plan 9/et
> al.’s more-or-less cheap and easy fork()/exec().

fork(2) is most certainly NOT light-weight, kernels having to jump through
hoops to make it perform well sometimes.  Indeed, fork(2) is evil because it
is very, very difficult (though usually not impossible) to make layered
software fork-safe.

If at all possible use posix_spawn(3C) instead of fork(2)/exec(2)!  That
interface typically uses vfork(2) under the covers, which, though evil
itself, is much less evil than fork(2) when used properly (and
posix_spawn(3C) does use vfork() correctly).  vfork() has the advantage of
having much safer semantics than fork() and also being much, much
lighter-weight.  There's no need to worry about making code safe with
respect to posix_spawn().

[forkall(2) is the most evil of that family of Unix system calls, as it is
impossible to make code forkall()-safe, and when it works it is purely
because the parent exit()s quickly enough that nothing bad happens, but even
then forkall() is an accident waiting to happen.]

Threading is difficult, though certainly not impossible, to get right.  Take
Richard's advice, avoid threading.

Nico
--
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to