Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Help with threading and returning results

Reply
Thread Tools

Help with threading and returning results

 
 
Sean
Guest
Posts: n/a
 
      06-28-2004
Here is the scenario:

Unix system, 100 machines in the "pool": one server, 99 clients. Main
program resides on the "server". On each of the 99 clients, there is
a daemon listening on a TCP port. In the main program (on the
server), it sends a signal out to the clients and waits for their
responses. The clients might take mili-seconds, MANY seconds, or
worst-case scenario lock up forever.

What is the best approach for the main program to wait a total of X
seconds for each of the clients responses (storing the string based
response in a hash array??) and then continuing on with the program so
as not to wait "forever" for the clients to respond?

If I "fork" them (or whatever it is I do), how do I make sure to get
their result?

Thanks for your help and any pointers,
Sean
 
Reply With Quote
 
 
 
 
Ben Morrow
Guest
Posts: n/a
 
      06-28-2004

Quoth http://www.velocityreviews.com/forums/(E-Mail Removed) (Sean):
> Here is the scenario:
>
> Unix system, 100 machines in the "pool": one server, 99 clients. Main
> program resides on the "server". On each of the 99 clients, there is
> a daemon listening on a TCP port. In the main program (on the
> server), it sends a signal out to the clients and waits for their
> responses. The clients might take mili-seconds, MANY seconds, or
> worst-case scenario lock up forever.
>
> What is the best approach for the main program to wait a total of X
> seconds for each of the clients responses (storing the string based
> response in a hash array??) and then continuing on with the program so
> as not to wait "forever" for the clients to respond?


Use select (or rather IO::Select) with a timeout. No need to
multi-{process,thread} at all.

Ben

--
The cosmos, at best, is like a rubbish heap scattered at random.
- Heraclitus
(E-Mail Removed)
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: threading in PyQt vs threading in standard library Steven Woody Python 0 01-09-2009 07:48 AM
threading in PyQt vs threading in standard library Steven Woody Python 0 01-09-2009 07:15 AM
Cooperative threading preemptive threading - a bit confused failure_to@yahoo.co.uk Java 9 12-29-2007 01:10 AM
Assistance with threading ...thread not returning c_campise@hotmail.com Perl Misc 1 04-12-2005 09:09 PM
Returning from socket.accept and threading issues. Christopher J. Bottaro Python 3 10-20-2004 04:12 PM



Advertisments