Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:47724 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 87524 invoked from network); 1 Apr 2010 21:34:03 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Apr 2010 21:34:03 -0000 Authentication-Results: pb1.pair.com header.from=stas@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=stas@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: stas@zend.com X-Host-Fingerprint: 63.205.162.117 us-mr1.zend.com Received: from [63.205.162.117] ([63.205.162.117:36221] helo=us-mr1.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CE/39-44965-84115BB4 for ; Thu, 01 Apr 2010 16:34:02 -0500 Received: from us-gw1.zend.com (us-ex1.zend.net [192.168.16.5]) by us-mr1.zend.com (Postfix) with ESMTP id 60EC843CF0; Thu, 1 Apr 2010 14:33:03 -0700 (PDT) Received: from [192.168.16.93] ([192.168.16.93]) by us-gw1.zend.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 1 Apr 2010 14:33:58 -0700 Message-ID: <4BB51147.9060009@zend.com> Date: Thu, 01 Apr 2010 14:33:59 -0700 Organization: Zend Technologies User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.9) Gecko/20100317 Lightning/1.0b1 Thunderbird/3.0.4 MIME-Version: 1.0 To: Ferenc Kovacs CC: Alexey Zakhlestin , speedy , internals@lists.php.net References: <1941231697.20100401163215@gmail.com> <4BB4E80A.3000402@zend.com> <5BAD9F0C-858B-4DE5-9303-C1FF08F19C65@gmail.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 01 Apr 2010 21:33:58.0166 (UTC) FILETIME=[098F7B60:01CAD1E3] Subject: Re: [PHP-DEV] php and multithreading (additional arguments) From: stas@zend.com (Stanislav Malyshev) Hi! > Eve Online in Stackless Python > fmspy.org with stackless python > etc. I don't know how python does it but PHP has a lot of global context, and sharing this global context between threads, whatever they are (OS threads, user-space threads, etc.) would be massively complex thing tp manage either for the engine or for the user. > And something like GIL feels like a reasonable compromise to me. GIL would mean dreams about multicore stuff are just dreams, but beyond that even with GIL, what do you do if you checked for class_exists and it didn't exist, and you're about to load it when other thread loads it before? Etc., etc. You'd have to spend a lot of time thinking about stuff like that in your code. The fact that GIL protects you from C-level context changes doesn't mean it'd protect you from PHP-level context changes, like some code using some data structure and other code changing it (on C level it'd be ok - no memory corruption, etc. - but on PHP level it might totally break your code). It's not to say it can't be done, but I didn't see yet coherent proposal for any threads implementation that had also good use cases. > I think PHP is the last from the major scripting languages on the market > without some kind of thread support. > (Cannot find a good comparsion, but Ruby, Python, Perl does some) And "keeping up with Joneses" is not a good use case. -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com