> For the complete documentation index, see [llms.txt](https://vick7-education.gitbook.io/freshforfresh/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://vick7-education.gitbook.io/freshforfresh/database/consistency-and-concurrency-handling.md).

# Consistency and concurrency handling

Đảm bảo tính nhất quán và xử lý đồng thời trong cơ sở dữ liệu

## Định nghĩa về race conditions trong cơ sở dữ liệu

**Race conditions** (*Tình huống tương tranh*). Là trường hợp thường xảy ra bên trong critical section. Khi có hai hay nhiều Thread cùng chia sẻ dữ liệu, hay đơn giản là cùng đọc và ghi vào một vùng dữ liệu. Khi đó vấn đề xảy ra là: Kết quả của việc thực thi multiple threads có thể thay đổi phụ thuộc vào thứ tự thực thi các thread.

## Các kỹ thuật đảm bảo đồng bộ hóa và xử lý đồng thời

> Locking, Concurrency Control, Isolation Levels, Transactions

{% content-ref url="/pages/yPDIa5uDmCbLGG2riVdz" %}
[Database locking](/freshforfresh/database/consistency-and-concurrency-handling/database-locking.md)
{% endcontent-ref %}

{% content-ref url="/pages/h1mah5WxQS7FIuYv4Lgc" %}
[Concurrency Control](/freshforfresh/database/consistency-and-concurrency-handling/concurrency-control.md)
{% endcontent-ref %}

{% content-ref url="/pages/mKVWszaQzrjJkWBFLozF" %}
[Isolation Level](/freshforfresh/database/consistency-and-concurrency-handling/isolation-level.md)
{% endcontent-ref %}

{% content-ref url="/pages/vNKJJoe0IDcr60p0Nt94" %}
[Transaction Trong SQL](/freshforfresh/database/sql-va-cach-su-dung-voi-relational-database/transaction-trong-sql.md)
{% endcontent-ref %}

{% content-ref url="/pages/LdrxAxpwSfNxyyepyoro" %}
[ACID](/freshforfresh/database/sql-va-cach-su-dung-voi-relational-database/acid.md)
{% endcontent-ref %}
