0% found this document useful (0 votes)
52 views3 pages

CC - Activity: Name: Syed Hamza Ibrar Gillani Roll No: FA-2019-BSSE-060 Submitted To: Mam Fouzia Rathore

The document describes a concurrency control (CC) problem scenario involving two transactions, TX and TY, operating on the same bank account. TX reads the account balance of $300, deducts $50, but does not commit the update. Meanwhile, TY also reads the account as $300. TY then adds $100 without seeing TX's update. When TX and TY finally commit, the account balance is inconsistent - TX records $250 while TY records $400, showing a loss of $250. This scenario illustrates the "dirty read" problem in concurrency control where transactions can read uncommitted writes from other transactions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views3 pages

CC - Activity: Name: Syed Hamza Ibrar Gillani Roll No: FA-2019-BSSE-060 Submitted To: Mam Fouzia Rathore

The document describes a concurrency control (CC) problem scenario involving two transactions, TX and TY, operating on the same bank account. TX reads the account balance of $300, deducts $50, but does not commit the update. Meanwhile, TY also reads the account as $300. TY then adds $100 without seeing TX's update. When TX and TY finally commit, the account balance is inconsistent - TX records $250 while TY records $400, showing a loss of $250. This scenario illustrates the "dirty read" problem in concurrency control where transactions can read uncommitted writes from other transactions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 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