RE: Multithreading for OOP PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I actually tought about just the same structures as Java uses(something in this way:
Thread t = new Thread(new Runnable() {    public void run() {        ...blabla   }}
I thought this would actually be a good benefit if PHP supported this. It's just as we sometimes use PHP for doing some big Server works (e.g. database copying or something) and it would be nice to controll by yourself which Thread (or process) does which part of the job.
For normal HTTP calls which must be handled within milliseconds, this actually does not make sense, that's right ;)

> From: ovidiugabriel@xxxxxxxxx
> Date: Wed, 31 Oct 2012 10:59:28 +0200
> To: php-general@xxxxxxxxxxxxx
> Subject:  Multithreading for OOP PHP
> 
> 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.
> 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?
> 
> 
> 
> On Wed, Oct 31, 2012 at 8:58 AM, Florian Müller <florian-mueller@xxxxxxxxxxx
> > 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
> >
> 
> 
> 
> 
> -- 
> Cu respect / Best regards,
> Dipl.-Ing. Ovidiu Farauanu
 		 	   		  

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux