On 04/01/2010 07:32 AM, speedy wrote:
>       1. Imagine that from time to time, some background processing takes 1
>       second of CPU time - w/o multithreading, all your async operations,
>       like accepting a connection to a socket, aio or others are basically
>       stalled. So, async is a good approach, but does not work as a magic
>       wand for all problem spaces. Alternatively, you could fork and then do 
> the
>       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.

There are plenty of mechanisms/protocols for doing this.  Gearman works
extremely well for managing out-of-band jobs like this, for example.

>       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
>       that feature, which, in a sense, makes it a non-general-purpose 
> language.
>       It _could become_ a general purpouse tool, if it had proper 
> multi-threading
>       support built-in.

PHP is not a general-purpose language and there are no plans to make it
one.  Your OS provides scheduling and is responsible for making best use
of your multiple cores.  With many concurrent web requests your multiple
cores should be put to good use.

-Rasmus

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to