Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:47708 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 36058 invoked from network); 1 Apr 2010 18:38:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Apr 2010 18:38:06 -0000 Authentication-Results: pb1.pair.com smtp.mail=stas@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=stas@zend.com; 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:37950] helo=us-mr1.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B3/C3-16887-C08E4BB4 for ; Thu, 01 Apr 2010 13:38:05 -0500 Received: from us-gw1.zend.com (us-ex1.zend.net [192.168.16.5]) by us-mr1.zend.com (Postfix) with ESMTP id DC81943CF0; Thu, 1 Apr 2010 11:37:06 -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 11:38:01 -0700 Message-ID: <4BB4E80A.3000402@zend.com> Date: Thu, 01 Apr 2010 11:38:02 -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: speedy CC: internals@lists.php.net References: <1941231697.20100401163215@gmail.com> In-Reply-To: <1941231697.20100401163215@gmail.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 01 Apr 2010 18:38:01.0598 (UTC) FILETIME=[755B09E0:01CAD1CA] Subject: Re: [PHP-DEV] php and multithreading (additional arguments) From: stas@zend.com (Stanislav Malyshev) Hi! > processing, but then the state syncing of the forked background processing > results with the main thread requires a whole new protocol / switching to > interprocess communication, which makes such developments unnecessarily > hard. Threads exist for a _reason_ not only because they sound cool. Interesting thing here threads would require (at least if they are implemented the way C, etc. threads usually work) whole new protocol of synchronization too. Just think about something: do you have shared classes/variables/etc.? If you do, how you control access to them? Hello locks and the whole can of worms! Most people that think they can program in threads actually are just pushing their luck until some complex interaction leaves their app malfunctioning in a bizarre way and them without any means to debug it. I mean, you can do it right, but it's usually harder than it looks. Share-nothing exists for a reason too :) If you don't, how it's different from forking except that you need to work 10 times as hard to keep engine guts from entangling in two "threads"? > 2. Without thread support, it is not possible to use multi-core processing > paradigms directly from PHP - which means PHP relies on external frameworks for What kinds of paradigms those are? in 90% of cases I saw if you need real multicore involvement in PHP you either doing it in a wrong place (i.e. webserver vs. backend) or doing it in a wrong language. -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com