Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:47703 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 15095 invoked from network); 1 Apr 2010 16:03:41 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Apr 2010 16:03:41 -0000 Authentication-Results: pb1.pair.com header.from=speedy.spam@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=speedy.spam@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 72.14.220.157 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: speedy.spam@gmail.com X-Host-Fingerprint: 72.14.220.157 fg-out-1718.google.com Received: from [72.14.220.157] ([72.14.220.157:55510] helo=fg-out-1718.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 19/C3-31062-BD3C4BB4 for ; Thu, 01 Apr 2010 11:03:40 -0500 Received: by fg-out-1718.google.com with SMTP id 22so769085fge.11 for ; Thu, 01 Apr 2010 09:03:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:reply-to:x-priority :message-id:to:cc:subject:in-reply-to:references:mime-version :content-type:content-transfer-encoding; bh=jbZ7OVWObc7kjx9cZTEKz0i3r/160XMy6O63CRwtj4s=; b=spGfv0Fwvpb6M71n7e4HDzGyEY/haSsgCe1jMgROVDVT9IhKlpP24Hz0RR6TCcwO2S n1s9SqmkAHg06hEzHaox4a9rXbVnG3wFYfWLemTsViSdR9hfdU7FwsB3RkHjd+3EI1nJ Y5NVSEaivHEYR8SuexAERfpUMLcE3nAWqGQys= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:reply-to:x-priority:message-id:to:cc:subject:in-reply-to :references:mime-version:content-type:content-transfer-encoding; b=JwDVhjTxwL/vUMqjrTxVgEDA6qfhk2WDHRtKXVWP31Djlrh9L1JYXuzhRLvaMRFE9j oe1g9DIxneFevVlPK7tmjz2fDhQWyydB6htpySL99ymuImx8WZJM7SewGGrr1QoX/fcC m99TY/Umuq4xYvPOJyUJBAwm5IuKTUCOfoiIE= Received: by 10.87.53.28 with SMTP id f28mr2260432fgk.70.1270137817094; Thu, 01 Apr 2010 09:03:37 -0700 (PDT) Received: from tankgirl (cable-94-189-204-252.dynamic.sbb.rs [94.189.204.252]) by mx.google.com with ESMTPS id 12sm2918510fgg.14.2010.04.01.09.03.35 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 01 Apr 2010 09:03:35 -0700 (PDT) Date: Thu, 1 Apr 2010 18:03:11 +0200 Reply-To: speedy X-Priority: 3 (Normal) Message-ID: <19610230188.20100401180311@gmail.com> To: Rasmus Lerdorf CC: PHP Developers Mailing List In-Reply-To: <4BB4BA13.2070706@lerdorf.com> References: <1941231697.20100401163215@gmail.com> <4BB4BA13.2070706@lerdorf.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] php and multithreading (additional arguments) From: speedy.spam@gmail.com (speedy) Hello Rasmus, Thursday, April 1, 2010, 5:21:55 PM, you wrote: > On 04/01/2010 07:32 AM, speedy wrote: >> 1. Imagine that from time to time, some background processing take= s 1 >> second of CPU time - w/o multithreading, all your async operations, >> like accepting a connection to a socket, aio or others are basical= ly >> stalled. So, async is a good approach, but does not work as a magic >> wand for all problem spaces. Alternatively, you could fork and the= n do the >> processing, but then the state syncing of the forked background pr= ocessing >> results with the main thread requires a whole new protocol / switc= hing to >> interprocess communication, which makes such developments unnecess= arily >> hard. Threads exist for a _reason_ not only because they sound coo= l. > There are plenty of mechanisms/protocols for doing this. Gearman works > extremely well for managing out-of-band jobs like this, for example. Yes, but sometimes, esp. in more real-time oriented applications, state mer= ging is very hard to do - though I agree that protocols and mechanisms exist for ou= t of band processing, there are plenty of cases in which they are suboptimal. >> 2. Without thread support, it is not possible to use multi-core pr= ocessing >> paradigms directly from PHP - which means PHP relies on external f= rameworks for >> that feature, which, in a sense, makes it a non-general-purpose la= nguage. >> It _could become_ a general purpouse tool, if it had proper multi-= threading >> support built-in. > PHP is not a general-purpose language and there are no plans to make it > one. Your OS provides scheduling and is responsible for making best use > of your multiple cores. With many concurrent web requests your multiple > cores should be put to good use. Current situational facts are against that claim - with PHP delivered as a = CLI interpreter, and via that route, having more and more software applications= written outside the web serving scope/domain, PHP has spontaneously made strides in= to becoming a general purpouse tool. I think the only remaining step in that direction is to have the native multi-threading support. I plan to check out how hard would that be, and se= e how many people would be needed for developing that feature in some reasonable = time-frame. Also, keep in mind that the web is slowly shifting towards real-time commun= ication / streaming with emergence of Comet, HTML5 Web Sockets etc. There are alrea= dy many web server implementations specialising in that, and PHP is _not_ their languag= e of choice. > -Rasmus --=20 Best regards, speedy mailto:speedy.spam@gmail.com