HP OpenVMS Systems

ask the wizard
Content starts here

RTL LIB$ binary trees, ASTs and interlocks?

» close window

The Question is:

I currently have an applications that uses the
binary tree RTL routines on a single-CPU
system. The binary tree is in a global section
and shared by multiple processes. In
additions to multiple readers, there are
multiple writers that can create new tree
nodes. When a new node is added, I use
the lock manager for atomicity. The
application will be moving to a
multi-processor system, and I was would
like to know if there is any inherent
sereialization in the binary tree routines
themselves. For example, if I am adding a
new node, are all lookups suspended? Do
they need to be? If an insert is done and the
tree is being rebalanced while other
processes are trying to traverse the tree, will
there be problems during traversal? Do I
need to use a combination of concurrent
and exclusive locking to control access to
the tree?

The Answer is :

  The OpenVMS Wizard does not know that the internal processing of the
  binary tree routines:
    lib$insert_tree, lib$lookup_tree, lib$traverse_tree
  is documented anywhere, and the OpenVMS Wizard thus does not recommend
  making any assumptions in this area based on current behaviour of the
  routines in an asynchronous environment as there is the potential that
  changes could be made.
  Consider using the appropriate mode locks (NL, PR, EX) to establish
  the appropriate expected interlocking in the shared memory.
  Also please see topics 1661 and 2681 for related information.

answer written or last revised on ( 11-OCT-2000 )

» close window