9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Digby Tarvin digbyt@acm.org
Subject: [9fans] spawn() vs fork()
Date: Mon,  5 Jul 1999 14:23:27 +0100	[thread overview]
Message-ID: <19990705132327.7mhvbPUpvcym717BsNiotqxbCEEwcjxC6Mo5NhLMqwM@z> (raw)

>
>> That compromise meant that a fork() style of process creation
>> was not possible (all pointers in the child's data segment would
>> be pointing into the parents memory), so it uses a spawn() style
>> of process creation.
>
>It's not impossible: the Atari ST port of Minix managed fork() on M68000. I
>believe the solution was to swap data and stack segments during a context
>switch. This meant that anything that forked a child and then talked to it for a
>while would run like treacle. Since most processes followed a fork() with an
>exec(), it wasn't so much of a problem. All very reminiscent of vfork().
>
>Implementation requirements aside, as Jean says, fork gives you an elegant way
>of setting up I/O redirection. It also gives you an elegant way of determining
>start-up context as a whole for the new process., including internal state.
>
True. I believe Whitesmiths did something similar with a non-mmu
version of their Unix re-implementation.

But OS-9 is intended as a real-time operating system with an ability
to garnatee minimum task switch times. If you are
unwilling to enable the MMU because of the small performance hit that
produces, you certainly wouldn't want to start copying blocks of memory
around as part of task switch overhead...

I have, as a porting aid, implemented a fork() system call
on OS9. But it is not semantically identical to Unix in that
the data segment was shared between parent and child, and the
data changed by the child would effect the data of the parent.
Sort of a vfork() without the copy on write.
But it worked for most fork()/exec() sequences that commonly appear
in Unix source.

Regards,
DigbyT
--
Digby R. S. Tarvin                                              digbyt@acm.org
http://www.cthulhu.dircon.co.uk




             reply	other threads:[~1999-07-05 13:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-07-05 13:23 Digby [this message]
  -- strict thread matches above, loose matches on Subject: below --
1999-07-05  9:09 rog
1999-07-05  7:57 steve.kilbane
1999-07-03 15:22 Digby
1999-07-03 10:23 Jean
1999-07-03  9:53 Guan

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=19990705132327.7mhvbPUpvcym717BsNiotqxbCEEwcjxC6Mo5NhLMqwM@z \
    --to=9fans@9fans.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).