From: Frank van Maarseveen <frankvm@xs4all.nl>
To: Jesse Pollard <jesse@cats-chateau.net>
Cc: Torin Ford <code-monkey@qwest.net>, linux-kernel@vger.kernel.org
Subject: Re: 2.6.x Fork Problem?
Date: Fri, 13 Aug 2004 21:09:58 +0200 [thread overview]
Message-ID: <20040813190958.GB18563@janus> (raw)
In-Reply-To: <04081209262700.19998@tabby>
On Thu, Aug 12, 2004 at 09:26:27AM -0500, Jesse Pollard wrote:
> On Wednesday 11 August 2004 19:01, Torin Ford wrote:
> >
> > pid = fork();
> > switch (pid)
> > {
> > case -1:
> > blah; /* big trouble */
> > break;
> > case 0: /* Child */
> > exit(1);
> > break;
> > default: /* Parent */
> > pid2 = waitpid(pid, &status, 0);
> > if (pid2 == -1)
> > {
> > blah; /* check out errno */
> > }
> > }
>
> Yup - the parent process executed waitpid before the child process finished
> the setup. This can happen in a multi-cpu environment or even a single, if
> the scheduler puts the parent process higher than the child in the queue.
ugh! I can follow the rationale for SMP.
But wouldn't this kind of behavior actually break most real world programs?
--
Frank
next prev parent reply other threads:[~2004-08-13 19:14 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-12 0:01 2.6.x Fork Problem? Torin Ford
2004-08-12 12:08 ` Alan Cox
2004-08-12 14:26 ` Jesse Pollard
2004-08-13 19:09 ` Frank van Maarseveen [this message]
2004-08-13 19:36 ` Richard B. Johnson
2004-08-13 20:06 ` Frank van Maarseveen
2004-08-13 22:50 ` Torin Ford
2004-08-13 22:07 ` Alan Cox
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040813190958.GB18563@janus \
--to=frankvm@xs4all.nl \
--cc=code-monkey@qwest.net \
--cc=jesse@cats-chateau.net \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.