[an error occurred while processing this directive]

HP OpenVMS Systems

ask the wizard
Content starts here

Designing DECthreads queue-based application?

» close window

The Question is:

 
I am implementing an application using  DECthreads which employs the "Boss
Worker" model.  The "Boss(es)" places tasks in a  queue and workers remove
them.  I  am currently weighing the alternatives between writing my own
queue procedures or using the PPL
$...WORK_QUEUE services. Obviously I'd prefer to use the PPL$ services,
however the documentation is somewhat scetchy..... What happens to the items
held by the  PPL$...WORK_QUE if all processes attached to the que are
terminated.  Will OpenVMS maintain t
hat queue, no matter what, until all items have been removed?  Even if the
machine has been rebooted?
Thanx for any advice.....John E. Frank
 
 


The Answer is :

 
This Wizard thinks that you are working across purposes:  using PPL work queues
(which were designed to be used to communicate between -processes-) simply to
communicate between threads is like trying to drive a nail with a sledgehammer
the size of a small truck.
 
Beyond that, the PPL library has been retired, so you may find that you have
more difficulties using it than those involving just the documentation.
 
This Wizard would recommend that you write your own queuing package.  It's a
straightforward exercise, requiring a mutex and a condition variable or two.
(Or, you can investigate using the now-obsoleted, but still available, "CMA
Library" queue package (e.g., cma_lib_queue_dequeue()) -- see an old version
of the DECthreads documentation.)  Existing routines potentially useful here
include the global section system service calls and the various RTL routines
available for (interlocked) queue management.
 
However, it sounds like perhaps you have some unstated requirements around the
lifetime of the items in the queue (such as whether they will survive process
termination or system reboot).  If this is in fact the case, then you will want
to pursue a more robust mechanism (a memory-mapped file at least, or perhaps
some sort of transaction monitor or router).
 
Related examples of global sections:
  http://www.partner.digital.com/www-swdev/pages/Home/TECH/faqs/ovms/ovms.html
 
Queue routines:
  lib$insqhi, lib$remqti, etc.

answer written or last revised on ( 20-NOV-1998 )

» close window