If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > DB as device control hub, bad idea?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-11-11, 18:07
DadOnTheEdge DadOnTheEdge is offline
Registered User
 
Join Date: Jul 2009
Posts: 6
DB as device control hub, bad idea?

I have been floundering for a long time with a project that is too overwhelming. I want to control instruments, over a 100 different kinds, about 10 or less at a time, with various protocols.

I was thinking that if each instrument was a small daemon that polled a DB every few seconds for a batch of commands+times they would run at, then the daemons could be accurately coordinated but still only loosely coupled and a big problem could be broken down into smaller blocks. Is this s dumb idea? Thanks for reading-Patrick
Reply With Quote
  #2 (permalink)  
Old 09-11-11, 23:51
Pat Phelan Pat Phelan is offline
Resident Curmudgeon
 
Join Date: Feb 2004
Location: In front of the computer
Posts: 12,605
A simpler (and probably more efficient) answer would be to write a scheduler daemon that would poll the database and launch the appropriate controller daemons as needed. This would simplify the design and should also drastically improve runtime performance.

-PatP
__________________
In theory, theory and practice are identical. In practice, theory and practice are unrelated.
Reply With Quote
  #3 (permalink)  
Old 09-12-11, 07:31
DadOnTheEdge DadOnTheEdge is offline
Registered User
 
Join Date: Jul 2009
Posts: 6
Thanks Pat

A scheduler would be a lot simpler but I have to have two way communication. I was thinking that since the instruments would be sending data points to the DB then they might as well read and set flags as well, such as abort, or commands + times such as at 3:26 plot.

Thanks again
Reply With Quote
  #4 (permalink)  
Old 09-12-11, 13:41
Pat Phelan Pat Phelan is offline
Resident Curmudgeon
 
Join Date: Feb 2004
Location: In front of the computer
Posts: 12,605
There is absolutely no reason why the task-specific threads can't do just that. I'm just suggesting that you create a scheduler thread that reads the schedule and all it does is start other threads with any apporpriate parameters. The worker threads do exactly one task, such as contraol a specific class of machine for a particular operation which may be a single millidsecond or multiple days, depending on the needs of that worker thread.

This is more flexible in many ways. There is only one scheduler that needs to monitor the database. The worker threads do exactly one task. Only active threads are running. If more than one of the same type of task needs to run (for example two machines doing the same task), just start two instances of that task on their own threads.

-PatP
__________________
In theory, theory and practice are identical. In practice, theory and practice are unrelated.
Reply With Quote
Reply

Tags
device control

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On