4 ms·
I have noticed a popular aversion to "fork", and I don't quite understand it. It uses the "copy on write" technique, and it seems very fast in my benchmarks.
by fexl 15y ago
I have noticed a popular aversion to "fork", and I don't quite understand it. It uses the "copy on write" technique, and it seems very fast in my benchmarks. For example, I have a benchmark where I can spawn 1000 or more processes right from the command line, all banging away on shared files with locking, and it all seems very fast and stable, every time. I don't even bother with pre-forking. But I do make heavy use of "Keep-Alive", with appropriate guards against abuse under heavy load. I'm a big fan of the simplicity of fork and blocking I/O, but I'm sure other people have different requirements and constraints they might want to share here.
- SaltwaterC 15y agoSpawning a new process is not the same thing as forking, but people often forget this bit. This post wasn't about forking.
- fexl 15y agoI thought that spawning a new process was the same as forking. What am I missing?
- SaltwaterC 15y agohttp://linux.die.net/man/2/fork http://linux.die.net/man/2/fork - this explains better.
- fexl 15y agoThanks, but I already know what fork does. My point is that "fork" is precisely how one spawns a new process, and there is no other way to do so.