Académique Documents
Professionnel Documents
Culture Documents
3 33 3
4 44 4
Properties of Transaction
To maintain dataintegrity and consistency when concurrent
takes place.each transaction satisfy the ACID property.
ACID
ATOMICITY CONSISTENCY ISOLATION DURABILITY
Atomicity: this property basically shows the behaviour of
transaction inter of unique.
-Atomicity means all the operation of the transaction are reflected
properly in the database or none of the operation are reflected.
- it has to rechecked to termination stage,either followed by commit
stage or followed by abort stage.
- the basic behind the atomicity is the database system keeps
tracks of old value of any data on which transaction perform write
and if the transaction doesnot complete its exection, the old value
are restored to make it appear as though the transaction never
executed.
Consistency: This property will basically shows the behaviour of
transaction in term of consistency, i.e if the transaction is
successful that what ever the changes made by the user should be
refleted on the database.
- If the transaction is failed/unsucccessfull then the database
shows the prexiting thing but discarding the current
transaction.
GANDHI INSTITUTE FOR EDUCTAION & TECHNOLOGY GANDHI INSTITUTE FOR EDUCTAION & TECHNOLOGY GANDHI INSTITUTE FOR EDUCTAION & TECHNOLOGY GANDHI INSTITUTE FOR EDUCTAION & TECHNOLOGY
DEPARTMENT OF COMPUTER SCIENCE DEPARTMENT OF COMPUTER SCIENCE DEPARTMENT OF COMPUTER SCIENCE DEPARTMENT OF COMPUTER SCIENCE
PREPARED BY Asst.Prof.SANTOSH KUMAR RATH PREPARED BY Asst.Prof.SANTOSH KUMAR RATH PREPARED BY Asst.Prof.SANTOSH KUMAR RATH PREPARED BY Asst.Prof.SANTOSH KUMAR RATH
DATABASE MANAGEMENT SYSTEM DATABASE MANAGEMENT SYSTEM DATABASE MANAGEMENT SYSTEM DATABASE MANAGEMENT SYSTEM
(FOR BOTH CSE (FOR BOTH CSE (FOR BOTH CSE (FOR BOTH CSE- -- -4TH 4TH 4TH 4TH- -- -SEM/MECH SEM/MECH SEM/MECH SEM/MECH- -- -3RD SEM) 3RD SEM) 3RD SEM) 3RD SEM)
MODULE MODULE MODULE MODULE- -- -III III III III
5 55 5
6 66 6
Problems/Disadvantages:
As we know that when two transaction attempts to odify/update the
same time,and on some data item.some time it may suffer the
following problems susch as.
1) Lost update problem
2) Dirty read problem
3) Unpredictable read
Lost Update Problem:
This problem occurs when two transaction attempts to mainly
update/modify at same time on same data. Then the update made
by one transaction T1 on data item x is lost due to the update
made by another transaction T2 on data item x.
Ex: let us consider two transaction T1 & T2
T1 T2
Read(A) Read(A)
A=A+5000 A=A+10000
Write(A) Write(A)
Let us consider the schedualr transaction T1 & T2 at same
time,intially value of A=3000, what is the value after transaction T2.
Ans: T1: Read (A) A=A+5000=3000+5000=8000
Wrie(A)
T2: Read(A) A=A+10000 now the value of A is 8000, then
GANDHI INSTITUTE FOR EDUCTAION & TECHNOLOGY GANDHI INSTITUTE FOR EDUCTAION & TECHNOLOGY GANDHI INSTITUTE FOR EDUCTAION & TECHNOLOGY GANDHI INSTITUTE FOR EDUCTAION & TECHNOLOGY
DEPARTMENT OF COMPUTER SCIENCE DEPARTMENT OF COMPUTER SCIENCE DEPARTMENT OF COMPUTER SCIENCE DEPARTMENT OF COMPUTER SCIENCE
PREPARED BY Asst.Prof.SANTOSH KUMAR RATH PREPARED BY Asst.Prof.SANTOSH KUMAR RATH PREPARED BY Asst.Prof.SANTOSH KUMAR RATH PREPARED BY Asst.Prof.SANTOSH KUMAR RATH
DATABASE MANAGEMENT SYSTEM DATABASE MANAGEMENT SYSTEM DATABASE MANAGEMENT SYSTEM DATABASE MANAGEMENT SYSTEM
(FOR BOTH CSE (FOR BOTH CSE (FOR BOTH CSE (FOR BOTH CSE- -- -4TH 4TH 4TH 4TH- -- -SEM/MECH SEM/MECH SEM/MECH SEM/MECH- -- -3RD SEM) 3RD SEM) 3RD SEM) 3RD SEM)
MODULE MODULE MODULE MODULE- -- -III III III III
7 77 7
A=a=A+10000
A=8000+10000
18000
After the transaction T2 value 18000
Due to loss update problem:
Read(A)----- T1 (A=3000)
A=A+5000 A=3000+5000=8000
Write(A)
Read(A)------T2
A=A+10000 (A=13000)
Write(A)
The above schedule the actual value of A is 18000, but it comes to
13000 because transaction T2 Read(A) before the update of T1 is
stored in the database.
Dirty Read Problem:
This problem occurs when one transaction T1 update dataitem X
and then transaction fails, the value of X will be rollback to original
value.but it means that another transaction T2 has the read the
value of X before it can Rollback . The value of X read by T2 is dirty
read of data. Since it is the value created by the transaction that
has been aborted this problem is known as Dirty read problem.
GANDHI INSTITUTE FOR EDUCTAION & TECHNOLOGY GANDHI INSTITUTE FOR EDUCTAION & TECHNOLOGY GANDHI INSTITUTE FOR EDUCTAION & TECHNOLOGY GANDHI INSTITUTE FOR EDUCTAION & TECHNOLOGY
DEPARTMENT OF COMPUTER SCIENCE DEPARTMENT OF COMPUTER SCIENCE DEPARTMENT OF COMPUTER SCIENCE DEPARTMENT OF COMPUTER SCIENCE
PREPARED BY Asst.Prof.SANTOSH KUMAR RATH PREPARED BY Asst.Prof.SANTOSH KUMAR RATH PREPARED BY Asst.Prof.SANTOSH KUMAR RATH PREPARED BY Asst.Prof.SANTOSH KUMAR RATH
DATABASE MANAGEMENT SYSTEM DATABASE MANAGEMENT SYSTEM DATABASE MANAGEMENT SYSTEM DATABASE MANAGEMENT SYSTEM
(FOR BOTH CSE (FOR BOTH CSE (FOR BOTH CSE (FOR BOTH CSE- -- -4TH 4TH 4TH 4TH- -- -SEM/MECH SEM/MECH SEM/MECH SEM/MECH- -- -3RD SEM) 3RD SEM) 3RD SEM) 3RD SEM)
MODULE MODULE MODULE MODULE- -- -III III III III
8 88 8
Unpredictable Problem:
When more than one transactiobn are occuring cocurrently in the
same database and try to manipulate the same attribute of
database, in due course of time let 1
st
transaction makes some
changes then after,next transaction make the same changes again
and again,by default non of them can reflect on the database.then
the database hold with previous value.
Or if the transaction makes same changes and before commiting it
the other transaction applies a rollback command the database
cannot be consistent.
Solution for the problem occur due to cocurrency:
To avoid the problem occur due to concurrency , uses the protocol.
1) Lock-Based Protocol
2) Timestamp protocol
3) Validation based protocol
4) Multiversion Protocol
Characterstics of cocurrency control:
1) Sharing of data maong users
2) Keep tight control on data redudancy
3) It represent the complex relation between different dataitem.
4) Has different interface through which user manipulate data.
5) Enforces data access authorization.
GANDHI INSTITUTE FOR EDUCTAION & TECHNOLOGY GANDHI INSTITUTE FOR EDUCTAION & TECHNOLOGY GANDHI INSTITUTE FOR EDUCTAION & TECHNOLOGY GANDHI INSTITUTE FOR EDUCTAION & TECHNOLOGY
DEPARTMENT OF COMPUTER SCIENCE DEPARTMENT OF COMPUTER SCIENCE DEPARTMENT OF COMPUTER SCIENCE DEPARTMENT OF COMPUTER SCIENCE
PREPARED BY Asst.Prof.SANTOSH KUMAR RATH PREPARED BY Asst.Prof.SANTOSH KUMAR RATH PREPARED BY Asst.Prof.SANTOSH KUMAR RATH PREPARED BY Asst.Prof.SANTOSH KUMAR RATH
DATABASE MANAGEMENT SYSTEM DATABASE MANAGEMENT SYSTEM DATABASE MANAGEMENT SYSTEM DATABASE MANAGEMENT SYSTEM
(FOR BOTH CSE (FOR BOTH CSE (FOR BOTH CSE (FOR BOTH CSE- -- -4TH 4TH 4TH 4TH- -- -SEM/MECH SEM/MECH SEM/MECH SEM/MECH- -- -3RD SEM) 3RD SEM) 3RD SEM) 3RD SEM)
MODULE MODULE MODULE MODULE- -- -III III III III
9 99 9
Locking Mechanisam
it is a variable associated with adata item X that reflects the status
of data item X with respect to possible opeartion that can applied to
it.
- A data item X can be locked in two modes.
Or It is the basic mechanisam which is applied to the problem of
concurrent schedular that is ,it helps up to make the dat5abase
consistent.
Types of Lock:
1) Shared Lock (S-Lock)
2) Execlusive Lock (X-Lock)0
Shared Lock: if a transaction T1 has obtained a shared mode lock
then T1 can read but write.
- it is locking mechanisam which also refered as S-Lock
Mechanisam.
- This lock mechanisam basically perform the read mechanisam in
which if more than one one transaction tries to perform the s-lock
mechanisam than it is acceptable (No-Conflict arises).
Execlusive Lock: if a transaction has obtained an execlusive mode
lock then T1 can both read and write
-It is denoted by symbol X
- whenever a transaction T has to access a data item, it first request
for lock in appropiate mode on data item X. if the lock manager of
GANDHI INSTITUTE FOR EDUCTAION & TECHNOLOGY GANDHI INSTITUTE FOR EDUCTAION & TECHNOLOGY GANDHI INSTITUTE FOR EDUCTAION & TECHNOLOGY GANDHI INSTITUTE FOR EDUCTAION & TECHNOLOGY
DEPARTMENT OF COMPUTER SCIENCE DEPARTMENT OF COMPUTER SCIENCE DEPARTMENT OF COMPUTER SCIENCE DEPARTMENT OF COMPUTER SCIENCE
PREPARED BY Asst.Prof.SANTOSH KUMAR RATH PREPARED BY Asst.Prof.SANTOSH KUMAR RATH PREPARED BY Asst.Prof.SANTOSH KUMAR RATH PREPARED BY Asst.Prof.SANTOSH KUMAR RATH
DATABASE MANAGEMENT SYSTEM DATABASE MANAGEMENT SYSTEM DATABASE MANAGEMENT SYSTEM DATABASE MANAGEMENT SYSTEM
(FOR BOTH CSE (FOR BOTH CSE (FOR BOTH CSE (FOR BOTH CSE- -- -4TH 4TH 4TH 4TH- -- -SEM/MECH SEM/MECH SEM/MECH SEM/MECH- -- -3RD SEM) 3RD SEM) 3RD SEM) 3RD SEM)
MODULE MODULE MODULE MODULE- -- -III III III III
10 10 10 10
11 11 11 11
12 12 12 12
T2:
Lock X(A)
Read(A)
Growing Phase
Lock X(B)
Read(B)
Display (A+B)
Unlock(A) Shrinking Phase
Unlock(B)
Time-Stamp Based Protocol:
- In such cases each transaction Ti in the system associated
with unique identifier.this unique identifier is called
timestamp of Ti denoted as Ts(Ti).
- If the transaction Tj enter the system after the transaction Ti
then Ts(Ti)<Ts(Tj). There are two simple method of
implementing this scheme.
- 1) use the value of the system clock as the timestamp
- 2) use a logical counter i.e incrment by one after a new
timestamp has been assigned.
- Ther are two time-stamp a) W-timestamp() b) R-timestamp()
- W-Timestamp()-it denotes largest timestamp of any
transaction that execute write() successfully.
- R-timestamp():- it denotes that the largest timestamp of any
transaction that executed Read() successfully.
- These timestamp are updated whenever a new read() or
write() instruction is executed.
GANDHI INSTITUTE FOR EDUCTAION & TECHNOLOGY GANDHI INSTITUTE FOR EDUCTAION & TECHNOLOGY GANDHI INSTITUTE FOR EDUCTAION & TECHNOLOGY GANDHI INSTITUTE FOR EDUCTAION & TECHNOLOGY
DEPARTMENT OF COMPUTER SCIENCE DEPARTMENT OF COMPUTER SCIENCE DEPARTMENT OF COMPUTER SCIENCE DEPARTMENT OF COMPUTER SCIENCE
PREPARED BY Asst.Prof.SANTOSH KUMAR RATH PREPARED BY Asst.Prof.SANTOSH KUMAR RATH PREPARED BY Asst.Prof.SANTOSH KUMAR RATH PREPARED BY Asst.Prof.SANTOSH KUMAR RATH
DATABASE MANAGEMENT SYSTEM DATABASE MANAGEMENT SYSTEM DATABASE MANAGEMENT SYSTEM DATABASE MANAGEMENT SYSTEM
(FOR BOTH CSE (FOR BOTH CSE (FOR BOTH CSE (FOR BOTH CSE- -- -4TH 4TH 4TH 4TH- -- -SEM/MECH SEM/MECH SEM/MECH SEM/MECH- -- -3RD SEM) 3RD SEM) 3RD SEM) 3RD SEM)
MODULE MODULE MODULE MODULE- -- -III III III III
13 13 13 13
14 14 14 14
15 15 15 15
16 16 16 16