Results 1 to 3 of 3
  1. #1
    Join Date
    May 2012
    Posts
    1
    Rep Power
    0

    Default Regarding thread creation or thread pool for 100 tasks

    am creating a monitor application that can monitor 100-150 devices...Now to design a monitor application, I have two approaches:-
    1)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).
    2)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?

  2. #2
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,565
    Rep Power
    12

    Default Re: Regarding thread creation or thread pool for 100 tasks

    Which approach will be better?
    Code them and see? But, first, define "better".

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,188
    Rep Power
    19

    Default Re: Regarding thread creation or thread pool for 100 tasks

    Moved from Advanced Java

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Replies: 2
    Last Post: 07-19-2011, 06:01 AM
  2. need help with thread pool
    By crank6015 in forum New To Java
    Replies: 1
    Last Post: 04-03-2011, 02:47 PM
  3. How to correctly use a fixed size thread pool?
    By johann_p in forum Threads and Synchronization
    Replies: 1
    Last Post: 09-19-2010, 02:04 AM
  4. Thread Count Extends Beyond Pool
    By jvermast in forum Threads and Synchronization
    Replies: 1
    Last Post: 04-01-2010, 07:47 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •