Difference between Optimistic and Pessimistic locking

What’s difference between “Optimistic” and “Pessimistic” locking?

- In pessimistic locking, when a user opens a data to update it, a lock is granted. Other users can only view the data until the whole transaction of the data update is completed.

- In optimistic locking, a data is opened for updating by multiple users. A lock is granted only during the update transaction and not for the entire session. Due to this concurrency is increased and is a practical approach of updating the data.

What’s difference between “Optimistic” and “Pessimistic” locking?

Pessimistic locking :
On updating the data, the record gets locked and no one else can access that record for updating. It becomes a read-only record till the lock is released. Once the lock gets released, the record can be locked again and get updated for a different user.

Optimistic locking :
This allows multiple user to open up the same record for updation . Record gets locked only while updating the record. This is the most preferred way of locking for the web application.
What is connection pooling and what is the maximum Pool Size in ADO.NET Connection String?
A connection pool is created when a connection is opened the first time...
Can you explain how to enable and disable connection pooling?
To disable connection pooling set Pooling=false in connection string if it is an ADO.NET Connection..
What is Validation Control in ASP.NET?
ASP.NET - Validation Control in ASP.NET - The validation control is used to implement page level validity of data entered in the server controls....
Post your comment