Re: [PHP-DEV] php and multithreading (additional arguments)

2010-04-11 Thread speedy
Hello Moriyoshi, Monday, April 5, 2010, 5:57:38 PM, you wrote: > While it is based on shared-nothing approach, some kinds of resources > are shared across threads besides classes and functions that would > have already been defined before the thread creation. Maybe it would not be so hard increm

Re: [PHP-DEV] php and multithreading (additional arguments)

2010-04-11 Thread Lukas Kahwe Smith
Hi, Anyone core to summarize the thread on the wiki? can just be a couple of sentences and links to news.php.net. regardsm Lukas Kahwe Smith m...@pooteeweet.org -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] php and multithreading (additional arguments)

2010-04-05 Thread speedy
Hello Moriyoshi, Monday, April 5, 2010, 5:57:38 PM, you wrote: >> Is overhead of starting new thread large? > The cost is almost the same as when spawning a new runtime instance on > a threaded web server with TSRM enabled. If you'd pass a large data > to the subthread, then the overhead should

Re: [PHP-DEV] php and multithreading (additional arguments)

2010-04-05 Thread Moriyoshi Koizumi
On Mon, Apr 5, 2010 at 7:17 PM, Alexey Zakhlestin wrote: > > On 05.04.2010, at 13:46, Moriyoshi Koizumi wrote: > >> 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. > > So these are sh

Re: [PHP-DEV] php and multithreading (additional arguments)

2010-04-05 Thread Alexey Zakhlestin
On 05.04.2010, at 13:46, Moriyoshi Koizumi wrote: > 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. So these are share-nothing worker-threads, which can send results to "master-threa

Re: [PHP-DEV] php and multithreading (additional arguments)

2010-04-05 Thread 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

Re: [PHP-DEV] php and multithreading (additional arguments)

2010-04-02 Thread Stanislav Malyshev
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. No shared data requires quite

Re: [PHP-DEV] php and multithreading (additional arguments)

2010-04-02 Thread Eric Stewart
On Fri, Apr 2, 2010 at 1:16 AM, Andi Gutmans wrote: > 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 p

RE: [PHP-DEV] php and multithreading (additional arguments)

2010-04-02 Thread Jared Williams
> -Original Message- > From: Ferenc Kovacs [mailto:tyr...@gmail.com] > Sent: 02 April 2010 08:40 > To: Lester Caine > Cc: PHP internals > Subject: Re: [PHP-DEV] php and multithreading (additional arguments) > > On Fri, Apr 2, 2010 at 9:30 AM, Lester Caine

Re: [PHP-DEV] php and multithreading (additional arguments)

2010-04-02 Thread Ferenc Kovacs
On Fri, Apr 2, 2010 at 9:30 AM, Lester Caine wrote: > Jille Timmermans wrote: > >> Op 2-4-2010 7:16, Andi Gutmans schreef >> >>> 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

Re: [PHP-DEV] php and multithreading (additional arguments)

2010-04-02 Thread Ferenc Kovacs
On Fri, Apr 2, 2010 at 9:06 AM, Jille Timmermans wrote: > Op 2-4-2010 7:16, Andi Gutmans schreef > > 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

Re: [PHP-DEV] php and multithreading (additional arguments)

2010-04-02 Thread Lester Caine
Jille Timmermans wrote: Op 2-4-2010 7:16, Andi Gutmans schreef 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 passi

Re: [PHP-DEV] php and multithreading (additional arguments)

2010-04-02 Thread Ferenc Kovacs
On Thu, Apr 1, 2010 at 11:35 PM, Pierre Joye wrote: > On Thu, Apr 1, 2010 at 11:33 PM, Stanislav Malyshev wrote: > > 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 c

Re: [PHP-DEV] php and multithreading (additional arguments)

2010-04-02 Thread Ferenc Kovacs
On Fri, Apr 2, 2010 at 1:04 AM, Dennis Hotson wrote: > I use pcntl_fork() for writing parallel multi-process applications and it > works pretty well. > Also, you can use shared memory queues to pass messages between processes > (ie msg_get_queue()). > > I wrote a little proof of concept library a

Re: [PHP-DEV] php and multithreading (additional arguments)

2010-04-02 Thread Jille Timmermans
Op 2-4-2010 7:16, Andi Gutmans schreef 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 thread

RE: [PHP-DEV] php and multithreading (additional arguments)

2010-04-01 Thread 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-threadin

Re: [PHP-DEV] php and multithreading (additional arguments)

2010-04-01 Thread Dennis Hotson
I use pcntl_fork() for writing parallel multi-process applications and it works pretty well. Also, you can use shared memory queues to pass messages between processes (ie msg_get_queue()). I wrote a little proof of concept library a while ago to demonstrate: http://github.com/dhotson/Phork It's n

Re: [PHP-DEV] php and multithreading (additional arguments)

2010-04-01 Thread Pierre Joye
On Thu, Apr 1, 2010 at 11:33 PM, Stanislav Malyshev wrote: > 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 th

Re: [PHP-DEV] php and multithreading (additional arguments)

2010-04-01 Thread 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

Re: [PHP-DEV] php and multithreading (additional arguments)

2010-04-01 Thread speedy
Hello Antony, Thursday, April 1, 2010, 8:52:13 PM, you wrote: > Not to mention that a high-performance multi-threaded daemon written in PHP > is a total nonsense - that's exactly the task C/C++ do much better/faster. I'd like to have easily written, decently performing multi-threaded daemon. An

Re: [PHP-DEV] php and multithreading (additional arguments)

2010-04-01 Thread Ferenc Kovacs
> Anyway, do we really have to tell people "you don't need it" when they > believe that they do? > Python has multithreading and it works reasonably good. People who know > what they are doing can implement really brilliant solutions (think Tornado) > > Interesting thing here threads would require

Re: [PHP-DEV] php and multithreading (additional arguments)

2010-04-01 Thread Alexey Zakhlestin
On 01.04.2010, at 22:38, Stanislav Malyshev wrote: > 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 developm

Re: [PHP-DEV] php and multithreading (additional arguments)

2010-04-01 Thread Lester Caine
Pierre Joye wrote: are we talking about having a thread safe PHP or parallel-like features available in user land? The sooner needs some love to be actually true, while most of the issues come from external libs. The later makes little or no sense. Something we agree on Pierre. The first piec

Re: [PHP-DEV] php and multithreading (additional arguments)

2010-04-01 Thread Antony Dovgal
On 01.04.2010 22:54, Pierre Joye wrote: > are we talking about having a thread safe PHP or parallel-like > features available in user land? > > The sooner needs some love to be actually true, while most of the > issues come from external libs. The later makes little or no sense. We're talking abo

Re: [PHP-DEV] php and multithreading (additional arguments)

2010-04-01 Thread Pierre Joye
are we talking about having a thread safe PHP or parallel-like features available in user land? The sooner needs some love to be actually true, while most of the issues come from external libs. The later makes little or no sense. On Thu, Apr 1, 2010 at 8:52 PM, Antony Dovgal wrote: > On 01.04.20

Re: [PHP-DEV] php and multithreading (additional arguments)

2010-04-01 Thread Antony Dovgal
On 01.04.2010 22:38, Stanislav Malyshev wrote: > 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 bi

Re: [PHP-DEV] php and multithreading (additional arguments)

2010-04-01 Thread 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 onl

Re: [PHP-DEV] php and multithreading (additional arguments)

2010-04-01 Thread Brian Moon
Now imagine a whole web server written in PHP (ie. nanoserv), say, using libevent as the network backend, running the above described real-time web implementation. Alternatively, you could perhaps even wire it into worker/event model of apache/other servers instead of rolling your own. It sounds q

Re: [PHP-DEV] php and multithreading (additional arguments)

2010-04-01 Thread Jonah H. Harris
On Thu, Apr 1, 2010 at 12:57 PM, speedy wrote: > Now imagine a whole web server written in PHP (ie. nanoserv), say, using > libevent as the network backend, running the above described real-time web > implementation. Alternatively, you could perhaps even wire it into > worker/event > model of apa

Re: [PHP-DEV] php and multithreading (additional arguments)

2010-04-01 Thread speedy
Hello Rasmus, Thursday, April 1, 2010, 6:16:21 PM, you wrote: > In any sort of Web architecture native threading in PHP just doesn't > make any sense. Imagine a real-time websockets/HTTP based server processing architecture with quick event passing from one connection to another with possibility

Re: [PHP-DEV] php and multithreading (additional arguments)

2010-04-01 Thread Rasmus Lerdorf
On 04/01/2010 09:03 AM, speedy wrote: > Also, keep in mind that the web is slowly shifting towards real-time > communication > / streaming with emergence of Comet, HTML5 Web Sockets etc. There are already > many web > server implementations specialising in that, and PHP is _not_ their language >

Re: [PHP-DEV] php and multithreading (additional arguments)

2010-04-01 Thread 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 takes 1 >> second of CPU time - w/o multithreading, all your async operations, >> like accepting a connection to

Re: [PHP-DEV] php and multithreading (additional arguments)

2010-04-01 Thread Rasmus Lerdorf
On 04/01/2010 07:32 AM, speedy wrote: > 1. Imagine that from time to time, some background processing takes 1 > second of CPU time - w/o multithreading, all your async operations, > like accepting a connection to a socket, aio or others are basically > stalled. So, async is

[PHP-DEV] php and multithreading (additional arguments)

2010-04-01 Thread speedy
Hello PHP folks, I've seen this discussed previously, and would like to add a few arguments for the multi-threading side vs. async processing, which I've seen mentioned as a viable alternative: 1. Imagine that from time to time, some background processing takes 1 sec