Browse Prior Art Database

Object Lock to Allow Concurrent Read Access

IP.com Disclosure Number: IPCOM000114233D
Original Publication Date: 1994-Nov-01
Included in the Prior Art Database: 2005-Mar-28
Document File: 2 page(s) / 46K

Publishing Venue

IBM

Related People

Hlava, A: AUTHOR [+2]

Abstract

This invention is an object-oriented locking mechanism that allows any number of concurrent object read accesses, but prevents concurrent write (or read and write) accesses. This is done via a UsageLock object that is associated with each object needing serialized access.

This text was extracted from an ASCII text file.
This is the abbreviated version, containing approximately 86% of the total text.

Object Lock to Allow Concurrent Read Access

      This invention is an object-oriented locking mechanism that
allows any number of concurrent object read accesses, but prevents
concurrent write (or read and write) accesses.  This is done via a
UsageLock object that is associated with each object needing
serialized access.

The UsageLock object contains the following data members:
  o  read_users: count of number of threads which have the object for
      read access (0 to n).
  o  write_users: count of number of threads which have the object
for
      write access (0 or 1).
  o  wait_users: count of number of threads which are waiting for
      object access (0 to n).

      The pseudo-code in Fig. 1 shows the locking algorithm which
allows concurrent read access but ensures that write access is
exclusive.

The pseudo-code in Fig. 2 contains the unlocking algorithm:
  Notes in the Fig. 2 pseudo-code:
    <1> Read access waits only if there is a thread with write
access.
    <2> Write access waits if there is a thread with write access or
if
         there are any threads with read access.
    <3> Delete access waits if there is a thread with write access,
         if there are any threads with read access, or if there are
any
         waiting threads (this ensures that, after the object is
         deleted, no thread wakes up and tries to use it).  Once
delete
         access is granted, other pa...