Re: Fork in linux
Posted: Wed Jul 30, 2008 12:58 pm
Of course, it's also true that fork() is really a cheap, kludgy way of creating a new process. Even without having to create an entire copy of the virtual userspace, that function has a tremendous amount of unneeded overhead. Most of the time, a fork is followed by an exec -- and all this fancy process duplication is worthless. The rest of the time, the only reason you need the fork is to make stdin/stdout pipes work properly. And even then, stdin/stdout pipes are not convenient on a GUI system, and are not often used anymore (in an absolute sense).
If you build GUI OS with a replacement for fork that makes input/output redirection work (ie. the filedescriptor table can get copied into the new process), but that doesn't copy anything else -- then you can forget about fork entirely.
If you build GUI OS with a replacement for fork that makes input/output redirection work (ie. the filedescriptor table can get copied into the new process), but that doesn't copy anything else -- then you can forget about fork entirely.