Question

In: Computer Science

Locking methods are one of the most common techniques used in concurrency control. There are different...


  1. Locking methods are one of the most common techniques used in concurrency control. There are different levels of lock use.

Make sure you clearly write down (a), (b) followed by your answers.

[6 marks] (a) Use the following scenario to illustrate and explain how a table-level lock and a page-level lock work.

Scenario:

Transaction 1 (T1) wants to update row 5 in Table A

Transaction 2 (T2) wants to update row 2 in Table A

Note: Page 1 contains rows 1-3 in Table A and Page 2 contains rows 4-6 in Table A

[4 marks] (b) Compare the advantages and disadvantages of a table-level lock and a page-level lock.

Solutions

Expert Solution

Answer Question (a) Use the following scenario to illustrate and explain how a table-level lock and a page-level lock work.

Scenario:

Transaction 1 (T1) wants to update row 5 in Table A

Transaction 2 (T2) wants to update row 2 in Table A

Note: Page 1 contains rows 1-3 in Table A & Page 2 contains rows 4-6 in Table A

Using Page Lock

Using Table Lock

Transaction 1

Transaction 2

Transaction 1

Transaction 2

X_LOCK(P2)

X_LOCK(P1)

X_LOCK(Table A)

Access Row 5

Access Row 2

Access Row 5

X_UNLOCK(P2)

X_UNLOCK(P1)

X_UNLOCK(Table A)

X_LOCK(Table A)

Access Row 2

X_UNLOCK(Table A)

Answer to Question (b) Compare the advantages and disadvantages of a table-level lock and a page-level lock.

Characteristics of Table-level locking are:

Ø Table-level locking systems always lock entire tables.

Ø A transaction using a table-level locks will hold shared and/or exclusive table locks

Characteristics of Page-level locking are:

Ø Page-level locking systems always lock only the entire page of table that is currently required.

Ø A transaction using a page-level locks will hold shared and/or exclusive page locks

In the lock hierarchy, the table level hierarchy is the higher-level lock as compared to the page-level lock. Thus, page-level locking is expected to be better (in terms of the number of rows blocked) because when you lock on a larger table, you are locking more data. However, this is true with smaller tables, with very limited number of pages. Page-level can be slower than table-level locks when used on a large part of the table because of the following reasons:

Ø Require more memory than table-level locks.

Ø Needs to acquire many more locks as compared to table-level locks.

Ø Not suitable for table operations involving access to large number of table rows or pages.

A Table-level lock is better for a large table where major data modifications are taking place. This lets the system contend with a single lock on the table rather than having to deal with one for each page. Table locks are superior to page-level in the following cases:

Ø Most statements for the table are reads.

Ø Read and updates on strict keys.

Ø SELECT combined with concurrent INSERT statements.

Ø Many scans or GROUP BY operations on the entire table without any writers.

The RDBMS automatically escalates locking levels internally.


Related Solutions

1. Protein crystallography is one of the most common methods used to determine the structure of...
1. Protein crystallography is one of the most common methods used to determine the structure of proteins. However, an emerging method called “Cryo-EM” is used to determine the structure of the spike protein. In your own words, describe what “Cryo-EM” is, and why it’s a useful for studying protein structures. 2. The spike protein is heavily glycosylated. Briefly describe what glycosylation is, and why it might be useful for the virus. 3. Is the spike protein structure a Primary, Secondary,...
The most common methods of microbial control might be hand washing and cooking of food. a....
The most common methods of microbial control might be hand washing and cooking of food. a. Explain, in detail, how soap and water disrupt a membrane at the molecular level. b. Explain how heat disrupts proteins, referencing the different levels of protein structure. c. Design an imaginary device that inactivates non-enveloped human viruses. What does the device do to the virus?
What are the techniques used to control cash?
What are the techniques used to control cash?
Describe the different data methods used by clinicians. which methods are the most efficient and why...
Describe the different data methods used by clinicians. which methods are the most efficient and why are some approaches favored over others by clinicians? How is information stored and retrieved in the EHR?
• Describe how different methods of birth control can be used to prevent pregnancy
• Describe how different methods of birth control can be used to prevent pregnancy
Discuss the two most common methods used to determine when the economy is in a recession.
Discuss the two most common methods used to determine when the economy is in a recession.
If different methods are used, can it be decrease live load? If different methods are used,...
If different methods are used, can it be decrease live load? If different methods are used, can it be decrease live load? i dont have to much time ple help
One of the most common types of fertilizers used by farmers is a form of the...
One of the most common types of fertilizers used by farmers is a form of the highly soluble salt ammonium chloride (NH4Cl). At a certain farm, water runoff from fields carries dissolved ammonium chloride to a nearby pond, resulting in a dissolved concentration of NH4Cl in the pond of 5 mg/L. At the same time, ammonia gas (NH3) is being produced by cows that feed around the farmer’s pond, resulting in an atmospheric level of 500 ppb above the water...
Describe the three most common methods of computing depreciation for fixed assets and the factors used...
Describe the three most common methods of computing depreciation for fixed assets and the factors used in calculating depreciation
Describe the different techniques of influence used by organized interests. When is one technique preferable to...
Describe the different techniques of influence used by organized interests. When is one technique preferable to another? With the rise of the New Politics movement, different techniques are now used more frequently. Which ones? Why, do you think, are these techniques so well suited to New Politics?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT