Browse thread
Threads & Fork
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Matthew Hannigan <mlh@z...> |
| Subject: | Re: [Caml-list] Threads & Fork |
On Tue, Nov 22, 2005 at 04:50:02PM +0100, Oliver Bandel wrote:
> On Tue, Nov 22, 2005 at 04:39:07PM +0100, Florian Weimer wrote:
> > * Jonathan Bryant:
> >
> > > I'm confused as to why the attached code hangs. My understanding of
> > > Unix.fork () is that it completely clones the current process, which in
> > > my understanding, clones the processes's threads as well. Apparently,
> > > though, that is not the case, because I can't join the thread in both
> > > the parent and the child.
> >
> > I can't speak for the OCaml run-time, but POSIX fork only duplicates
> > the current thread, so the new process is essentially single-threaded.
>
> I doubt that this is true.
> Unix-fork() copies a complete process.
> If the original has threads, the copy also have.
> I don't think that POSIX handles this different to old Unix API.
from the solaris10 man page for fork; note the last sentence.
A call to fork1() replicates only the
calling thread in the child process.
In Solaris 10, a call to fork() is identical to a call to
fork1(); only the calling thread is replicated in the child
process. This is the POSIX-specified behavior for fork().
--
Matt