Path: utzoo!utgpu!watserv1!watmath!att!pacbell!pacbell.com!ucsd!swrinde!cs.utexas.edu!mailrus!bbn.com!lkaplan From: lkaplan@bbn.com (Larry Kaplan) Newsgroups: comp.arch Subject: Re: fork() vs vfork() and COW Message-ID: <58086@bbn.BBN.COM> Date: 10 Jul 90 14:41:52 GMT References: <1122@sirius.ucs.adelaide.edu.au> <3830012@hpcupt1.HP.COM> <58053@bbn.BBN.COM> <476@exodus.Eng.Sun.COM> Sender: news@bbn.com Reply-To: lkaplan@BBN.COM (Larry Kaplan) Organization: Bolt Beranek and Newman Inc., Cambridge MA Lines: 34 In article <476@exodus.Eng.Sun.COM> david@eng.sun.com (Big Ed's Gas Farm) writes: >I timed a simple test program on a Sun 4/60 running SunOS 4.1 (has COW): > > (code was presented here) > >% 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 I have some trouble with these numbers. The system times are virtually identical. In addition, calling exit() after a vfork() is not usually a good idea. Also, since the argument is fork-exec vs. vfork-exec, this timing is fairly inappropriate anyway. The proper thing would be a time call of some form before the (v)fork() call and one in the program being exec'd. Does SunOS 4.1 really have COW? Where is it documented? This would be nice to see. #include _______________________________________________________________________________ ____ \ / ____ Laurence S. Kaplan | \ 0 / | BBN Advanced Computers lkaplan@bbn.com \____|||____/ 10 Fawcett St. (617) 873-2431 /__/ | \__\ Cambridge, MA 02238