[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference vaxaxp::vmsnotes

Title:VAX and Alpha VMS
Notice:This is a new VMSnotes, please read note 2.1
Moderator:VAXAXP::BERNARDO
Created:Wed Jan 22 1997
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:703
Total number of notes:3722

361.0. "mailbox versus Global section" by FLYWAY::GRIFFITHS (Andrew Griffiths @ZUO) Fri Mar 21 1997 02:59

I have to justify why/if we are going to use a global section instead of
VMS mailboxes for interprocess-communication. VMS mailboxes I am familiar
with, but the use of global sections I am not. Can anyone help here.
What would be useful is an example of how the global section is used/seup,
(example would help) together with pros/cons. and how the processes
    are synchronized. The purpose of the communication is to handle
    error handling: many processes writing error information 
    to a global section, and one process reading, then writing it to a
    database. My experience tells me to use VMS mailboxes because the
    synchronization is taken care of by VMS.
    
Unfortunaltely I do not have any documentation.

regards,
Andrew
T.RTitleUserPersonal
Name
DateLines
361.1Flip suggestionEVMS::WALLShow me, don't tell meFri Mar 21 1997 09:446
    
    Well, one factor might be size.  If there's a need to contain a whole
    lot of data at once, it might be better to have a global sections.
    Global sections can be enormous, particularly in the wake of V7.1
    
    DFW
361.2Copies Of Documentation Are AvailableXDELTA::HOFFMANSteve, OpenVMS EngineeringFri Mar 21 1997 10:1328
   If you have relatively small messages and relatively infrequent
   message transfers, mailboxes will work nicely -- large or frequent
   transfers would likely be better served by global sections.
   (Values of "small", "large", and "frequent" are deliberately
   vague -- these values are effectively application dependent.)

:What would be useful is an example of how the global section is used/seup...

   See TURRIS::DECC 2123.* for a standalone example of working with
   a global section.

   Synchronization of access to shared memory requires synchronization.
   It likely requires the use of interlocked instruction primitives or
   the interlocked PALcode primitives, or use of the LIB$ routines or
   language built-ins that call these primitives.  (One can also use the
   lock manager for synchronization, or one can use any of various other
   synchronization techniques.  But these primitives are among the most
   common synchronization techniques used.)

:Unfortunaltely I do not have any documentation.

   You do.  See the low-numbered notes for pointers to the bookreader
   and postscript documentation.  Please skim through the _OpenVMS
   Programming Concepts Manual_.  Synchronization techniques, as well
   as shared memory requirements are documented in that manual.  (There
   is more information there than I care to retype here...)

361.3EVMS::KUEHNELAndy K�hnelFri Mar 21 1997 12:028
    The only condition under which I would suggest to use global sections
    is if you are concerned about performance.  Mailbox I/O copies the data
    from the sending process to system space and from system space to the
    receiving process.  Using a global section, you need to copy only to
    the section.
    
    Since you mentioned that it's for error handling, I would expect that
    the events are rare and that mailboxes are just fine.
361.4AUSS::GARSONDECcharity Program OfficeSun Mar 23 1997 17:1613
    re .*
    
    And remember that neither technique can be distributed seamlessly
    across a cluster (let alone a network). If those directions are likely
    then you would want to consider the implications for your design. Yes,
    you can just replicate the error handling process, one for each system,
    and using a remote database you could still centralise your error store
    if that is desired but it's best to consider it all upfront.
    
    Adequate encapsulation of the error handling will allow a transparent
    change of implementation in the future.
    
    Mailbox will probably be easier to program than global section.
361.5thanks FLYWAY::GRIFFITHSAndrew Griffiths @ZUOMon Mar 24 1997 04:0122
Many thanks for all your replies.

It's difficult to know what sort of work load will be envisaged. 
My gut-feeling tells me to use mailbox because it is easier to program.
Also, since error informtaion is
not deemed critical (i.e. not real production data), a mailbox seems the 
way to start off. I believe OPCOM also uses mailboxes
for its error handling.

Just another thought: mailboxes can only be used for one-way 
data flow (write followed by a read);
whereas global sections can be used for sharing data: write followed
by a read, followed by another write etc. Error logging would be 
therfore be better served by a mailbox (in my opinion).

Here is a vague question. How long would
it take a programmer to reprogram the mailbox
code to use a global section instead ?? Days, weeks ??
                 
thanks once again,
Andrew
361.6"It Depends..."XDELTA::HOFFMANSteve, OpenVMS EngineeringMon Mar 24 1997 13:1617
:Here is a vague question. How long would
:it take a programmer to reprogram the mailbox
:code to use a global section instead ?? Days, weeks ??

   As you are well aware, there can be no answer to this question.

   If the programmer designs a "central communications interface" into
   the application, and keeps all code that is sending and receiving
   messages together in one or a small number of related low-level
   modules, one can implement and test and switch over to another
   transport in a couple of days.

   If the programmer scatters knowledge of the communications techniques
   and/or scatters unique-to-a-communications-medium mechanisms throughout
   the applications, the changeover could take weeks or months...

361.7AUSS::GARSONDECcharity Program OfficeMon Mar 24 1997 17:008
    re .5
    
    Note that a vanilla global section is also not ideal for mission
    critical data unless you specifically program to ensure integrity. That
    is, if mission critical data is put in a global section, possibly only
    during transit, and a system failure occurs, that data can be lost or
    corrupted unless you take steps to handle this. [With a mailbox, system
    failure will simply result in loss of data.]