Re: OT: fork(): parent or child should run first?

From: Lee Revell
Date: Wed Jan 11 2006 - 12:11:03 EST


On Wed, 2006-01-11 at 14:34 +0100, Roland Kuhn wrote:
> Hi Arjan!
>
> On 11 Jan 2006, at 13:51, Arjan van de Ven wrote:
>
> > you just cannot depend on which would run first, child or parent. Even
> > if linux would do it the other way around, you have no guarantee.
> > Think
> > SMP or Dual Core processors and time slices and cache misses... your
> > code just HAS to be able to cope with it. Even on solaris ;)
>
> That means that the starting of the child process needs to be
> synchronized by the application itself. I tried it once but then I
> discovered that my case was easily solved in a completely different
> way (it was a very small project). However, which one is the easiest/
> fastest way to do this synchronization? Using SysV-Semaphores? Pipes?
> Would something like this work?

How about POSIX process-shared mutexes? There's no documentation
avalable on using them with Linux (where are the NPTL man pages
already?) but they work.

Lee

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/