From: Tobias DiPasquale Date: 2001-11-27T12:32:41+09:00 Subject: [ruby-talk:26603] Re: Ruby vs. Python: Decisions, Decisions MikkelFJ wrote: > Occasionally someone makes the point that Windows is inferior because it > doesn't support a construct like fork. While Windows has its flaws, it > actually do have a process creation construct that is more elegant that just > a copy of the entire image like fork does. I just want to clear something up: the Windows method of creating processes can only be described as more elegant than fork() by someone who does not know what goes on behind the scenes in a typical fork()/execve() sequence. Please refer to any sufficiently advanced operating systems book on the concept of "copy-on-write" (_The Design and Implementation of the 4.4 BSD Operating System_ would be a great place to check this concept out), which Windows does NOT employ, and would also be the reason behind their process creation being the slowest of any operating system available today. Copy-on-write allows the fork call to copy only the VM pages that are different from parent to child into the child process being forked (thus NOT copying the pages that are shared by both; these are only copied in the event of a write by either process). This drastically reduces the time it takes to execute the execve() system call (this is the typical call made to overlay a forked process with a new binary image and start a "new" process). All modern *n*x OSs implement this (Solaris, *BSD, Linux, I think HP-UX and AIX as well, but don't quote me). Windows process creation functions do not do this, and thus have to create an entire process context and assign virtual memory "from scratch" every time a new process is created. Windows gives the developers more options in process creation, true, but at the cost of speed and memory. P.S. (At the risk of going off-list-topic) Didn't, when it first came out, Microsoft claim that Windows NT was POSIX-compliant? Which POSIX standard were they referring to? fork() is part of the POSIX.1 standard, so if NT is POSIX-compliant, shouldn't it implement that as well? -- 0100001101000010010000110100011101110101 << Tobias DiPasquale >> -=[ Solaris Systems Administrator ]=- Villanova University ECE Dept. mailto: anany@ece.vill.edu -=[ Applications Engineering Consultant ]=- BCS Solutions, Inc. mailto: tdipasquale@bcssinc.com 0100001101000010010000110100011101110101