in reply to Pinging server using multithreading concept

nagivreddy93:

Try using asynchronous I/O rather than threads--i.e., fire off multiple pings, but rather than using a blocking read to get the response, you process responses asynchronously as they arrive. Using select on an array of sockets could do the trick, or maybe you'd prefer something like POE or IO::Lambda::Socket which handle much of the mechanics for you. (Note: I've used neither POE nor IO::Lambda::Socket, so I can't further comment on them.)

...roboticus

Replies are listed 'Best First'.
Re^2: Pinging server using multithreading concept
by Illuminatus (Curate) on Nov 16, 2009 at 16:38 UTC
    I agree -- you should group your pings using select rather than use a 1-1 thread-ping model. Your thread failure is most likely due to memory issues. By default, threads are allocated a 16MB stack. 100 threads would use more than 1.6GB of memory. If you are really enamored of the thread-per-ping model, and you are using 5.10, you can set the stack size to something reasonable, like 128K (you probably don't need much if all you are doing is a simple ping).

    fnord

      one process handling the 100 theads here..how to create the multiple process in linux and how to run the same program for each process... do you have any example please help me
Re^2: Pinging server using multithreading concept
by Anonymous Monk on Nov 18, 2009 at 09:29 UTC
    We are not used socket concept here just we have used for Net::Ping module to ping the server.