1

[Q.7] Answer the following questions (a) Explain 2PL in the context of database concurrency control (b)...

Question

[Q.7] Answer the following questions (a) Explain 2PL in the context of database concurrency control (b)...


[Q.7] Answer the following questions (a) Explain 2PL in the context of database concurrency control (b) Explain the reason why most DBMS provides isolation level. (c) List and explain 4 different isolation levels of the MySQL DBMS.

[Q.7] Answer the following questions (a) Explain 2PL in the context of database concurrency control (b) Explain the reason why most DBMS provides isolation level. (c) List and explain 4 different isolation levels of the MySQL DBMS.

Answers

Answer for 3 (a)

First of all, let me explain you a bit about concurrency and why it matters in database systems (I'll use DBMS as its acronym).

Consider a case of a simple system where there's one queue of operations taking place sequentially. This situation is similar to simple tasks such as queuing up for a metro ticket etc. And these operations require a sequential algorithm to manage the process.

A sequential algorithm doesn't have to worry about other simultaneously occuring processes as it deals with just one main thread, or the primary component of the system.

But in a world of smartphones and IOT, simple DBMSs aren't simply enough to cope up with increasing complexity of systems. One such example is our smartphone, and all the simultaneous and concurrent processes it handles simultaenously. It allows for an environment to make many things happen at the same time, and this is only possible because of simultaneous databases that allow dedicated DBMS systems for each user.

Grid computing and cloud computing are two areas where concurrent DBMSs are used that allow for various sub- components (two or more) to access the same data that are executed with time overlap. it allows for the integrity of DBMSs without violating any rules prescribed by the specific DBMS.

So, concurrent DBMSs are used to control concurrency of multiple ovelapped transactions by defining a strict set of rules known as concurrency control protocols. These rules safeguard the 3 out of 4 pillars of secure databse transactions-

  • Atomicity
  • Isolation
  • Serializibility

Now, these protocols can broadly be divided in two parts-

  1. Lock Based protocols- No transaction can read/write data until it acquires a lock over it
  2. Time stamp based protocols- transactions use system time/logical counter as the timestamp

The locks are further of two types-

Binary lock is where the data is either locked or unlocked,

Shared lock is where the operation on data determined what type of lock it has. For example, a write operation would have an exclusive lock. A read permission is shared lock, and for a transaction to acquire an exclusive lock, it must first have a shared lock permission (read permission).

Two Phase Locking Protocol (2PL)

This protocol divides the entire execution time of transaction in three phases, or parts.These phases form the complete cycle of transaction completion, and begins when the transaction begins executing. At this phase, the protocol seeks permissions for the locks it requires.

The second part is where transaction aquires all the locks. This is a a bit longer process, and keeps going until the protocol has acquired all the locks it needs.

And when it releases the first lock, that is when the third phase begins. In this phase, no new locks can be demanded and the protocol can only release the acquired lock.

Locks acquired Locks released phase 2 phase 1 GROWING phase 3 SHRINKING

Thus, this protocol has two phases- GROWING and FALLING/SHRINKING. The growing phase is where protocol acquires all the locks, and shrinking phase is where it releases the locks.

Answer for 3 (b)

Isolation is one of the four pillars of every DBMS, sequential or concurrent- ACID. Isolation determines the visibility of a transaction to other systems/users. A lower isolation level allows every user to access the same data, thus highly risking the data privacy and security of the system. However, a higher isolation level reduces the types of concurrency over the data but requires more resources and is slowed than lower isolation levels.

Isolation protocols help safeguard the data from unwanted transactions. They maintain the integrity of every data by defining how and when the changes made by one operation are visible to the others.  

Answer for 3 (c)

Ideally, the transaction should take place in such a way that its the only transaction accessing resources in a database system. To understand the 4 levels of isolation, it is important we understand what kind of phenomenon may occur in concurrent data types.

Type 1 (dirty read)- Lets say Transaction T1 updates a row and leaves it uncommitted. And T2 transaction sees the change (reads the updated row). If T1 rolled back the change, T2 will have seen a data that never existed. This situation is called dirty read.

Type 2 (non-repeatable read) - It occurs when a transaction reads the same value twice, and gets a different result everytime.

Type 3 (phantom read)- It occurs when the same queries are executed but the rows received by the two are different.

Now based on these three phenomemon, we have four levels of isolation-

  1. Read uncommitted- it is the lowest level of isolation. At this level, dirty reads are allowed. That means one can read the uncommitted changes made by another.
  2. Read committed- It allows no dirty reads, and clearly states that any uncommitted data is committed at the moment it is read.
  3. Repeatable read- This is most restricted level of isolation. The transaction holds read locks on all the rows it referances, and write locks over all the rows it updates/inserts/deletes. So, there's no chance of non-repeatable reads.
  4. Serializable- The highest level of civilization. it demands that all concurrent transactions be executing serially,


Similar Solved Questions

1 answers
The aged accounts receivable report is utilized by the auditor to accomplish which of the following?...
The aged accounts receivable report is utilized by the auditor to accomplish which of the following? a. Select the type of confirmations that will be sent to banks. O b. Assess the adequacy of the allowance for doubtful accounts. O c Encourage the client to collect on receivables that are long past ...
1 answers
Please show your work Q3. Green Airways flies several daily flights from Dallas to Chicago with...
please show your work Q3. Green Airways flies several daily flights from Dallas to Chicago with 150-seat planes. Based on historical data, the flight on Wednesday evening before Thanksgiving is always sold-out. However, there are usually no-shows, so the airline decides to improve revenue by overboo...
1 answers
Answer in units of C/m2. Question 23, chap 124, sect 8. part 1 of 210 points...
Answer in units of C/m2. Question 23, chap 124, sect 8. part 1 of 210 points A conducting spherical shell having an in ner radius of 4.8 cm and outer radius of 5.8 cm carries a net charge of 4.9 μC. A conducting sphere is placed at the center of this shell hav- ing a radius of 1.1 cm and carries ...
1 answers
What is the approximate distance from earth to pluto?
What is the approximate distance from earth to pluto?...
1 answers
Let a vector z Rn be given. For X > 0 consider the problem (i) Show...
Let a vector z Rn be given. For X > 0 consider the problem (i) Show that for any λ 0 this problem has a unique solution「. (ii) Determine the unique solution「(as a function of λ and 2) Hint: Note that Λ is not differentiable everywhere. Remark: The solution of (i...
1 answers
Solve the equation Ax b by using the LU factorization given for A. Also solve Ax...
Solve the equation Ax b by using the LU factorization given for A. Also solve Ax b by ordinary row reduction. 3 -5 1 0 0 3 5 4 4 A = 19 -3 1 3 -1 1 0 0 - 4 1 6 2 -6 2 3 1 0 1 58 - Let Ly b and Ux y. Solve for x and y. y X = Row reduce the augmented matrix [A b] and use it to find x The reduced row e...
1 answers
30. Data sets A and B are dependent . Find the critical value, to, to test...
30. Data sets A and B are dependent . Find the critical value, to, to test the claim that u(d)-0. Use a-0.05. A 40 38 57 53 4 B 38 34 35 45 32 31. Data sets A and B are dependent. Test the claim that the paired sample data is from a population with a mean difference of 0. Use a = 0.05. A 37 35 54 50...
1 answers
JAVA Hello, I would like some help wiht this program, I'm not sure hard to code...
JAVA Hello, I would like some help wiht this program, I'm not sure hard to code the deep copy and array for MenuSchedule Here is my code: Chez Moraine, a fake restaurant known for fine dining at reasonable prices, has hired you to develop a program to manage their menu during peak times:...
1 answers
I need help wring the introduction of my paper My topic is negative effects of health...
I need help wring the introduction of my paper My topic is negative effects of health insurance Write an introduction 400 words no plagiarism please see below abstract Abstract Medical health insurance is one of the most discussed topics in the media, among patients, and healthcare providers. In fac...
1 answers
A researcher plans to test a fall-prevention intervention by gathering data in 10 sites, 5 of...
A researcher plans to test a fall-prevention intervention by gathering data in 10 sites, 5 of which will be implementing the intervention. If the 5 of the 10 sites are assigned at random to the intervention, what type of randomization is in use? A. Simple randomization B. Cluster randomization C. Ur...
1 answers
Discuss whether it would be unethical to buy a stock based on some information you found...
Discuss whether it would be unethical to buy a stock based on some information you found in the trash that had been thrown away by mistake....
1 answers
20. Rifampin is a drug that causes enzyme induction. Would you have to increase or decrease...
20. Rifampin is a drug that causes enzyme induction. Would you have to increase or decrease the dosage of another drug taken concurrently if it required drug metabolism for elimination?...
1 answers
An investment is expected to generate an average return of 10% with a standard deviation of...
An investment is expected to generate an average return of 10% with a standard deviation of 5%. With 95% confidence level, the actual rate of return will fall between: A. -5% to 25%. B. -10% to 30%. C. 0% to 20%. D. 5% to 15%....
1 answers
18.64 Patients arrive at a 1 doclor clinic according to a Poisson distribution at the rale of 20 ...
18.64 Patients arrive at a 1 doclor clinic according to a Poisson distribution at the rale of 20 patients per hour The waiting room does nol accommodate more than 14 palients. Examination time per patient is exponential a What is the probability that an arriving patient will not wait? b. Wnat is the...
1 answers
30. You have been provided with Manufacturing Company: e following information regarding the ALG ost per...
30. You have been provided with Manufacturing Company: e following information regarding the ALG ost per unit $ 25 Sales price Variable manufacturing cost per Variable marketing cost per unit Fixed manufacturing costs Fixed administrative costs 3 180,000 40,000 mation is based on forecasted sales of...
1 answers
13) Consider the ring structure of B-D-glucose. It will give a positive test as a reducing...
13) Consider the ring structure of B-D-glucose. It will give a positive test as a reducing sugar. Describe how can that happen?...
1 answers
Osmosis Practice Example Celery in distilled water: molecule Is the surrounding solution hypotonic or hypertonic? Will...
Osmosis Practice Example Celery in distilled water: molecule Is the surrounding solution hypotonic or hypertonic? Will water move into or out of the cell? What will happen to the celery cells? 22...
1 answers
A copper rod and an aluminum rod of equal diameter are joined end to end in good thermal...
a copper rod and an aluminum rod of equal diameter are joined end to end in good thermal contact. The temperature of the free end of the copper rod is held constant at100 C and that of the far end of aluminum rod is held at 0 C. If the copper rod is .15m long, what must be thelength of the aluminum ...

-- 0.010407--