On Sun, Jun 12, 2005 at 09:48:25PM -0500, Gary R. Van Sickle wrote: >>Can I just ask a basic question here? So if both ash and bash are >>using the same method of execution (fork), is the reason for bash's >>slowness due to it just being a larger program with more pages to copy >>during a fork()? > >Fork() also has to dup any and all handles/descriptors/etc, which takes >all kinds of time.
Actually most handles are just inherited. Only some of them have to be duped or recreated -- ttys and sockets are the most notable exceptions. Some close-on-exec'ed fds have to be closed, too. With the advent of the cygheap, most of the inherited information is just one large "ReadProcessMemory" with a fixups for problematic stuff like sockets. There are all sorts of other things that fork does, though, like making half-hearted attempts to load dlls in the same location in the child as they were in the parent, fixing up mmaps, maintaining a list of handles to slow pid reuse for bash (is that still needed?), etc. cgf -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/