1. Pessimistic lock 1. Exclusive lock. When a transaction operates data, this part of the data is locked. It is not unlocked until the operation is completed. Only other transaction operations can operate on this part of the data. This will prevent other processes from reading or modifying the data in the table. 2. Implementation: In most cases, the lock mechanism of the database is used to implement the selct ... for update to lock the selected data, such as select * from account where name = "max" for update, this SQL The statement locks all records in the account table that meet the retrieval conditions (name="Max"). Before the submission of this transaction (the lock in the transaction during the transaction is submitted), the outside world cannot modify these records. Second, optimistic lock 1. If someone is updated before you, your update should be rejected, allowing users to re -operate. 2,
# 1. Mysql database optimization (3) -Mysql pessimistic and optimistic lock (concurrent control)
Introduction: This article explains the interpretation of the lock (shared lock), write the lock (row it lock) 2. Lock particle size: table lock, row lock (row lock) Third, optimistic locks and pessimistic locks lock it lock. When the transaction locks this part of the data when operating data, it is not unlocked until the operation is completed, and other transactions can operate this part of the data. This will prevent other processes from reading or modifying the data in the table. Implementation: Generally, select ... for UPDATE to lock the selected data.
## Introduction: Whenever there are multiple queries that need to modify data at the same time, concurrency control problems will arise. Here we discuss MySQL’s concurrency control at two levels: the server layer and the storage engine layer. Concurrent control is a huge topic, and there are a lot of theoretical literature to discuss it in detail. Here we only briefly discuss how MySQL controls concurrent reading and writing. Taking the email box of the Unix system as an example, the typical mbox file format is very simple. All emails in an mbox mailbox are serialized together and connected end to end. This format is suitable for reading and Feixi
3. [MySQL]Multi-version concurrency control
Introduction: The implementation of most transactional storage engines in MySQL is not a simple row-level lock. Based on the consideration of improving concurrency performance, they generally implement multi -version concurrent control (MVCC) at the same time. Not only MySQL, but other database systems such as Oracle and PostgreSQL also implement MVCC, but their implementation mechanisms are different because there is no unified standard for MVCC. It can be considered that MVCC is a variant of a row lock, but it avoids the lock operation in many cases, so the expenses are lower. Although the implementation mechanism is different, most of them have achieved
##:4.
java concurrent control mechanism.## :: In general development, I often see that many students only use some basic methods in the Java concurrent development model. For example, Volatile, synchronized. Advanced concurrency packages like Lock and atomic are not often used by many people. I think most of the reasons are caused by the lack of attributes of the principle. In the busy development work, who will accurately grasp and use the correct concurrency model
# 5. PHP The exclusive lock in concurrent control
## :: The exclusive lock in PHP concurrent control
# 6. php redis Concurrency control redis Download redis cluster redis visualization tool
#Introduction: redis:php redis concurrency control: For concurrency control, you can use memcacheq, redirs channle and other methods. Here I will just talk about redis. To control concurrency, redis mainly uses the three functions lPush llen lPop in the redis list api. lLen - Get the length of the list. lPop - Delete the first one in the list and return it. lPush - Insert one into the list, if the list does not exist.
Introduction: The problem with shmop is this. I need it frequently in the program When processing a piece of data, I don't want to query MySQL every time, so I take out the records to be used and use shmop to store them in the memory for later modification. However, during the writing process, I suddenly thought of a concurrency control problem, and I didn’t know how to solve it: function function1() {Read memory data for a long time (modified line x1) Write memory data} function function2
Introduction: The problem with shmop is this, I need it in the program I frequently process a piece of data and don't want to query MySQL every time, so I take out the records to be used and use shmop to store them in the memory for later modification. However, during the writing process, I suddenly thought of a concurrency control problem, and I didn’t know how to solve it: function function1() {Read memory data for a long time (modified line x1) Write memory data} function function2
9. The reason why the Access database "cannot be saved; is being locked by another user" appears
Introduction: The concurrency control of ACCESS is very poor. Remember to close the database after each operation
10. Comparison of concurrency control (lock) between DB2 and Oracle_Oracle Application_Script Home
Introduction: Comparison of concurrency control (locks) between DB2 and Oracle
[Related Q&A recommendations]:
Multi-threading - java's notify/notifyAll: How to notify the specified thread?
How to view hidden columns of Mysql table?
Optimistic concurrency control - why Redis uses optimistic locking, but MySQL database does not
java multi-threading - java's currently popular concurrency libraries are Which ones?
The above is the detailed content of Summarize 10 concurrent control instance tutorials. For more information, please follow other related articles on the PHP Chinese website!