How DBMS Manages Concurrent Access of Data and Data Access Difficulties over File System
A Database Management System (DBMS) is designed to overcome major limitations of a traditional file system, especially in handling concurrent access of data and data access difficulties. These problems are critical in multi-user environments where data consistency, correctness, and easy retrieval are required.
1. Concurrent Access of Data
1.1 Problem in File System
In a file system, multiple users can access and modify the same file simultaneously without proper control. This may cause lost updates, inconsistency, and data corruption.
Scenario (File System)
Consider a bank account stored in a file:
Two users access the file at the same time:
-
User A deposits 2000
-
User B withdraws 1000
Execution Steps
-
User A reads balance = 10000
-
User B reads balance = 10000
-
User A writes balance = 12000
-
User B writes balance = 9000
❌ Final balance = 9000 (incorrect)
✔ Correct balance should be 11000
Reasons
-
No transaction concept
-
No locking mechanism
-
No rollback or recovery support
1.2 How DBMS Solves Concurrent Access
A DBMS controls concurrent access using:
-
Transactions
-
Locks (Shared & Exclusive)
-
Concurrency control protocols
-
Isolation levels
DBMS Example with SQL
Table Creation
Transaction – User A (Deposit 2000)
Transaction – User B (Withdraw 1000)
How DBMS Ensures Correctness
-
DBMS applies an exclusive lock on the account row
-
Second transaction waits until the first completes
-
Transactions execute in a serializable manner
✔ Final balance = 11000 (correct)
✔ Data consistency is preserved
2. Data Access Difficulties
2.1 Problem in File System
File systems suffer from several data access issues:
-
Data redundancy
-
Poor data sharing
-
Complex program logic
-
No data independence
Scenario (File System)
Student data stored in multiple files:
-
student_info.txt -
student_marks.txt -
student_attendance.txt
To retrieve complete information of a student:
-
Programmer must read multiple files
-
Write complex procedural code
-
Any change in file structure requires program modification
❌ Difficult maintenance
❌ Low flexibility
2.2 How DBMS Solves Data Access Difficulties
DBMS organizes data using tables, schemas, relationships, and SQL, providing:
-
Logical & physical data independence
-
Simple and flexible data retrieval
-
Centralized data control
DBMS Example with SQL
Table Design
Insert Sample Data
Easy Data Retrieval Using SQL
✔ Single query retrieves all data
✔ No complex programming
✔ High data sharing and flexibility
3. Comparison Summary
| Feature | File System | DBMS |
|---|---|---|
| Concurrent Access | Not controlled | Controlled via locks & transactions |
| Data Consistency | Not guaranteed | Guaranteed (ACID) |
| Data Access | Program dependent | SQL based |
| Data Redundancy | High | Minimal |
| Data Independence | Not supported | Supported |
Conclusion
A DBMS effectively manages concurrent access using transactions and locking mechanisms, ensuring data consistency even in multi-user environments. It also resolves data access difficulties by providing structured storage, SQL-based retrieval, and data independence. Compared to file systems, DBMS offers better reliability, scalability, and ease of data management, making it the preferred choice for modern applications.
কোন মন্তব্য নেই:
একটি মন্তব্য পোস্ট করুন