Home > Back-end >  Database locks and the lock of the differences and relations are?
Database locks and the lock of the differences and relations are?

Time:01-30

As the topic? Whether to adopt the transaction would be no need for the house of the database program locks in concurrent programs? The database to solve the problem of concurrent access by database lock itself?

CodePudding user response:

A completely different concept, a lock procedures, a lock data, how can replace each other,

CodePudding user response:

refer to the original poster had developed peanut response:
as title? Whether to adopt the transaction would be no need for the house of the database program locks in concurrent programs? The database to solve the problem of concurrent access by database lock itself?

A lock procedure, a lock data, can replace each other?

CodePudding user response:

Different database connection database lock to avoid concurrent article written on the same data in the database conflict
Different application process or thread lock to avoid concurrent program to write the same data in memory

CodePudding user response:

I know certainly is not the same, it is said, they can replace each other, such as can replace the database with the realization of the program lock to lock? Or the concurrent procedures, directly use transactions, then don't need to database locking in the program

CodePudding user response:

references 4 floor die peanut response:
I know certainly is not the same, is that they can replace each other, such as can replace the database with the realization of the program lock to lock? Or concurrent procedures, directly use transactions, then don't need to program the database locking

Cannot replace each other

CodePudding user response:

references 4 floor die peanut response:
I know certainly is not the same, is that they can replace each other, such as can replace the database with the realization of the program lock to lock? Or concurrent procedures, directly use transactions, then don't need to program the database locking

This obviously can not replace, program locks are own memory lock, the program can run on multiple clients, lock can lock your client program, won't lock the other client to access the database, and the same client can start more of the same program (multiple processes), also cannot interlock between multiple programs,

CodePudding user response:

Different database connection database lock to avoid concurrent conflict on the same data in the database (such as Shared two people can't sleep single bed)
Different application process or thread lock to avoid concurrent program to write the same data in memory conflict (such as two people share cannot at the same time in a pot cooking)
(Shared two people obviously cannot replace each other the bed and the exclusiveness of the woks)

CodePudding user response:

A concurrent programs serial command to use the singleton pattern database connection, the second is concurrent programs using the parallel mode, relying on database lock to ensure the integrity, the former is feasible, the effect which is better? Or have any other comment

CodePudding user response:

refer to eight floor die peanut response:
is a concurrent programs serial command to use the singleton pattern database connection, the second is concurrent programs using the parallel mode, relying on database lock to ensure the integrity, the former is feasible, the effect which is better? Or what other, consult

Using the database stored procedure, using transactions in the process of storage
If it is a multi-process concurrent, each process using a database connection
If it is multi-threaded concurrent, each thread USES a database connection

CodePudding user response:

Miss zhao, a stored procedure is not a must? In addition, under the concurrent use of database, database lock is automatic, concurrent access to cause obstruction how to deal with, will produce the problem such as dirty read? Lightweight, such as SQLITE does knowing how to view support concurrent?

CodePudding user response:

references to the tenth floor big die peanut reply:
miss zhao, a stored procedure is not a must? In addition, under the concurrent use of database, database lock is automatic, concurrent access to cause obstruction how to deal with, will produce the problem such as dirty read? Lightweight, such as SQLITE does knowing how to view support concurrent?

Baidu search "SQLite support concurrency and affairs?"
  • Related