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

Lee Revell
2006-01-11T17:11:56Z

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