I am creating a monitor application that can monitor 100-150 devices...Now to design a monitor application, I have two approaches:-
Create a thread for each of the device to monitor and each thread will ping (Using ICMP) to device to know whether the device is online or not. These threads will run indefinately to know their status after a particular time interval (say 60 seconds).
Create a thread pool and for each device, submit a task to a thread pool. The task is simple ping to a device. So, in the current design, the tasks will be more than the threads in thread pool. For instance, say there are 100 device to monitor, there will be 100 tasks to be monitored and thread pool will have say 40 threads to complete these 100 tasks. Off course the time duration to run the next bunch of tasks will be such that to complete all the pending tasks in thread pool.
Which approach will be better?