From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,260d88b0692fc907 X-Google-Attributes: gid1164f8,public From: Ron Natalie Subject: Re: vfork on Dec Alpha buggy? Date: 1996/12/18 Message-ID: <32B819A2.111F@sensor.com>#1/1 X-Deja-AN: 204755268 references: content-type: text/plain; charset=us-ascii organization: Sensor Systems mime-version: 1.0 newsgroups: comp.sys.dec x-mailer: Mozilla 3.0Gold (X11; I; HP-UX A.09.05 9000/755) VFORK isn't buggy on the ALPHA, it is absent entirely. An unfortunate decision on DEC's part. The reason VFORK is there at all is a kludge. Most UNIX commands do an exec shortly after the fork. Unfortunately, fork causes a complete duplication of the writable parts of the process. Berkeley added VFORK to make the fork-then-exec paradigm feature work efficiently. You were warned in the manual page to be very, very, careful with this. On machines with decent virtual memory systems, you can set up the forked process to be copy-on-access from the parent. This greatly succeeds in making the fork-then- exec efficient as only the pages that are touched prior to forking need to be copied. DEC and SGI are two of the implementations that do this and have just replaced vfork with fork. Unfortunately, another problem looms it's ugly head. Stupid swap space allocation. Many systems implement a immediate swap reservation when a process starts (fork). Now if you try to fork something trivial off from a large VM process, things may die because the OS allocates enough swap for another copy of the big process, when all that is being started is some little program. Fortunately, on the DEC you can get around this by turning on lazy swap allocation (see the description of /etc/swapdefauts in the swapon man page). However, much as I detest kludges, I wish DEC would have left VFORK well enough alone. -Ron