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.
Fork in linux
Re: Fork in linux
Indeed, I always wondered about that one, since UNIX ran on a very limited computer (certainly given today's standards), and to execute a program the shell had to go through a giant waste of overhead...bewing wrote: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.
JAL
Re: Fork in linux
Iirc, Minux did indeed not allow for any programs to be larger than 64KB.jnc100 wrote:As I recall, at least for 8086 Minix, that (segments) is exactly how they do it. I presume it means you can't use far pointers though.
JAL
