Reply to Multiple threads?

Your name:

Reply:


Posted by Bill Godfrey on 09/18/05 17:53

Hiya. I'm sure this question has come up on this group many times before,
but I can't find any prior discussion. (Appologies if I missed it.)

I have a PHP program looking a bit like this.

Read a load of data over the network from node 1.
Process the data.
Read a load of data over the network from node 2.
Process the data.
....
Read a load of data over the network from node n. (2<n<50)
Process the data.
Combine all the data together and report.

The time spent waiting for the remote node could be better spent processing
the data. I'd also like to make many requests at the same time, rather than
waiting for one to report before making the next request.

In short...

For each node, start a ReadAndProcess thread.
Wait for each thread to report back in the order they complete.
Once all threads have reported, sort, combine and report.

How do PHP developers do this please?

(If I were using C#, I'd create and start a Thread for each node. The main
thread would then enter a Monitor.Wait state as each worker thread
performed a Monitor.Pulse on completion, leaving data in a shared object.)

Bill, context switch!

--
http://billpg.me.uk/ usenet(at)billpg(dot)me(dot)uk

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация