Levels Tought:
Elementary,Middle School,High School,College,University,PHD
Teaching Since: | Apr 2017 |
Last Sign in: | 8 Weeks Ago, 5 Days Ago |
Questions Answered: | 4870 |
Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
Please answer the 2 scenarios below (Scenario 11/12). I provided some context and examples on what i am looking for!
Â
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.
Â
Before you address each of the scenarios below, let us take a look at two examples.
Â
Example 1:Â If S1 has a shared lock on D1, and S2 has a shared lock on D2, what would happen if S3 attempts to procure a shared lock on D1? The answer is that S3 would be granted the shared lock, because by the nature of a shared lock, it is acceptable for both S1 and S3 to have a shared lock on the same data item at the same time.
Â
Example 2:Â If S1 has an exclusive lock on D1, and S2 has an exclusive lock on D2, what would happen if S3 attempts to procure a shared lock on D1? The answer is that S3 would need to wait until S1 releases the lock on D1, because by the nature of an exclusive lock, only one session at a time may have the lock. Therefore S3 cannot be granted the lock at the same time S1 has the lock, and S3 will need to wait until S1 releases the lock.
Â
Now that we have taken a look at a couple of examples, it is your turn to describe what will happen in each scenario below. For each scenario, indicate, for each session, whether it procures the requested lock, waits, or deadlocks. Make sure to explain your reasoning.
Â
Scenario 11: S1 has a shared lock on D1 and attempts to procure an exclusive lock on D2. S2 has a shared lock on D2 and attempts to procure an exclusive lock on D3. S3 has a shared lock on D3 and attempts to procure an exclusive lock on D1.
-
Scenario 12: S1 has a shared lock on D1 and attempts to procure a shared lock on D2. S2 has a shared lock on D2 and attempts to procure a shared lock on D3. S3 has a shared lock on D3 and attempts to procure an exclusive lock on D1.