YouTube magic that brings views, likes and suibscribers
Get Free YouTube Subscribers, Views and Likes

What is the difference between optimistic and pessimistic locking?

Follow
Knowledge Powerhouse

Locking is an important concept in maintaining the integrity of data in a concurrent application.

Pessimistic locking is the basic form of locking in which we obtain the lock on the database table or record that we are going to update. All the other threads wait for the lock to be released before starting their operation. It means that you need an exclusive lock before updating a record.

Optimistic locking is another way of locking in which we just check if anyone else has updated the data before us, then we reject the transaction and reread the data. We generally use a versioning scheme by implementing a version column in data.

Watch more Playlists:
System Design Interview Questions:    • System Design Interview Questions  
Software Architect Questions:    • Software Architect Interview Questions  
Microservices Questions:    • Microservices Interview Questions  
Devops Interview Questions:    • DevOps Interview Questions  

Connect with us:
Facebook:   / knowledgepowerhouse  
Twitter:   / knowledgepowe10  
Amazon: https://www.amazon.com/KnowledgePowe...
Site: www.knowledgepowerhouse.com

posted by badnjaka34