Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:35673 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 52071 invoked by uid 1010); 21 Feb 2008 04:47:45 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 52056 invoked from network); 21 Feb 2008 04:47:45 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Feb 2008 04:47:45 -0000 Authentication-Results: pb1.pair.com smtp.mail=tstarling@wikimedia.org; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=tstarling@wikimedia.org; sender-id=unknown Received-SPF: error (pb1.pair.com: domain wikimedia.org from 66.111.4.27 cause and error) X-PHP-List-Original-Sender: tstarling@wikimedia.org X-Host-Fingerprint: 66.111.4.27 out3.smtp.messagingengine.com Received: from [66.111.4.27] ([66.111.4.27:54416] helo=out3.smtp.messagingengine.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 56/95-30965-F620DB74 for ; Wed, 20 Feb 2008 23:47:45 -0500 Received: from compute2.internal (compute2.internal [10.202.2.42]) by out1.messagingengine.com (Postfix) with ESMTP id 498A992B5B for ; Wed, 20 Feb 2008 23:47:41 -0500 (EST) Received: from heartbeat1.messagingengine.com ([10.202.2.160]) by compute2.internal (MEProxy); Wed, 20 Feb 2008 23:47:41 -0500 X-Sasl-enc: YZYR899nrfuM8KXb7tNXzaQ0ltQj06Vvvw+9Y8XBYQaL 1203569260 Received: from [192.168.0.2] (CPE-121-209-187-75.nsw.bigpond.net.au [121.209.187.75]) by mail.messagingengine.com (Postfix) with ESMTPSA id 80044BA20 for ; Wed, 20 Feb 2008 23:47:40 -0500 (EST) Message-ID: <47BD0267.3050809@wikimedia.org> Date: Thu, 21 Feb 2008 15:47:35 +1100 User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: internals@lists.php.net References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Multi-threading From: tstarling@wikimedia.org (Tim Starling) 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