Locking and Simultaneous Access
Locking and Simultaneous Access
Copyright(c) Management Analytics, 1995 - All Rights Reserved
Copyright(c), 1990, 1995 Dr. Frederick B. Cohen - All Rights Reserved
Problem:
Files and portions of files can be locked by processes in
order to control simultaneous access to database records or other
similar information. The problem with this feature is that a process
that never terminates can effectively deny services by locking numerous
files.
Prevention:
Careful programming can often prevent file locking problems,
but to be really safe, you must be cognizant of the fact that
processes can fail or get into odd states in a complex operating
environment, and provide redundant methods for unlocking files.
Detection:
The file locking mechanism has a facility for detecting a file lock.
Most programs that deal with locking problems of this sort use retries to
check for extended locking conditions.
Cure:
File locking can normally be terminated by terminating the process
that has the lock on the file. In cases where deamons are controlling
database access, the deamon may have to be restarted unless it is designed
to handle this situation. Pairs of deamons can be used to form a self-test
and repair facility to assure that no single process failure will lock a
file indefinately.