Re: php and multithreading (additional arguments)
| From: | Stanislav Malyshev | Date: | Thu, 01 Apr 2010 18:38:02 +0000 |
| Subject: | Re: php and multithreading (additional arguments) | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-47708@lists.php.net to get a copy of this message | ||
Hi!
processing, but then the state syncing of the forked background processing
results with the main thread requires a whole new protocol / switching to
interprocess communication, which makes such developments unnecessarily
hard. Threads exist for a _reason_ not only because they sound cool.
Interesting thing here threads would require (at least if they are implemented the way C, etc. threads usually work) whole new protocol of synchronization too. Just think about something: do you have shared classes/variables/etc.?
If you do, how you control access to them? Hello locks and the whole can of worms! Most people that think they can program in threads actually are just pushing their luck until some complex interaction leaves their app malfunctioning in a bizarre way and them without any means to debug it. I mean, you can do it right, but it's usually harder than it looks. Share-nothing exists for a reason too :)
If you don't, how it's different from forking except that you need to work 10 times as hard to keep engine guts from entangling in two "threads"?
2. Without thread support, it is not possible to use multi-core processing
paradigms directly from PHP - which means PHP relies on external frameworks for
What kinds of paradigms those are? in 90% of cases I saw if you need real multicore involvement in PHP you either doing it in a wrong place (i.e. webserver vs. backend) or doing it in a wrong language.
--
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com