Browse Prior Art Database

New Lock Acquisition Policy

IP.com Disclosure Number: IPCOM000108334D
Original Publication Date: 1992-May-01
Included in the Prior Art Database: 2005-Mar-22
Document File: 5 page(s) / 249K

Publishing Venue

IBM

Related People

Nagin, K: AUTHOR [+5]

Abstract

Disclosed is an efficient strategy for concurrent access to shared variables in a multitasking multiprocessing environment by a periodically executing task, employing a new implementation of locks with new methods for lock acquisition/lock release services. It is suitable for situations where a single task has to interfere with the execution of n mutually exclusive tasks. Its advantage over existing methods is when n is large and many locks are needed, it requires only one queue and simple queue management services to manage tasks concurrently.

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

New Lock Acquisition Policy

       Disclosed is an efficient strategy for concurrent access
to shared variables in a multitasking multiprocessing environment by
a periodically executing task, employing a new implementation of
locks with new methods for lock acquisition/lock release services.
It is suitable for situations where a single task has to interfere
with the execution of n mutually exclusive tasks.  Its advantage over
existing methods is when n is large and many locks are needed, it
requires only one queue and simple queue management services to
manage tasks concurrently.

      With the development of multitasking operating systems and
multiprocessing environments, a new class of variables, the Shared
Variables, was identified.  Shared variables are variables which may
be accessed and updated by more than one task.  Special new
mechanisms for synchronizing concurrent accesses to these variables
by the various tasks has to be devised.

      To maintain consistency of the content of such variables the
accessing tasks have to be occasionally granted with an exclusive
access right to these variables for distinct periods of time.  This
is accomplished by defining locks.  Before acquiring an exclusive
access to a shared variable, the accessing task will try to obtain
the lock for this variable.  If it succeeds, it may safely manipulate
the content of the variable, without any interference from the other
tasks.  If it does not, then it has to wait until the lock is
released by another task which is manipulating the variable.
Operating Systems (OS) supporting multitasking/multiprocessing
environments supply a wide range of services for lock management.  A
comprehensive discussion is given in (*).

      Locks are normally realized by variables implementing flags.
When the flag has the value of 0, the lock is free and the task
may be granted exclusive access to the variables.  When the flag has
the value of 1, it is busy, meaning that there is already a task
which has exclusive access to the variable.  Obtaining a lock is
performed first by inspecting the flag.  If it is 0, then its value
is set to 1, thus obtaining the lock.  If it is 1, it means that
the lock is already held by another task and it cannot be obtained.
When a lock becomes free, its value is set to 0 again.  The testing
and the setting of a lock has to be done as one undivisable
operation.  Most CPUs have special atomic "test and set" instructions
for implementing locks.  Tasks normally manipulate locks by calling
special OS services which acquire or release the lock on their
behalf.  The OS service that acquires locks has to take special
action when a lock it tries to acquire is found busy.  The following
four general strategies are commonly implemented:
1.  Spin loop.  Continuously spin in a loop testing the status of the
lock.  When it becomes free, grab it and return to the caller.  This
strategy may be implemented only in a multipro...