Machine-translated by Google. Questions are authored in English.
Top

Discussion

The advantage of optimistic locking is that:

  • A.the lock is obtained only after the transaction has processed.
  • B.the lock is obtained before the transaction has processed.
  • C.the lock never needs to be obtained.
  • D.transactions that are best suited are those with a lot of activity.

Answer: A

Correct answer: the lock is obtained only after the transaction has processed.

Optimistic locking assumes conflict will be rare: the transaction reads, does its work without holding locks, and only at the end takes a lock long enough to check that nothing it relied on has changed. If something has, the transaction is rolled back and retried. Locks are therefore held for a very short time, which is where the concurrency gain comes from.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.