Modern Database Management: Chapter 11 Review Question 18

what-is-the-difference-between-shared-locks-and-exclusive-locks


Question

What is the difference between shared locks and exclusive locks?

Answer

In database management systems, locking technology has been used to prevent unauthorized access to the database or to restrict multiple accesses to the same record in the database. There are generally two types of locks: they are.
  • Shared locks (S locks or read locks)
  • Exclusive locks (X locks or write locks)

Shared locks

Shared locks are used to lock the database to prevent other access. It will allow other users to read locked records, but it will not update records. If the shared lock is placed on the record, other users can read it but cannot modify it. The shared lock is also called a read lock because it allows the records to be read. Different users can place shared locks on the same record, but shared lock records cannot put exclusive locks.

Exclusive locks

Exclusive locks are used to lock the database to prevent multiple operations. When the record is in an exclusive lock, users cannot read or update the record. If an exclusive lock is placed on a record, other people cannot access the record. Since an exclusive lock is placed when the record is modified, other people cannot see the record during the modification period. An exclusive lock is also called a write lock because it updates the records of a single user. The exclusive lock on the registry does not allow any other locks on the registry.


إرسال تعليق

Post a Comment (0)

أحدث أقدم