Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

CC_ACTIVITY

Name: Syed Hamza Ibrar Gillani


Roll No: FA-2019-BSSE-060
Submitted To: Mam Fouzia Rathore

DATED: 2nd June 2021


Consider the following table below. Identify the CC problem.
Consider the below diagram where two transactions TX and TY, are performed on the same account A
where the balance of account A is $300.

Answer:

 At t1, a TX
transaction
reads account A
value, i.e., $ 300
(read only).
 Time At t2, TX
transactions
deduct $ 50 from
account A
to $ 250 (only
pulled and not
renewed /
written).
 Alternatively, during t3, a TY transaction reads account A value of $ 300 because TX has not
updated the value yet.
 Time At t4, a TY transaction adds $ 100 to account A of $ 400 (only added but not updated /
write).
 During t6, TX transaction records account amount A which will be updated as $ 250 only, as TY
has not updated the value so far.
 Similarly, during t7, the TY transaction records account numbers A, so it will write as done at t4
that will be $ 400. It means that the value written by TX is lost, i.e., $ 250 is lost.

 So the data becomes inaccurate, and the database sets inconsistencies.


Answer:

 During t1, a TX transaction reads account value A, i.e., $ 300.

 At Time t2, a TX transaction can add $ 50 to account A to $ 350.

 During t3, TX transactions record the updated amount in account A, i.e., $ 350.

 Then at t4, TY transactions are read account A which will be read as $ 350.

 Then during t5, the TX rollbacks transaction due to a server problem, and the value changes back
to $ 300 (as before).

 But account A value is always $ 350 for a TY transaction as a commitment, which is the dirty
read and therefore known as Dirty Read Problem

You might also like