Ovidiu Farauanu <ovidiugabr...@gmail.com> hat am 31. Oktober 2012 um 09:59
geschrieben:
> Hello Florian,
>
> Usually you want to run a PHP script in two different environments:
> 1. inside a webserver
> 2. in a command line interface
>
> For a web application, the application server does the work for you.
> It is the server job to have a thread pool and balance it correctly.
> So you don't need threads for the same reason threads are prohibited in
> Java EE containers.
> I assume that you don't fork multiple threads for every single HTTP request
> inside a Java Servlet, for instance.
>
> When you are inside a command line usually you start processes instead of
> threads.
> And this is fully supported by PHP.

The drawback of forking is the memory overhead. With every fork you take the
same amount of memory which is not the case if you could use real threads.

> However, there are several reasons in choosing processes instead of threads.
> Several high-level programming languages are starting OS processes for
> language threads.
> But maybe this is not on our topic now.
>
> But I am wondering what do you mean by "multithreading support"?
> Do you need library functions as synchronization primitives?
> Or you are talking about something like "synchronized" keyword?

Since PHP is not threadsafe, it is not possible to run the APACHE in worker
mode, you have to use the prefork model.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to