Re: php and multithreading (additional arguments)
| From: | Ferenc Kovacs | Date: | Fri, 02 Apr 2010 07:15:10 +0000 |
| Subject: | Re: php and multithreading (additional arguments) | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-47732@lists.php.net to get a copy of this message | ||
On Fri, Apr 2, 2010 at 1:04 AM, Dennis Hotson <dennis.hotson@gmail.com>wrote:
> I use pcntl_fork() for writing parallel multi-process applications and it
> works pretty well.
> Also, you can use shared memory queues to pass messages between processes
> (ie msg_get_queue()).
>
> I wrote a little proof of concept library a while ago to demonstrate:
> http://github.com/dhotson/Phork
>
> It's not that complicated... the main part of it is only ~110 lines of
> code:
>
> http://github.com/dhotson/Phork/blob/master/classes/Phork/Process.php
>
> Regards,
> Dennis
>
> Yes, the pcntl_fork does exists, but there are some things that better with
threading:
* support on windows
* easier inter-process/inter-thread communication/data passing.
* threads are cheaper
Tyrael