note 68318 deleted from function.pcntl-fork by danbrown
| From: | danbrown@php.net | Date: | Tue, 10 Aug 2010 15:47:32 +0000 |
| Subject: | note 68318 deleted from function.pcntl-fork by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-171542@lists.php.net to get a copy of this message | ||
Note Submitter: Jeff
----
In response to Jon Dowland, a fork is actually not that expensive of an operation. Yes, a fork
creates a copy of the process, so you would think it would be an expensive operation, but instead
operating systems implement what is known as "copy-on-write." Instead of actually making a
copy of the data, both processes reference the same data as long as they're only reading from
it. Once a process goes to write to the data, then the child process gets its own copy of it. So,
the majority of the PHP engine would not have to be copied and thus this would not be very
expensive.