recategorized by
4,256 views

2 Answers

1 votes
1 votes
  • Pessimistic concurrency control (or pessimistic locking) is called "pessimistic" because the system assumes the worst — it assumes that two or more users will want to update the same record at the same time, and then prevents that possibility by locking the record, no matter how unlikely conflicts actually are.

    The locks are placed as soon as any piece of the row is accessed, making it impossible for two or more users to update the row at the same time. Depending on the lock mode (shared, exclusive, or update), other users might be able to read the data even though a lock has been placed. For more details on the lock modes, see Lock modes: shared, exclusive, and update.

  • Optimistic concurrency control (or optimistic locking) assumes that although conflicts are possible, they will be very rare. Instead of locking every record every time that it is used, the system merely looks for indications that two users actually did try to update the same record at the same time. If that evidence is found, then one user's updates are discarded and the user is informed.

    For example, if User1 updates a record and User2 only wants to read it, then User2 simply reads whatever data is on the disk and then proceeds, without checking whether the data is locked. User2 might see slightly out-of-date information if User1 has read the data and updated it, but has not yet committed the transaction.

Optimistic concurrency control divides a transaction into a read phase, a validation phase, and a writing phase. During (a) the read phase, a transaction reads database items, and performs writes on local buffers, with no checking taking place, (b) validation phase, the system does synchronization checking, and (c) the write phase, the local writes are made global. It assigns each transaction a unique timestamp at the end of its read phase. A transaction TI is validated if one of the following conditions can be established for all transactions TJ with later timestamps:

Transaction TI completes its write phase before transaction TJ begins its read phase.

Transaction TJ does not read any of the items written by TI and transaction TI finishes its write phase before transaction TJ begins its write phase.

Transaction TJ does not read or write any items written by TI.

Transactions are aborted when validation cannot be done. This approach works well when there are no conflicts (hence the term optimistic) but wastes work when there are conflicts. Aborting of transactions is a severe problem when the transactions are long and interactive, when manual/automatic merging is a better alternative.

Hence ans is A

  1. Validation based            Optimistic concurrency control 
  2. Time stamp ordering      Pessimistic concurrency control 
  3. Lock-based                    Pessimistic concurrency control 
0 votes
0 votes

Answer: A

Validation based concurrency method is a type of optimistic method, moreover validation is an important phase in optimistic concurrency control methods.

Related questions

0 votes
0 votes
3 answers
2
makhdoom ghaya asked Sep 7, 2016
2,792 views
In generalisation, the differences between members of an entity isMaximizedMinimizedBoth (A) & (B)None of these
3 votes
3 votes
1 answer
4
makhdoom ghaya asked Sep 11, 2016
2,093 views
One of the distinguished features of super-computer over other category of computer isParallel processingHighest accuracy levelMore speedMore capacity