Nothing Special   »   [go: up one dir, main page]

dbms

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

1.

ACID Properties & Details:

o ACID stands for Atomicity, Consistency, Isolation, and Durability. These are the key
properties that ensure reliable database transactions:

 Atomicity: Transactions are all-or-nothing.

 Consistency: Ensures the database remains valid before and after a


transaction.

 Isolation: Transactions do not interfere with each other.

 Durability: Changes persist even after a system failure.

2. Locking Protocol (All Phases):

o Locking is a mechanism to manage concurrent access to database objects. Common


protocols include:

 Shared Lock (S): Allows read access.

 Exclusive Lock (X): Allows write access.

 Two-Phase Locking Protocol:

 Growing phase: Locks are acquired.

 Shrinking phase: Locks are released.

3. Transaction Management:

o A transaction is a sequence of database operations treated as a single logical unit.


Transaction management ensures:

 Concurrency control.

 Failure recovery.

 Maintaining ACID properties.

4. Conflict Management:

o Resolves issues when multiple transactions access the same data concurrently.
Techniques include:

 Locking mechanisms.

 Timestamp ordering.

 Deadlock resolution.

5. Dirty Read and Write Problems:

o Occurs in concurrent transactions:

 Dirty Read: Reading uncommitted data from another transaction.


 Dirty Write: Modifying data that another transaction is still using or has not
committed.

6. Durability (in details):

o Ensures that once a transaction is committed, its changes are permanently stored in
the database, even in the case of a system crash.

7. Consistency (in details):

o Ensures that a database moves from one valid state to another, maintaining all
integrity constraints during and after a transaction.

8. Functional Dependency (in details):

o A relationship between attributes in a table. For example, in a table with attributes A


and B:

 A → B means B is functionally dependent on A (A uniquely determines B).


This is essential for normalization and eliminating redundancy.

9. In DBMS (Database Management System), the scheduler process manages the order and
execution of database transactions to ensure consistency, isolation, and serializability in
concurrent access. Here's a short overview of the scheduler process:

Purpose:

o The scheduler ensures that multiple transactions accessing the database


concurrently do not violate the ACID properties, especially isolation and consistency.

Functions:

o Concurrency Control: Prevents conflicts among transactions (e.g., dirty reads, lost
updates).

o Serializability: Ensures the result of executing concurrent transactions is equivalent


to some serial order.

o Lock Management: Applies locks (e.g., shared, exclusive) to control access to data.

o Conflict Resolution: Resolves issues like deadlocks or transaction conflicts using


mechanisms like timestamps or priority rules.

Techniques Used:

o Two-Phase Locking (2PL): Ensures serializability by dividing the transaction into a


growing phase (acquiring locks) and a shrinking phase (releasing locks).

o Timestamp Ordering: Transactions are executed in the order of their timestamps.

o Deadlock Detection and Prevention: Identifies or prevents circular waiting among


transactions.
10. Concurrency in DBMS refers to the ability of the database system to allow multiple
transactions to execute simultaneously. It is essential for improving system performance,
resource utilization, and responsiveness in a multi-user environment.

Key Concepts of Concurrency:

Advantages:

o Increased Throughput: More transactions are processed in less time.

o Efficient Resource Utilization: CPU and I/O devices are used effectively.

o Improved Response Time: Reduces wait time for users by overlapping transactions.

Concurrency Problems:

o Dirty Read: One transaction reads uncommitted data from another transaction.

o Lost Update: Two transactions update the same data, and one update is overwritten.

o Unrepeatable Read: A transaction reads the same data twice but gets different
results due to another transaction's update.

o Phantom Read: A transaction reads a set of rows, but another transaction


inserts/deletes rows, causing inconsistent results.

Concurrency Control Mechanisms:

o Lock-Based Protocols:

 Shared Lock (S): Allows read access.

 Exclusive Lock (X): Allows write access.

o Timestamp-Based Protocols: Transactions are assigned timestamps to determine


execution order.

o Optimistic Concurrency Control (OCC): Assumes minimal conflict; validates


transactions at commit time.

o Multiversion Concurrency Control (MVCC): Maintains multiple versions of data to


allow readers and writers to work without blocking.

Goals of Concurrency Control:

o Maintain data consistency.

o Ensure isolation of transactions.

o Avoid conflicts like deadlocks or resource contention.

Concurrency ensures that the database system can handle multiple user requests efficiently while
maintaining data integrity and correctness.

11. Serializability in DBMS is a concept in concurrency control that ensures the correctness of
database transactions when they are executed concurrently. It guarantees that the final
result of executing transactions concurrently is the same as if they were executed one after
the other in some order (serially).
Why is Serializability Important?

 When multiple transactions run simultaneously, they may interact with the same data,
leading to problems like dirty reads, lost updates, or inconsistent results.

 Serializability ensures that concurrent transactions maintain the integrity and consistency of
the database.

Types of Serializability:

1. Conflict Serializability:

o A schedule (sequence of operations) is conflict-serializable if it can be transformed


into a serial schedule by swapping non-conflicting operations.

o Non-conflicting operations are those that:

 Access different data items, or

 Include at least one read operation on the same data item.

2. View Serializability:

o A schedule is view-serializable if it produces the same result as a serial schedule,


even if the order of operations differs.

o This is less strict than conflict serializability but harder to check.

You might also like