








Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!









Locks synchronized (lock) { balance
amt;
Messages
thread
server
channel-put
deposit-ch
amt
Transactions
atomic { balance += amt;
atomic
marks a set of actions to appear to happen
instantaneously to all other processesInstead of stopping other processes, let everyonerun until non-instantaneous state is detected
This potential problem is called a
conflict
Hide the problem by discarding/rewinding changesand trying again later
This is called an
abort
If there was no problem, then make the changespermanent
This is called a
commit
Process 1 atomic {
a++; b++; c++; }
Process 2 atomic
d++; b++; f++; }
One process may have to retry its transaction
Process 1 atomic {
a++; b++; c++; }
Process 2 atomic
d++; e =
b;
f++; }
Depends on transaction implementation
Messages
(and multiple managers)
define
a-server
sync ( handle-evt
a-request-ch ...
define
b-server
sync ( handle-evt
b-request-ch ...
handle-evt
a+b-request-ch ...
a-request-ch
Transactions
(no problem)
atomic {
a.op(b);b.op(a); }
Transactions can fix deadlock and priority inversion
Messages^ ...^ (
sync ( if
empty?
queue
never-evt ( channel-put-ev
dequeue-ch (
first
queue
channel-get
dequeue-ch
Transactions
atomic {
if (q.isEmpty())
retry; result = q.dequeue(); }
retry
means “try again when something changes”
Pessimistic
implementation:
abort early to avoid wasted work
Optimistic
implementation:
lower overall overhead
Transactions only work with actions that areundoable or immediate — which does not includeI/O If a transaction is too long:• Read/write logs grow large• The transaction may be constantly interruptedTracking reads and writes to detect conflicts canincur significant overhead