Re: Multi-threading

From: Date: Thu, 21 Feb 2008 04:47:35 +0000
Subject: Re: Multi-threading
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-35673@lists.php.net to get a copy of this message
Felipe Ribeiro wrote:
Hello, I've been reading this list for a couple of months and I have a question that might have already been discussed here before and I haven't seen, so please apologize me. My question is if there's any intent to have multi-threading support to PHP in a future version, like PHP7. I know multi-threading is an enormous source of bugs, but I think it does offer a good support for large-scale apps considering the background processes and event-driven programming, and also allowing the apps to be self-content with no needs and no dependency of external daemons like cron. So, what's the opinion of the PHP maintainers?
Just an uninformed thought: maybe the existing TSRM framework could be leveraged to provide some simple multithreading support to the user. User threads could get their own set of engine globals, initialised in the same way that multithreaded SAPIs do it. Inter-thread communication would be handled by a small set of thread-safe transfer functions, which would copy data between distinct memory pools. Threads could be started by specifying a string or file to compile and execute in the new environment. It'd be heavyweight compared to an ordinary threaded application, but lightweight compared to multiprocessing by shelling out to subsidiary scripts via the CLI SAPI. Then incremental development could head in the direction of more efficient data transfer, oparray sharing, and support for threaded concepts like locks and worker pools. -- Tim Starling

« previous php.internals (#35673) next »