Preview

Quiz on Shared and Exclusive Locks

Satisfactory Essays
Open Document
Open Document
679 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Quiz on Shared and Exclusive Locks
This assignment verifies that you understand how shared and exclusive locks work. Suppose that S1, S2, and S3 are sessions connected concurrently to the same database instance. Suppose further that D1, D2, and D3 are data objects that can be locked with a shared and exclusive lock. For the ten locking situations below, indicate, for each session, whether it procures the requested lock, waits, or deadlocks.

1. S1 has a shared lock on D1 and S2 attempts to procure a shared lock on D1.
Since s1 has a shared lock on D1 and the other sessions can procure the lock without any waiting for release by s1.so s2 can procure a shared lock on D1

2. S1 has an exclusive lock on D1 and S2 attempts to procure a shared lock on D1.
Since S1 has a exclusive lock on D1 any other sessions cannot procure a shared lock on D1.The other sessions has to wait till S1 releases the lock. so S2 has to wait until S1 releases exclusive lock on D1

3. S1 has a shared lock on D1 and S2 attempts to procure an exclusive lock on D1.
Since exclusive locks can be made on a data instance only when its not accessed by any other sessions.S2 must wait until S1 commits in order to procure an exclusive lock on D1

4. S1 has an exclusive lock on D1 and S2 attempts to procure an exclusive lock on D1.
Since exclusive locks can be made on a data instance only when other sessions have not made shared lock or exclusive lock on that data instance. so S2 must wait to begin until S1 commits in order to procure an exclusive lock on D1

5. S1 has a shared lock on D1, S2 has a shared lock on D1, and S3 attempts to procure a shared lock on D1.
Since shared locks can be procured even when other sessions have made shared locks on the same data instance.A data instance can be accessed by any no of database
S3 can procure a shared lock on D1.
6. S1 has an exclusive lock on D1 and a shared lock on D2, and S2 attempts to procure an exclusive lock on D2.
Since exclusive locks can be made if no other sessions have made any

You May Also Find These Documents Helpful

Related Topics