Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!elroy.jpl.nasa.gov!ames!sun-barr!newstop!exodus!eng.sun.com From: david@eng.sun.com (Big Ed's Gas Farm) Newsgroups: comp.arch Subject: Re: fork() vs vfork() and COW Message-ID: <476@exodus.Eng.Sun.COM> Date: 10 Jul 90 06:00:05 GMT References: <1122@sirius.ucs.adelaide.edu.au> <3830012@hpcupt1.HP.COM> <58053@bbn.BBN.COM> Sender: news@exodus.Eng.Sun.COM Lines: 35 >While I can't claim the fork-exec with COW >is faster than vfork-exec, I claim that it is not significantly slower in >most cases... I timed a simple test program on a Sun 4/60 running SunOS 4.1 (has COW): #include #include main(argc) int argc; { int i, pid; signal(SIGCHLD, SIG_IGN); for (i = 0; i < 10000; i++) { pid = argc > 1 ? vfork() : fork(); if (pid == 0) exit(0); } } % time ./a.out (fork) 0.2u 4.3s 0:09 47% 0+140k 0+0io 0pf+0w % time ./a.out x (vfork) 0.0u 4.1s 0:04 92% 0+140k 0+0io 0pf+0w fork() seems to take twice as long as vfork() for a small process. Of course if exec() is sufficiently slow you're right, this will not be significant. -- David DiGiacomo, Sun Microsystems, Mt. View, CA david@eng.sun.com