Subject: Re: Time sharing and fork
From: "Larry Hall (RFK Partners, Inc)" <[email-masked]>
To: Stephane Corbe <[email-masked]>, [email-masked]
Cc: [email-masked]
Date: Fri, 22 Mar 2002 10:16:27 -0500

At 10:55 AM 3/22/2002, Stephane Corbe wrote:
>Christopher Faylor wrote:
>
> > That's not guaranteed fork behavior.  If the child never started, that would
> > be a bug.
>
>As you can see in my previous post, the programm is really simple :
>a loop of printf for the child, a loop of printf for the father.
>There's no place for a bug here ...
>
> >  There is no guaranteed behavior with respect to which process is
> > scheduled after a fork on windows or linux.  If you want to serialize things
> > use one of the wait calls.
>
>I don't want serialized anything, I don't expect that the child or the father
>start at first.
>
>Just I wish that the child share the time (the cpu) with his father.
>
>On solaris the two processes run like that :
>(A is some printf from father, B is some printf from child)
>
>ABABABABABABA(end of A)B(end of B)
>
>On cygwin I have this result :
>
>AAAAAAA(end of A)BBBBBBB(end of B)

The point is you cannot guarantee either of these results (or any!) unless
you write the code to enforce a particular order.  If a particular order
is what you want and need, then you're responsible for making it happen.
Relying on undefined behavior of one implementation is non-portable.  This
is what Chris is saying.

Larry Hall                              [email-masked]
RFK Partners, Inc.                      http://www.rfk.com
838 Washington Street                   (508) 893-9779 - RFK Office
Holliston, MA 01746                     (508) 893-9889 - FAX

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/