This is a step-by-step tutorial to build a multithreaded daemon in PHP. I will point out several problems caused by a greedy implementation and will give some ways to solve them. I will also have a look at which functions are provided by PHP, what are their advantages and their drawbacks, and how to use them. I will finally give a working implementation of a class that would expose every functions needed to run such a daemon. The implementation will be written in PHP5.
Below are the steps of this tutorial :
- Introduction (this part)
- Why to use a daemon ?
- What is provided by PHP to handle multithreading ?
- Roots of a conceptual implementation
- The basic implementation of the multithreading class
- Limitations of the basic implementation and future work.
20 comments:
First of all thank you for this..
But where can I find sections 2-6?
Maarten
Mmh, in fact it takes me more time than planed, so the other articles are a little bit postponed :) But it motivates me to see that this series of articles has interest, so I will higher their priority !
Hi. i have a very strong need for php multi threading, and very glad to see such things implemented. i hope to use your code with php accelerator such as APC (https://www.blogger.com/comment.do), and simplepie (http://simplepie.org/) to implement consistent rss&atom parser. without your code it would require from me to learn some dot net language or java , and seek for
parser like that great simplepie.. by the way if you have an advice of how can i accelerate even more i will be very thankfull (i hope your script will work well with caching and optimization :) ). Thanks very much for your code.
Michael. thezver@gmail.com
Killerwhile: I'm interested too! Keep going :)
please, would be great go on with the next sections...
I'd be interested in seeing sections 2-6 as well. I've got a need for a system like this and wouldn't mind contributing to an open source solution.
yeah, im waiting too :)))
I'm very keen to see how this evolves! :-)
Hi, I am also interested in the tutorial, is it still in your TODO list?
greets,
Dani
fuck man, leave us dangling why dont you?
Allo Benoit,
I am interested in writing a php deamon, it's destined to run on a Linksys NSLU2 and hadle various tasks (serial I/O, USB I/O, etc.)
I am very much looking forward to your tutorials!
p.s. I hope it won't be snowing anytime soon and you're bound to strap on the ski's and go out ;)
I'm using Zend Framework with php5 cli.
I need to launch 1000 SNMP queries in parallels.
Any tips ? Does it possible to pthread lib ?
Regards
Yes, Plz continue with this artikle. I kinda need it now ;-)
Grtz Jay
Still waiting for more intresting posts!
Well, I was hoping you had finish the tutorial by now... Hope you'll get to it soon.
Are you going to finish this ?
Hey man. Too bad you didn't finish your tutorial on multithreaded daemon in php. I'm looking for such article and I was quite exited when I found your blog :)
I am building a daemon for background processing myself, so would look forward to reading this material :-)
Cross-platform PHP Multithreading Engine
http://anton.vedeshin.com/articles/lightweight-and-multiplatform-php-multithreading-engine
Yes, it would be interesting to read you.
Waiting for it. ;o)
Regards,
<?=Pampa?>
Post a Comment