💾
Welcome to DataGenesis !
  • 🚀 Welcome to the Database Management System Playground! 📊💾
  • Basics of DBMS
    • Database Management System
    • DBMS V/S File System
    • DBMS Architectures
    • Tier 3 Architecture / Three Schema Architecture
  • E-R Data Model
    • Basics of E-R Model
    • Attributes in E-R Model
    • Null Values
    • Strong & Weak Entities
    • Relationship Constraints
    • Recursive Relationships
    • E-R Diagrams
    • Extended E-R Model
  • Relational Model
    • Relational Model
    • Facts About Relational Model
    • Types of Keys in Relational Model
    • Integrity Constraints
    • Anomalies in Relational Model
  • Transform - ER Model to Relational Model
    • Mapping from ER Model to Relational Model
  • SQL - Structured Query Language
    • SQL
    • CRUD Operations
    • Data Types
    • Type of Commands in SQL
    • Working With Commands
    • Data Retrieval Commands
  • Normalisation
    • Functional Dependencies
    • Armstrong's Axioms
    • Multivalued Dependency
    • 1 Normal Form
    • 2 Normal Form
    • 3 Normal Form
    • Boyce-Codd Normal Form (BCNF)
    • 4 Normal Form
    • 5 Normal Form
    • Lossless Decomposition, Lossless Join ,and Dependency Preserving Decomposition, Denormalization
  • Concurrency Control
    • Transactions & Concurrency
    • Scheduling of Transactions
    • Problems & Strategies in Concurrency Control
    • Transaction & ACID Properties
    • How to implement ACID Properties
    • Atomicity Techniques
    • Durability Techniques
    • Implementing Locking in DBMS
    • Concurrency Control Protocols
      • Two Phase Locking
      • Timestamp Ordering
      • Multi Version Concurrency Control Techniques
    • Starvation in DBMS
    • Deadlock in DBMS
    • Log Based Recovery
  • NoSQL & Types of Databases
    • SQL V/S NoSQL
    • Types of Databases
  • DB Optimization
    • File Organization
      • Hash File Organizations
      • B+ Tree File Organization: A Guide to Efficient Data Indexing
      • Cluster File Organization
    • Indexing in DBMS
      • Primary Indexing
      • Clustered Indexing
      • Secondary Indexing
      • Multilevel Indexing
  • Distributed Databases
    • Database Clustering
    • Partitioning and Sharding
    • CAP Theorm
Powered by GitBook
On this page

Was this helpful?

  1. Concurrency Control

Starvation in DBMS

Starvation, also known as livelock, is a situation in a Database Management System (DBMS) where a transaction or user is unable to acquire a necessary lock or resource and is forced to wait indefinitely. This can lead to performance issues and fairness problems within the system. Starvation can occur for various reasons, including:

  1. Unfair Waiting Scheme: When the waiting scheme for locked items is unfair, some transactions may be given priority over others, causing certain transactions to wait indefinitely.

  2. Victim Selection: If the same transaction is repeatedly selected as a victim in resource allocation, it may face continuous delays.

  3. Resource Leak: Resource leaks, such as a transaction failing to release a lock, can lead to other transactions waiting indefinitely for the locked resource.

  4. Denial-of-Service Attacks: In some cases, malicious users may intentionally create situations that cause starvation to disrupt the normal operation of the DBMS.

To illustrate starvation, consider an example with three transactions (T1, T2, and T3) competing for a lock on data item 'I.' If the scheduler grants the lock to T1, the other two transactions (T2 and T3) have to wait. If a new transaction, T4, requests the lock after T1 completes, and the scheduler grants it to T4, T2 and T3 may continue waiting indefinitely, leading to starvation.

Solutions to mitigate or prevent starvation in a DBMS include:

  1. Increasing Priority: Increasing the priority of the affected transaction(s) can help, but it may lead to other transactions waiting longer if higher-priority transactions are in the queue.

  2. Modification in Victim Selection Algorithm: Adjusting the victim selection algorithm to lower the priority of repeatedly victimized transactions can reduce the chances of starvation.

  3. First Come First Serve (FCFS) Approach: Implementing a fair scheduling approach like FCFS ensures that transactions are granted locks in the order they requested them, reducing the likelihood of starvation.

  4. Wait-Die and Wound-Wait Schemes: These schemes use timestamp ordering mechanisms to manage transactions and reduce the chances of starvation.

  5. Timeout Mechanism: Implementing a timeout mechanism ensures that a transaction is allowed to wait for only a certain amount of time before it is aborted or restarted, preventing indefinite waits.

  6. Resource Reservation: Allocating necessary resources to a transaction before it starts execution can reduce the chances of waiting indefinitely for a resource.

  7. Preemption: Preemption involves forcibly removing a lock from a transaction that has been waiting for a long time, favoring transactions with higher priority or shorter wait times to prevent indefinite waits.

  8. Dynamic Lock Allocation: Dynamically allocating locks based on the current system state can prevent deadlocks and reduce the chances of starvation.

  9. Parallelism: Allowing multiple transactions to execute in parallel can ensure that no transaction waits indefinitely. Careful management of parallel execution is required to avoid conflicts.

In summary, starvation in a DBMS occurs when transactions or users are blocked indefinitely from accessing necessary resources. It can have adverse effects on performance and fairness within the system. Various strategies and mechanisms can be employed to prevent or mitigate starvation, including adjusting priorities, implementing fairness policies, and using timeout mechanisms to ensure that transactions do not wait indefinitely.

PreviousMulti Version Concurrency Control TechniquesNextDeadlock in DBMS

Last updated 1 year ago

Was this helpful?