Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-Id: <4.3.1.2.20020322101344.0226e710@pop.ma.ultranet.com> X-Sender: lhall AT pop DOT ma DOT ultranet DOT com X-Mailer: QUALCOMM Windows Eudora Version 4.3.1 Date: Fri, 22 Mar 2002 10:16:27 -0500 To: Stephane Corbe , cygwin AT cygwin DOT com From: "Larry Hall (RFK Partners, Inc)" Subject: Re: Time sharing and fork Cc: al AT axlog DOT fr In-Reply-To: <3C9B53DB.8F741D81@axlog.fr> References: <3C9B1A4D DOT 32EE2167 AT axlog DOT fr> <3C9B287F DOT 8E69BB6C AT axlog DOT fr> <20020322142708 DOT GE20338 AT redhat DOT com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" 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 lhall AT rfk DOT com 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/