search
HomeDaily ProgrammingMysql KnowledgeWhat are the units of concurrency control?

What are the units of concurrency control?

Jul 08, 2020 pm 02:28 PM
mysqlConcurrency control

The basic unit of concurrency control is a transaction. Concurrency control refers to various technologies used to protect the integrity of the database when multiple users update and run at the same time; incorrect concurrency mechanisms may lead to problems such as dirty reads, phantom reads, and non-repeatable reads.

What are the units of concurrency control?

#The basic unit of concurrency control is a transaction.

In computer science, especially in the fields of programming, operating systems, multiprocessing, and databases, concurrency control is a mechanism to ensure that errors caused by concurrent operations are corrected in a timely manner.

Concurrency control refers to various technologies used to protect the integrity of the database when multiple users update and run at the same time.

Incorrect concurrency mechanism may lead to problems such as dirty reads, phantom reads, and non-repeatable reads.

The purpose of concurrency control is to ensure that the work of one user will not have an unreasonable impact on the work of another user.

In some cases, these measures ensure that when a user operates together with other users, the results obtained are the same as when she operates alone. In other cases, it means that a user's work is affected by other users in a predetermined way.

Concurrency control in database management systems

The task of concurrency control in database management systems (DBMS) is to ensure that multiple transactions access the database at the same time The isolation and unity of transactions and the unity of the database will not be destroyed when the same data is stored. The following example illustrates the data inconsistency problem caused by concurrent operations:

There are two train ticket sales points, and the ticket balance in a certain train ticket database is read at the same time as X. Two ticket sales points sold a ticket at the same time, and at the same time modified the balance to X -1 and wrote it back to the database. This resulted in two train tickets being actually sold but only one missing in the record in the database.

The reason for this situation is that two transactions read the same data and modify it at the same time. The result submitted by one transaction destroys the result submitted by the other transaction, causing the modification of its data to be lost and destroyed. Transaction isolation. Concurrency control is intended to solve this type of problem.

Blocking, timestamps, optimistic concurrency control, pessimistic concurrency control, multi-version and snapshot isolation are the main technical means used for concurrency control.

Recommended tutorial: "MySQL Tutorial"

The above is the detailed content of What are the units of concurrency control?. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools