in reply to Re^4: Windows System Command
in thread Windows System Command
"How is that better than fork()?
It's not better than fork(), just different. It's closer to exec(3).
For some uses, those typified by the fork&exec pattern, CreateProcess() can be said to be better. Why bother duplicating (even minimal) information and data from the current process if the next thing you are going to do is throw almost all of it away to do the exec.
For other uses, fork comes into its own. Like airplanes and helicopters, they both achieve similar goals; they just approach them from different angles.
I've often wished that WinAPI had a proper built-in fork. It wouldn't be hard to add it internally to the OS. I think the reason it doesn;t exist is more political than practical.
Hell, it's almost(*) possible using the published API's, including COW and the other subtleties, there is just a soupçon of missing functionality that prevents it being done efficiently as a third-party library.
(*)I'm aware that both cygwin (and that MS toolkit I've forgotten the name of) provide such an api, but only in the context of a POSIX(1) emulation layer and they are not (even vaguely) efficient.
|
|---|