Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:47729 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 34824 invoked from network); 2 Apr 2010 05:16:46 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Apr 2010 05:16:46 -0000 Authentication-Results: pb1.pair.com header.from=andi@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=andi@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 63.205.162.117 as permitted sender) X-PHP-List-Original-Sender: andi@zend.com X-Host-Fingerprint: 63.205.162.117 us-mr1.zend.com Received: from [63.205.162.117] ([63.205.162.117:41157] helo=us-mr1.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 59/00-44965-BBD75BB4 for ; Fri, 02 Apr 2010 00:16:45 -0500 Received: from us-gw1.zend.com (us-ex1.zend.net [192.168.16.5]) by us-mr1.zend.com (Postfix) with ESMTP id 9273343CF0; Thu, 1 Apr 2010 22:15:46 -0700 (PDT) X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Date: Thu, 1 Apr 2010 22:16:41 -0700 Message-ID: <698DE66518E7CA45812BD18E807866CE03FA7EFF@us-ex1.zend.net> In-Reply-To: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PHP-DEV] php and multithreading (additional arguments) Thread-Index: AcrR79mW+YNyuU6LSuqYfQqp32maawAMjE+w References: <1941231697.20100401163215@gmail.com> To: "Dennis Hotson" , "speedy" Cc: Subject: RE: [PHP-DEV] php and multithreading (additional arguments) From: andi@zend.com ("Andi Gutmans") Hi, I think that if we were ever to implement threading we would be best off to enable spawning worker threads that have their own context with no shared data (and therefore no requirement for locking). We could then have a message passing API between the threads. Advantages: - Real multi-threading. - Simple straightforward approach which doesn't require a comp. sci. degree to use correctly. - Very stable implementation. You can tell by this that: a) I think GIL is not the way to go. It's more complex, not truly multi-threaded, and implementation may never be 100%. b) True multi-threading with data sharing in my opinion is a recipe for disaster. Not only because of the implementation complexities but I think it makes life very hard for the developer and requires a lot of sophistication. So if I'd implement something I'd definitely do true multi-threading with message passing (we basically already have the infrastructure with TSRM to support that). Do I think this is a high priority item? Not really but I can understand that it could add value to some. I think for some Web requests it could actually allow for some parallel processing with a rendezvous which could help reduce latency (not overall server throughput). Then again, there'd be some overhead for having a thread-safe build so I don't see this as something that would be enabled by the masses - at least not initially. Andi