0% found this document useful (0 votes)
33 views4 pages

Lab-12 - Problems On Serializability, Conflict Serializability, View Serializability

Uploaded by

niloy8375skr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views4 pages

Lab-12 - Problems On Serializability, Conflict Serializability, View Serializability

Uploaded by

niloy8375skr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Lab problems that cover Schedule, Serializability, Conflict Serializability, View

Serializability, Testing for Serializability, Test for Conflict Serializability, Recoverable


Schedules, Cascadeless Schedules, and Concurrency Control comprehensively:

Problem 1: Identifying Serial and Non-Serial Schedules

Objective: Understand the basics of schedules.

• Scenario: Two transactions operate on a BankAccount table (read and write


operations).
• Tasks:
1. Write a SQL script for transactions to debit and credit an account.
2. Analyze the execution order to determine if the schedule is serial or non-serial.
3. Discuss the impact on data consistency.

Problem 2: Testing for Conflict Serializability

Objective: Identify conflict serializability using a precedence graph.

• Scenario: Simulate a schedule where two transactions read and update the Inventory
table.
• Tasks:
1. Create a precedence graph for the schedule.
2. Check for cycles to determine conflict serializability.
3. Suggest improvements if it is not serializable.

Problem 3: View Serializability Check

Objective: Analyze schedules for view serializability.

• Scenario: Simulate a database where multiple users update product prices in


Products.
• Tasks:
1. Write SQL operations for initial reads, updates, and final writes.
2. Test the schedule for view serializability.
3. Compare it with conflict serializability results.

Problem 4: Implementing Recoverable Schedules

Objective: Ensure that schedules are recoverable.

• Scenario: Two transactions work on OrderDetails, where one reads data written by
the other.
• Tasks:
1. Simulate a schedule where one transaction commits before the other.
2. Modify the schedule to make it recoverable.
3. Demonstrate the rollback behavior in case of failure.

Problem 5: Designing Cascadeless Schedules

Objective: Prevent cascading rollbacks.

• Scenario: Two transactions update and read data in the EmployeeSalary table.
• Tasks:
1. Simulate a cascading schedule.
2. Rework the schedule to make it cascadeless.
3. Validate the results.

Problem 6: Lock-Based Concurrency Control

Objective: Apply locks to maintain consistency during concurrent execution.

• Scenario: Transactions update stock levels in WarehouseStock.


• Tasks:
1. Implement transactions without locks and observe inconsistencies.
2. Apply row-level locks to prevent conflicts.
3. Analyze the impact on performance and consistency.

Problem 7: Two-Phase Locking (2PL) Protocol

Objective: Implement the 2PL protocol to ensure serializability.

• Scenario: A library database handles book issues and returns in BooksIssued.


• Tasks:
1. Simulate the growing and shrinking phases of 2PL.
2. Verify that the resulting schedule is conflict-serializable.
3. Explain deadlock possibilities and resolutions.

Problem 8: Detecting and Resolving Deadlocks

Objective: Handle deadlocks in concurrent schedules.

• Scenario: Two transactions access Orders and Payments tables, creating a deadlock.
• Tasks:
1. Simulate a deadlock scenario with transactions holding conflicting locks.
2. Detect deadlocks using a wait-for graph.
3. Resolve the deadlock and implement prevention strategies.
Problem 9: Timestamp Ordering Protocol

Objective: Use timestamps to ensure serializability.

• Scenario: Transactions update product stock in Products.


• Tasks:
1. Assign timestamps to operations.
2. Ensure operations are executed in timestamp order.
3. Handle timestamp violations and explain corrections.

Problem 10: Testing Conflict Serializability

Objective: Validate conflict serializability using precedence graphs.

• Scenario: Transactions update and read data in the StudentGrades table.


• Tasks:
1. Create a precedence graph for the schedule.
2. Check for cycles and determine serializability.
3. Propose changes to make the schedule conflict-serializable if needed.

Problem 11: Designing View-Serializable Schedules

Objective: Create view-serializable but non-conflict-serializable schedules.

• Scenario: Students register for courses in CourseRegistration.


• Tasks:
1. Design a schedule with initial reads, updates, and final writes.
2. Prove the schedule is view-serializable.
3. Explain why it is not conflict-serializable.

Problem 12: Cascadeless Schedules in Locking Protocols

Objective: Design cascadeless schedules using locking protocols.

• Scenario: Simulate transactions updating user data in UserProfiles.


• Tasks:
1. Create a cascading schedule and demonstrate rollbacks.
2. Apply locks to avoid cascading rollbacks.
3. Validate the schedule for serializability.

Problem 13: Optimistic Concurrency Control

Objective: Use optimistic concurrency control (OCC) for serializable schedules.

• Scenario: Transactions update shopping cart details in ShoppingCarts.


• Tasks:
1. Simulate read, validation, and write phases of OCC.
2. Handle conflicts during the validation phase.
3. Prove the resulting schedule is serializable.

Problem 14: Recoverable and Cascadeless Schedule Comparison

Objective: Compare recoverable and cascadeless schedules.

• Scenario: Multiple transactions process orders in OnlineOrders.


• Tasks:
1. Create a recoverable schedule with cascading rollbacks.
2. Modify it to make it cascadeless.
3. Compare and analyze the results.

Problem 15: Multiversion Concurrency Control (MVCC)

Objective: Implement MVCC for concurrent transactions.

• Scenario: Two transactions read and update CustomerData in parallel.


• Tasks:
1. Simulate MVCC by creating multiple versions of data.
2. Test read and write operations for consistency.
3. Validate serializability using MVCC principles.

You might also like