Benefits of an updatable reader?

I was wondering what are the benefits of using an updatable read lock rather than the following steps:

  • Use read lock
  • Check the condition to see if we need to block the record
  • Disable read lock
  • Take write lock
  • Perform update
  • Record Lock

One obvious drawback of performing the above steps, in contrast to setting an updated read lock, is that between steps 3 and 4 there is a time window where another thread can take a write lock.

Beyond this benefit, what other benefits will you find in order to take an updated read lock over the steps above?

+5
source share
2

-, " ".

, , 3 4 , . , 3 4, , 2.

, , :

  • , (, , ). , , . ( ).

  • , , 2, , , .

  • :

    • , ,
    • Take Write Lock
    • .
  • :

    • , .
    • , .
    • ( ).
    • .
    • .
    • .

, 4 , , . , , , .

, , , , . , , , , .


, , , ( , ). , , - , .

, , , , - .

, , , .

, , , . , , , , . * , , .

, , , , , , .

* "-" , , , ints ReaderWriterLockSlim, , . , , .

+6

, , , , .

0

All Articles