On 2/17/2009 11:28 PM, Christian Heimes wrote:
The code implements fork() on top of the NT API, not the Win32 API.
The tcsh code implements fork on top of the Win32 API like Cygwin.
fork() is an efficient and fast op on Unix systems like Linux and BSD, because it uses a technique called copy on write (cow). I couldn't find any information if NT uses cow, too.
NT's fork (in the SUA subsystem on Vista) is copy-on-write optimized. It uses ZwCreateProcess in ntdll.dll to produce a copy-on-write clone of a process. But that is besides the point.
The fork() in tcsh does not do copy-on-write optimization, not does Cygwin's fork(). There is nothing that mandates that fork() must be implemented with copy-on-write. The raison d'etre for pthreads was the non-cow fork() implementation in Solaris. Linux originally had a non-cow fork too. Albeit slower, this version of fork is still useful.