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

Conference azur::mcc

Title:DECmcc user notes file. Does not replace IPMT.
Notice:Use IPMT for problems. Newsletter location in note 6187
Moderator:TAEC::BEROUD
Created:Mon Aug 21 1989
Last Modified:Wed Jun 04 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:6497
Total number of notes:27359

1632.0. "LOCKS and MIR" by TENERE::MCDONALD () Thu Oct 10 1991 05:44

    In the new Example FM, a mcc_lock_aquire_concurrent is used for all
    reads from the MIR, and a mcc_lock_aquire_exclusive is used for all
    writes.
    Is it recommended to always use a lock for read and writes from the 
    MIR, or is this just an example?
    
T.RTitleUserPersonal
Name
DateLines
1632.1Locks are recommended when accessing a MIRNANOVX::ROBERTSKeith Roberts - DECmcc Toolkit TeamThu Oct 10 1991 10:0018
>> Is it recommended to always use a lock for read and writes from the 
>> MIR, or is this just an example?

Both

Accessing a MIR should be controlled by Locks because creating anything
in a MIR requires two steps; Create the Instance, and Create the Attributes.
It is possible that two threads (on a single system, or across processes
in a Cluster) could try to create or delete the same instance record
in a MIR.  Locks will ensure atomic operations on the MIR.

The Example FM was designed to demonstrate a lot of different DECmcc
functionality, as such a user-friendly layer was built on top of the
existing MIR routines.  These routines make accessing the MIR simple
(I hope!), and elimintate a lot of programming steps (as you will see
from the MCC_EXAMPLE_FM_LIBRARY.C file).

/keith
1632.2MIR and locksTOOK::CALLANDERMCC = My Constant CompanionWed Oct 23 1991 20:137
One more thing to keep in mind about locking MIRs is how you are using them.
There are FM's that use the instance and attr MIRs more independently then
Keiths example. There are cases where exclusive locks may only be required
on deletes, since multiple writes are agreeable, as long as the code handles
the alreadyexists message coming back if some one else beats you in.

jill
1632.3locks are bestNANOVX::ROBERTSKeith Roberts - DECmcc Toolkit TeamThu Oct 24 1991 07:5617
>> There are FM's that use the instance and attr MIRs more independently
>> then Keiths example.
>> There are cases where exclusive locks may only be required
>> on deletes, since multiple writes are agreeable, as long as the code
>> handles the alreadyexists message coming back if some one else beats
>> you in.

But if two threads try to create the same instance in a MIR, but
the attribute data is different - there is a problem.  Without locks,
you'd thread 2 would accept the fact that the instance already exists,
then attempt to write the attributes - what about thread 1 ??

Locks are best used in this case, and with the new MIR interface demonstrated
in the Example FM -- no one needs to even think about them !! Just like RMS
locks records, but you don't need to do anything extra in your code 8)

/keith