Multi-Threading Advice Needed



Hello,

I'm designing an application and was hoping to seek some advice on the
threading portion of the design. The application features multiple
components presenting data to the user. (Tables, graphs, etc.) At
any point, the user can refresh the data, causing the data to be
updated. Each component is presenting different information, so
having an MVC solution with a single model is not a solution. Each
component must exist as a separate model with its own data.

One or multiple components may be in focus at the point of refresh due
to the nature of the interface. It is a simple task for each
component to track whether is it on screen (active) or not. If a
component is active when the user requests a refresh, it performs work
to update the data within its model. If it isn't active, it records
that it now has a stale cache and when it gains focus, it performs a
refresh on the data held within it.

In both the circumstances, the data load must be asynchronous so that
it doesn't interfere with the graphical interface. In an ideal world,
I would have each component existing as a thread that starts each time
it needs to perform a data load. But you can't start a thread twice,
so this is not an option.

I can see two design solutions. I am seeking advice on whether my
preference is viable and whether anyone can see other solutions to the
issue.

1.) Have each component as a runnable object and have the controller
class decide which ones get executed. I would prefer to avoid this as
it puts additional logic into the controller (or an associated class)
that I would prefer to avoid.

2.) Continue to have each component as a thread, but have them all
continuous running. Then use locks to pseudo 'start' and 'stop'
them. This seems like a nice solution to me as it keeps all of the
threading logic away from the controlling class, giving a nice
separation of coding logic.

(One obvious problem with large numbers of threads is what happens if
lots of components are active and all start together, competing for
resources. The solution I have is to limited number of database
connections pooled, so if the number of active components exceeds the
safe number of concurrent components, they will wait until a pooled
connection is available.)

All help and advice offered will be greatly appreciated.

.



Relevant Pages

  • Re: Rottendog Anouncement
    ... I am a "old" electronics engineer with a BSEE from University of Florida ... I read them the first time. ... There is just so much wrong with soliciting build advice in this instance ... input from this group on product design that they must not be very good ...
    (rec.games.pinball)
  • Re: do I need more indexes?
    ... I merely reminded the poster that not everyone's advice is of equal quality. ... Each field in tReview is a rating of that criteria for a sample ... Without knowing anything about your database, I can tell you the design ... when an aggregate report was needed at year end. ...
    (microsoft.public.access.tablesdbdesign)
  • Re: do I need more indexes?
    ... not all advice you receive is of equal quality/applicability. ... Each field in tReview is a rating of that criteria for a sample ... transfer all of the data to a new design. ... when an aggregate report was needed at year end. ...
    (microsoft.public.access.tablesdbdesign)
  • Re: do I need more indexes?
    ... not all advice you receive is of equal quality/applicability. ... Each field in tReview is a rating of that criteria for a sample ... transfer all of the data to a new design. ... when an aggregate report was needed at year end. ...
    (microsoft.public.access.tablesdbdesign)
  • Re: Rottendog Anouncement
    ... I am a "old" electronics engineer with a BSEE from University of Florida ... most of our products are power driver boards that people purchase ... need to ask advice from a newsgroup, ... input from this group on product design that they must not be very good ...
    (rec.games.pinball)