Modern databases are designed to support multiple users at the same time. While this improves efficiency, it also introduces the risk of concurrency problems. In IB Computer Science, students are expected to understand what concurrency is, why problems occur, and how databases prevent data corruption.
Two of the most important concurrency problems examined are lost updates and dirty reads.
What Is Concurrency?
Concurrency occurs when:
- Multiple transactions access the same data
- At the same time or overlapping in time
Concurrency allows:
- Faster system response
- Efficient use of resources
- Multi-user access
However, without proper control, concurrency can cause data inconsistency and errors.
Why Concurrency Causes Problems
When transactions run simultaneously:
- They may read or modify the same data
- Changes may interfere with each other
- The final data may be incorrect
Concurrency problems arise when:
- Transactions are not properly isolated
- Partial changes become visible
- Updates overwrite each other
This is why isolation is a key ACID property.
What Is a Lost Update?
A lost update occurs when:
- Two transactions read the same data
