|
File locking is a mechanism that enforces access (to that file) by only one user at any specific time. The purpose of locking is to prevent the classic
"interceeding update" problem which is common to any multi user operating system. A good example of this is a customer update program. Process 'A' reads
a record from a file containing the customer details, including the customer balance. Process 'B' now reads the same record. Process 'A' changes the
customer balance and writes the new value back to the file. However, process 'B' - which has the original values of that customer record, makes somes
other change to it's local copy of the data and re-writes this data to the file. This causes the update of the customer balance by process 'A' to be
lost. File locking prevents this problem by enforcing the serialization of update processes to any given file. Most operating systems support the concept
of record locking which means that individual records within any given file may be locked, so increasing the number of concurrent update processes.
|