Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:47786 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 15430 invoked from network); 5 Apr 2010 09:46:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Apr 2010 09:46:48 -0000 Authentication-Results: pb1.pair.com header.from=mozo@mozo.jp; sender-id=permerror Authentication-Results: pb1.pair.com smtp.mail=mozo@mozo.jp; spf=permerror; sender-id=permerror Received-SPF: error (pb1.pair.com: domain mozo.jp from 209.85.221.191 cause and error) X-PHP-List-Original-Sender: mozo@mozo.jp X-Host-Fingerprint: 209.85.221.191 mail-qy0-f191.google.com Received: from [209.85.221.191] ([209.85.221.191:51692] helo=mail-qy0-f191.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F0/C6-06298-581B9BB4 for ; Mon, 05 Apr 2010 05:46:47 -0400 Received: by qyk29 with SMTP id 29so4081624qyk.2 for ; Mon, 05 Apr 2010 02:46:42 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.99.196 with HTTP; Mon, 5 Apr 2010 02:46:22 -0700 (PDT) In-Reply-To: <1941231697.20100401163215@gmail.com> References: <1941231697.20100401163215@gmail.com> Date: Mon, 5 Apr 2010 18:46:22 +0900 Received: by 10.229.188.212 with SMTP id db20mr7814932qcb.5.1270460802216; Mon, 05 Apr 2010 02:46:42 -0700 (PDT) Message-ID: To: internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] php and multithreading (additional arguments) From: mozo@mozo.jp (Moriyoshi Koizumi) I used to play with TSRM days ago and successfully implemented userland threading support using GNU Pth. It's just a proof of concept and I did it for fun. If interested, check out http://github.com/moriyoshi/php-src/tree/PHP_5_3-threading/ and read http://github.com/moriyoshi/php-src/blob/PHP_5_3-threading/ext/threadi= ng/README for detail (not much information though). Also note that the language syntax was extended there so it would support golang-like message passing. Moriyoshi On Thu, Apr 1, 2010 at 11:32 PM, speedy wrote: > Hello PHP folks, > > =A0 =A0 =A0I've seen this discussed previously, and would like to add a f= ew > =A0 =A0 =A0arguments for the multi-threading side vs. async processing, > =A0 =A0 =A0which I've seen mentioned as a viable alternative: > > =A0 =A0 =A01. Imagine that from time to time, some background processing = takes 1 > =A0 =A0 =A0second of CPU time - w/o multithreading, all your async operat= ions, > =A0 =A0 =A0like accepting a connection to a socket, aio or others are bas= ically > =A0 =A0 =A0stalled. So, async is a good approach, but does not work as a = magic > =A0 =A0 =A0wand for all problem spaces. Alternatively, you could fork and= then do the > =A0 =A0 =A0processing, but then the state syncing of the forked backgroun= d processing > =A0 =A0 =A0results with the main thread requires a whole new protocol / s= witching to > =A0 =A0 =A0interprocess communication, which makes such developments unne= cessarily > =A0 =A0 =A0hard. Threads exist for a _reason_ not only because they sound= cool. > > =A0 =A0 =A02. Without thread support, it is not possible to use multi-cor= e processing > =A0 =A0 =A0paradigms directly from PHP - which means PHP relies on extern= al frameworks for > =A0 =A0 =A0that feature, which, in a sense, makes it a non-general-purpos= e language. > =A0 =A0 =A0It _could become_ a general purpouse tool, if it had proper mu= lti-threading > =A0 =A0 =A0support built-in. > > =A0 =A0 =A0I, personally, considered developing websockets / nanoserv ser= ver stack with PHP > =A0 =A0 =A0and bumped into the multithreading limitation - AFAIK it is th= e only big feature > =A0 =A0 =A0separating PHP from the general purpouse languages. Everything= else is well > =A0 =A0 =A0integrated with lots of external libraries/modules giving rise= to potential rapid > =A0 =A0 =A0application development while using it. > > =A0 =A0 =A0Cheers and let me know about your thoughts, and potential core= implementation > =A0 =A0 =A0issues regarding developing this language feature. > > -- > Best regards, > =A0speedy =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0mailto:speed= y.spam@gmail.com > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > >