Consultor Eletrônico



Kbase 19958: How the Database Storage Manager Uses Semaphores
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   18/08/2009
Status: Verified

GOAL:

How the Database Storage Manager Uses Semaphores

FACT(s) (Environment):

UNIX
OpenEdge 10.x
Progress 9.x

FIX:

In conjunction with spin locks, semaphores synchronize the activities of server
and self-service client processes that are connected to a database.

The Database Storage Manager uses semaphores for 6 specific things:

1) To regulate access to the user table during database
login/logout. None of the other locking mechanisms Progress
uses work until a user table entry has been allocated.

2) To stop a process when it is waiting for a schema lock. There
is no suitable system call for this, so Progress uses
semaphores in spite of the fact they were not designed for it.
All Progress really needs is a system call to stop a process
and another one to start it again.

3) To stop a process when it is waiting for a record lock.

4) To stop a process when it is waiting for another process's
transaction to end. Transaction waits are a result of trying
to access a record that has been deleted by an as yet
incomplete transaction.

5) To stop a process when there is an internal medium-term
resource lock conflict. An example of this is when an I/O
operation is in process and Progress must wait for it to
complete before accessing the buffer contents.

6) To stop a process (where -spin is not used) when there is a
short-term "latch" conflict while attempting to lock a data
structure in shared memory. When -spin is used, instead of
semaphores, Progress does shared-memory latches with its own
high-speed, low overhead, spinlock code.

How can you know when there are too many semaphore operations?

Take the 4.56 semaphore operation total and divide it
by the number of users and you see that an individual
user is doing very few waits. Therefore, this
particular value is nothing to worry about.

What can you do to influence semaphore operations?

Only two things can be done to change the number of
semaphore operations:

1) Use -spin to eliminate them in no 6 above

or,

2) Change the application to reduce the number of
record lock conflicts.