473,405 Members | 2,262 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Multiple threads?

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
Sep 18 '05 #1
1 5174
Bill Godfrey wrote:
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!


There's no threading as far as I am aware but you can fork subprocesses:
http://www.electrictoolbox.com/artic...ocess-forking/

--
Chris Hope | www.linuxcdmall.com
Sep 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Guyon Morée | last post by:
If I have multiple threads reading from the same file, would that be a problem? if yes, how would I solve it? Let's say I want to take it a step further and start writing to 1 file form...
2
by: Joe | last post by:
Hey, I'm going to give some background on my situation in case anyone can point out a way around my problem altogether... for the problem itself, please skip to the bottom of the post. thanks....
2
by: Tumurbaatar S. | last post by:
ASP.NET QuickStart Tutorial says that: .... ASP.NET maintains a pool of HttpApplication instances over the course of a Web application's lifetime. ASP.NET automatically assigns one of these...
6
by: James Radke | last post by:
Hello, I have a multithreaded windows NT service application (vb.net 2003) that I am working on (my first one), which reads a message queue and creates multiple threads to perform the processing...
9
by: Bob Day | last post by:
VS 2003, vb.net , sql msde... I have an application with multiple threads running. Its a telephony application where each thread represents a telephone line. For code that would be the same...
5
by: Jeremy | last post by:
I have a core VB service that monitors a database, and based on data in the records will execute code to send email notifications. Problem: I don't want my main program code to halt and wait for...
2
by: Brett | last post by:
What are the advantages/disadvantages of using one process with multiple threads or doing the same task with multiple processes, each having one thread? I see using multiple threads under one...
3
by: ian_jacobsen | last post by:
First let me start by saying that this problem is not consistently reproducible. I have a windows service that creates reports for a group of entities. This service can process multiple groups at...
35
by: keerthyragavendran | last post by:
hi i'm downloading a single file using multiple threads... how can i specify a particular range of bytes alone from a single large file... for example say if i need only bytes ranging from...
16
by: WATYF | last post by:
Hi there... I have a huge text file that needs to be processed. At the moment, I'm loading it into memory in small chunks (x amount of lines) and processing it that way. I'd like the process to be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.