The
increment
operation and the
increment
lock
The
increment
operation
The
increment
operation:
INC(A, c)
: performs the following
steps
atomically
READ(A, t)
//
t
is a
local variable
in the
transaction
t = t + c
WRITE(A, t)
Note:
c
can be
negative
!!!
Fact:
Many applications
make use of the
increment
operation
:
Banking
:
transfer sum
:
A = A + c B = B + (-c)
Booking
:
#seats = #seats + (-1)