From mboxrd@z Thu Jan 1 00:00:00 1970 To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu> Subject: Re: [9fans] APE fork() In-reply-to: Your message of "Sat, 12 Aug 2006 12:54:08 CDT." <266517bde8dfa4628a4a566b35f304be@quanstro.net> From: Bakul Shah Date: Sat, 12 Aug 2006 11:57:04 -0700 Message-Id: <20060812185704.4F47929499@mail.bitblocks.com> Topicbox-Message-UUID: 9e1b4126-ead1-11e9-9d60-3106f5b1d025 > actually, vfork was implemted (as i understand it) due to insufficient core. IIRC, it was invented for csh. Typically a shell forks and then immediately execs a program so all that copying done by fork was a total waste of time (even setting up copy-on-write is a waste). vfork avoided copying almost entirely. csh wouldn't diddle with the parent's memory so *for that one application* the vfork hack was safe. Of course, we can't have a special syscall just for one program, can we and people used it in other programs, lured by its efficiency but not always fully understanding it. > fork used to swap the parent to disk and continue with the child process. Not necessary unless you are running on a machine with *no* mapping h/w or with memory just enough for a single process. > vfork was efficient if the child finished before it's scheduling quanta was > used up. It was efficient regardless but dangerous.