On 10/31/12 1:58 AM, Florian Müller wrote:
Hi guys I was wondering, what actually the reason is that PHP itself does not support multi-threading? I guess this would be realizable, or not? If not, why? Maybe this is a stupid question, but still somehow interesting. Realization in a way as Java does (or just something in that way) would actually be a very nice thing, don't you think? Thank you for your answers :) Florian
PHP is by design a shared-nothing architecture. What's happening in one process/request cannot impact what's in another request. They may both write out to the same external service (DB, memcache, etc.), but they do not interact. That makes the program much much simpler, since you don't need to worry about state synchronization. It also means you can scale up by just adding more servers, because you don't need to deal with "oh, now the memory isn't shared, so now what do I do?" Each PHP process could be in its own CPU core, CPU, server, or server cluster, and the code doesn't change in the slightest.
The "shared nothing" architecture is a very deliberate design decision, and is in a large part responsible for PHP's success.
--Larry Garfield -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php