SlideShare uma empresa Scribd logo
1 de 27
Baixar para ler offline
DATA BASE
MANAGEMEN
T SYSTEM
NAME - Sanat
Rampal UID -
22MSM4O216
CLASS - MSC DATA SCIENCES
SECTION - MSD-3
TRANSACTION
Introduction Acid
Properties
1.Atomicity
2.Consistency
3.Isolation
4. Durability
Transaction States
serializability
Transaction
The transaction is a set of operations used to perform a logcal unit of work.
A transaction is an action or series of actions. It is performed by a single user to perform operations for accessing the
contents of the database.
Example: Suppose an employee of bank transfers Rs 800 from X's account to Y's account.
X'sAccount
Open_Account(A) Old_Balance =
A.balance
New_Balance = Old_Balance - 800
X.balance = New_Balance
Y's Account
Open_Account(B) Old_Balance =
B.balance
New_Balance = Old_Balance + 800 Y.balance =
New_Balance
OPERATIONS OF
THE TRANSACTIONS
Following are the main operations of transaction:
Let's assume the value of A before starting of the transaction is 1000
The first operation reads A (read from the backend and come
under faster memeory say ram).
2nd simple Arthematic operation(perform in ram).
for change we use write (w(A)).
READ
(X)
WRIT
E(X)
Read operation is used to read the value of A from the
database.
write operation is used to change the value in the
database.
Remember we didn't change anything in database its all ongoing
in ram.
now read the value of B(read from backend). To
change the value of B we uses W(B).
Last we use the commit operation for saving the ram data in
hard disk.
Let's take an example to debit transaction from an
account which consists of following operations:
ROLLBACK: use to undo the work done.
R(A)-1000
A=A-500
W(A)-50
0
R(B)
=200
0 B=B+500 w(B)-2500
COMMIT: It is used to end
the current
transaction and
make permanent
cahnges
performed in
the transaction.
Transac
tion
propert
y
The transaction has the four properties. These are used to maintain consistency in a
database, before and after the transaction.
ATOMICI
DURABIL
1
R E A
D ( A )
2
R E A
D ( B )
ATOMI
CITY
It states that all operations of the transaction take place at once if not, the transaction is aborted. There is
no midway, i.e., the transaction cannot occur partially. Each transaction is treated as one unit and either
run to completion or is not executed at all.
Atomicity involves the following two operations:
Abort: If a transaction aborts then all the changes made are not visible.
Commit: If a transaction commits then all the changes made are visible.
Example: Let's assume that following transaction T consisting of T1 and T2. A consists of Rs 600 and B consists of
Rs 300. Transfer Rs 100 from account A to account B.
After completion of the transaction, A consists of Rs 500 and B consists of Rs 400.
If the transaction T fails after the completion of transaction T1 but before
completion of transaction T2, then the amount will be deducted from A but not
added to B. This shows the inconsistent database state.
Consistency
The integrity constraints are maintained so that the database is consistent before and after the transaction. The execution
of a transaction will leave a database in either its prior stable state or a new stable state.
The consistent property of database states that every transaction sees a consistent database instance. The
transaction is used to transform the database from one consistent state to another consistent state.
For example: The total amount must be maintained before or after the transaction.
Total before T occurs = 600+300=900 Total after
T occurs= 500+400=900
Therefore, the database is consistent. In the case when T1 is completed but T2 fails, then inconsistency will occur.
Isolation
It shows that the data which is used at the time of execution of a transaction cannot be used by the second transaction until the first one is completed.
In isolation, if the transaction T1 is being executed and using the data item X, then that data item can't be accessed by any other transaction T2 until
the transaction T1 ends.
Durability
The durability property is used to indicate the performance of the database's consistent state. It states that the transaction made the
permanent changes.
They cannot be lost by the erroneous operation of a faulty transaction or by the system failure. When a transaction is completed, then the
database reaches a state known as the consistent state. That consistent state cannot be lost, even in the event of a system's failure.
The recovery subsystem of the DBMS has the responsibility of Durability property.
STATES OF
TRANSACTION
when the transaction executed, it passes through some of the states
Active state
The active state is the first state of every transaction. In this state, the transaction is being executed.
For example: Insertion or deletion or updating a record is done here. But all the records are still not saved to the database.
Partially committed
In the partially committed state, a transaction executes its final operation, but the data is still not saved to the database.
Committed
A transaction is said to be in a committed state if it executes all its operations successfully. In this state, all the effects are
now permanently saved on the database system.A failed state can no longer proceed further.
Failed state
If any of the checks made by the database recovery system fails, then the transaction is said to be in the failed state.
Aborted
If any of the checks fail and the transaction has reached a failed state then the database recovery system will
make sure that the database is in its previous consistent state. If not then it will abort or roll back the transaction
to bring the database into a consistent state.
If the transaction fails in the middle of the transaction then before executing the transaction, all the executed transactions
are rolled back to its consistent state.
After aborting the transaction, the database recovery module will select one of the two operations:
1.Re-start the transaction
2.Kill the transaction
Schedule
A series of operation from one transaction to another transaction is known as schedule. It is used to preserve
the order of the operation in each of the individual transaction.
Basically there are two types :
Serial schedule parallel
schedule
Serial schedule : The serial schedule is a type of schedule where one transaction is executed completely
before starting another transaction. In the serial schedule, when the first transaction
completes its cycle, then the next transaction is executed.
Parallel schedule multiple transaction can come at a same time and can be start or executed.
Serializability Serializability of schedules ensures that a non-serial schedule is equivalent to a
serial schedule. It helps in maintaining the transactions to execute
simultaneously without interleaving one another.
What is a serializable schedule?
A non-serial schedule is called a serializable schedule if it can be converted to its equivalent serial
schedule. In simple words, if a non-serial schedule and a serial schedule result in the same then the non-
serial schedule is called a serializable schedule.
Testing of Serializability
To test the serializability of a schedule, we can use Serialization Graph or Precedence Graph. A
serialization Graph is nothing but a Directed Graph of the entire transactions of a schedule.
conflicting pair in transactions
Two operations inside a schedule are called conflicting if they meet these three conditions:
1.They belong to two different transactions.
2.They are working on the same data piece.
3.One of them is performing the WRITE operation.
To conclude, let’s take two operations on data: "a". The conflicting pairs are:
1.READ(a) - WRITE(a)
2.WRITE(a) - WRITE(a)
3.WRITE(a) - READ(a)
t1
R(x)
W(x)
t2
R(y)
W(y)
R(x)
W(x)
Conflict Serializability A non-serial schedule is a conflict serializable if, after performing some swapping
on the non-conflicting operation results in a serial schedule. It is checked using
the non-serial schedule and an equivalent serial schedule. This process of
checking is called Conflict Serializability.
As there is no loop in the graph, it is a conflict serializable schedule as
well as a serial schedule. Since it is a serial schedule, we can detect
the order of transactions as well.
The order of the Transactions: t1 will execute first as there is no
incoming edge on T1. t3 will execute second as it depends on T1 only.
t2 will execute at last as it depends on both T1 and T3.
So, order of its equivalent serial schedule is: t1 --> t3 --> t2
View Serializability
If a non-serial schedule is view equivalent to some other serial schedule then the schedule is called View
Serializable Schedule. It is needed to ensure the consistency of a schedule.
view equivalency
The two conditions needed by schedules(S1 and S2) to be view equivalent are:
Initial read must be on the same piece of data.
Example: If transaction t1 is reading "A" from database in schedule S1, then in schedule S2, t1 must read A.
Final write must be on the same piece of data.
Example: If a transaction t1 updated A at last in S1, then in S2, t1 should perform final write as well.
The mid sequence should also be in the same order.
Example: If t1 is reading A which is updated by t2 in S1, then in S2, t1 should read A which should be updated by t2. This
process of checking view equivalency of a schedule is called View Serializability.
t1
R(x)
W(x)
R(y)
W(y)
t2
R(x)
W(x)
R(y)
W(y)
t1
R(x)
W(x)
R(y)
W(y)
t2
R(x)
W(x)
R(y)
Example: We have a schedule "S" having two
transactions t1, and t2 working simultaneously.
Let's form its view equivalent schedule (S') by interchanging
mid-read-write operations of both the transactions. S':
Since a view equivalent schedule is possible, it is a view
serializable schedule.
t1
R(x)
W(x)
t2
W(x)
t3
W(x)
Actual process for checking view serializability
First, check for conflict serializability.
Check for a blind write. If there is a blind write, then the schedule can be view serializable. So, check its
view serializability using the view equivalent schedule technique (stated above). If there is no blind write,
then the schedule can never be view serializable.
Blind write is writing a value or piece of data without reading it.
Example:
We have a schedule "S" having two transactions t1, t2, and t3 working simultaneously.
It's precedence graph:
Since there is a loop present, the schedule is non-conflicting serializable schedule. Now, there are blind writes [t2 -> w(x)
and t3 -> w(x)] present, hence check for View Serializability.
Benefits of Serialization
Serialization helps in checking concurrency control between multiple transactions. It also helps in maintaining consistency in
the database before and after any transaction. Serializable schedules are resource-efficient and help in improving CPU
throughput(total work done in a certain time).
Note:- if we get loop or cycle in precedence graph then we can say that
the schedule is not conflict serializable schedule
THANK
YOU
dbms sanat ppt.pdf

Mais conteúdo relacionado

Semelhante a dbms sanat ppt.pdf

15. Transactions in DBMS
15. Transactions in DBMS15. Transactions in DBMS
15. Transactions in DBMS
koolkampus
 
Unit 5 - PPT.pdf DBMS SRM university chennai
Unit 5 - PPT.pdf DBMS SRM university chennaiUnit 5 - PPT.pdf DBMS SRM university chennai
Unit 5 - PPT.pdf DBMS SRM university chennai
PriyanshuJha69
 
Transaction management
Transaction managementTransaction management
Transaction management
renuka_a
 

Semelhante a dbms sanat ppt.pdf (20)

15. Transactions in DBMS
15. Transactions in DBMS15. Transactions in DBMS
15. Transactions in DBMS
 
Ch15 3717
Ch15 3717Ch15 3717
Ch15 3717
 
Ch15 3717
Ch15 3717Ch15 3717
Ch15 3717
 
Unit06 dbms
Unit06 dbmsUnit06 dbms
Unit06 dbms
 
DBMS UNIT 4
DBMS UNIT 4DBMS UNIT 4
DBMS UNIT 4
 
Question answer
Question answerQuestion answer
Question answer
 
Unit 5 - PPT.pdf DBMS SRM university chennai
Unit 5 - PPT.pdf DBMS SRM university chennaiUnit 5 - PPT.pdf DBMS SRM university chennai
Unit 5 - PPT.pdf DBMS SRM university chennai
 
Transaction Processing Concept
Transaction Processing ConceptTransaction Processing Concept
Transaction Processing Concept
 
Transaction management
Transaction managementTransaction management
Transaction management
 
Unit 4 dbms
Unit 4 dbmsUnit 4 dbms
Unit 4 dbms
 
Unit-IV_transaction.pptx
Unit-IV_transaction.pptxUnit-IV_transaction.pptx
Unit-IV_transaction.pptx
 
Serializability
SerializabilitySerializability
Serializability
 
DBMS UNIT IV.pptx
DBMS UNIT IV.pptxDBMS UNIT IV.pptx
DBMS UNIT IV.pptx
 
Distributed Database Design and Relational Query Language
Distributed Database Design and Relational Query LanguageDistributed Database Design and Relational Query Language
Distributed Database Design and Relational Query Language
 
Tybsc cs dbms2 notes
Tybsc cs dbms2 notesTybsc cs dbms2 notes
Tybsc cs dbms2 notes
 
Dbms
DbmsDbms
Dbms
 
transaction_processing.ppt
transaction_processing.ppttransaction_processing.ppt
transaction_processing.ppt
 
DBMS 4.pdf
DBMS 4.pdfDBMS 4.pdf
DBMS 4.pdf
 
DBMS-chap 2-Concurrency Control
DBMS-chap 2-Concurrency ControlDBMS-chap 2-Concurrency Control
DBMS-chap 2-Concurrency Control
 
Transaction Processing in DBMS.pptx
Transaction Processing in DBMS.pptxTransaction Processing in DBMS.pptx
Transaction Processing in DBMS.pptx
 

Último

Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 

Último (20)

Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Magic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptxMagic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 

dbms sanat ppt.pdf

  • 1. DATA BASE MANAGEMEN T SYSTEM NAME - Sanat Rampal UID - 22MSM4O216 CLASS - MSC DATA SCIENCES SECTION - MSD-3
  • 2.
  • 4.
  • 5. Transaction The transaction is a set of operations used to perform a logcal unit of work. A transaction is an action or series of actions. It is performed by a single user to perform operations for accessing the contents of the database. Example: Suppose an employee of bank transfers Rs 800 from X's account to Y's account. X'sAccount Open_Account(A) Old_Balance = A.balance New_Balance = Old_Balance - 800 X.balance = New_Balance Y's Account Open_Account(B) Old_Balance = B.balance New_Balance = Old_Balance + 800 Y.balance = New_Balance
  • 6. OPERATIONS OF THE TRANSACTIONS Following are the main operations of transaction: Let's assume the value of A before starting of the transaction is 1000 The first operation reads A (read from the backend and come under faster memeory say ram). 2nd simple Arthematic operation(perform in ram). for change we use write (w(A)). READ (X) WRIT E(X) Read operation is used to read the value of A from the database. write operation is used to change the value in the database. Remember we didn't change anything in database its all ongoing in ram. now read the value of B(read from backend). To change the value of B we uses W(B). Last we use the commit operation for saving the ram data in hard disk. Let's take an example to debit transaction from an account which consists of following operations: ROLLBACK: use to undo the work done. R(A)-1000 A=A-500 W(A)-50 0 R(B) =200 0 B=B+500 w(B)-2500
  • 7. COMMIT: It is used to end the current transaction and make permanent cahnges performed in the transaction.
  • 8. Transac tion propert y The transaction has the four properties. These are used to maintain consistency in a database, before and after the transaction. ATOMICI DURABIL
  • 9. 1 R E A D ( A ) 2 R E A D ( B ) ATOMI CITY It states that all operations of the transaction take place at once if not, the transaction is aborted. There is no midway, i.e., the transaction cannot occur partially. Each transaction is treated as one unit and either run to completion or is not executed at all. Atomicity involves the following two operations: Abort: If a transaction aborts then all the changes made are not visible. Commit: If a transaction commits then all the changes made are visible. Example: Let's assume that following transaction T consisting of T1 and T2. A consists of Rs 600 and B consists of Rs 300. Transfer Rs 100 from account A to account B. After completion of the transaction, A consists of Rs 500 and B consists of Rs 400. If the transaction T fails after the completion of transaction T1 but before completion of transaction T2, then the amount will be deducted from A but not added to B. This shows the inconsistent database state.
  • 10. Consistency The integrity constraints are maintained so that the database is consistent before and after the transaction. The execution of a transaction will leave a database in either its prior stable state or a new stable state. The consistent property of database states that every transaction sees a consistent database instance. The transaction is used to transform the database from one consistent state to another consistent state. For example: The total amount must be maintained before or after the transaction. Total before T occurs = 600+300=900 Total after T occurs= 500+400=900 Therefore, the database is consistent. In the case when T1 is completed but T2 fails, then inconsistency will occur.
  • 11. Isolation It shows that the data which is used at the time of execution of a transaction cannot be used by the second transaction until the first one is completed. In isolation, if the transaction T1 is being executed and using the data item X, then that data item can't be accessed by any other transaction T2 until the transaction T1 ends. Durability The durability property is used to indicate the performance of the database's consistent state. It states that the transaction made the permanent changes. They cannot be lost by the erroneous operation of a faulty transaction or by the system failure. When a transaction is completed, then the database reaches a state known as the consistent state. That consistent state cannot be lost, even in the event of a system's failure. The recovery subsystem of the DBMS has the responsibility of Durability property.
  • 13. when the transaction executed, it passes through some of the states
  • 14. Active state The active state is the first state of every transaction. In this state, the transaction is being executed. For example: Insertion or deletion or updating a record is done here. But all the records are still not saved to the database. Partially committed In the partially committed state, a transaction executes its final operation, but the data is still not saved to the database. Committed A transaction is said to be in a committed state if it executes all its operations successfully. In this state, all the effects are now permanently saved on the database system.A failed state can no longer proceed further. Failed state If any of the checks made by the database recovery system fails, then the transaction is said to be in the failed state.
  • 15. Aborted If any of the checks fail and the transaction has reached a failed state then the database recovery system will make sure that the database is in its previous consistent state. If not then it will abort or roll back the transaction to bring the database into a consistent state. If the transaction fails in the middle of the transaction then before executing the transaction, all the executed transactions are rolled back to its consistent state. After aborting the transaction, the database recovery module will select one of the two operations: 1.Re-start the transaction 2.Kill the transaction
  • 16. Schedule A series of operation from one transaction to another transaction is known as schedule. It is used to preserve the order of the operation in each of the individual transaction. Basically there are two types : Serial schedule parallel schedule Serial schedule : The serial schedule is a type of schedule where one transaction is executed completely before starting another transaction. In the serial schedule, when the first transaction completes its cycle, then the next transaction is executed. Parallel schedule multiple transaction can come at a same time and can be start or executed.
  • 17. Serializability Serializability of schedules ensures that a non-serial schedule is equivalent to a serial schedule. It helps in maintaining the transactions to execute simultaneously without interleaving one another. What is a serializable schedule? A non-serial schedule is called a serializable schedule if it can be converted to its equivalent serial schedule. In simple words, if a non-serial schedule and a serial schedule result in the same then the non- serial schedule is called a serializable schedule. Testing of Serializability To test the serializability of a schedule, we can use Serialization Graph or Precedence Graph. A serialization Graph is nothing but a Directed Graph of the entire transactions of a schedule.
  • 18.
  • 19. conflicting pair in transactions Two operations inside a schedule are called conflicting if they meet these three conditions: 1.They belong to two different transactions. 2.They are working on the same data piece. 3.One of them is performing the WRITE operation. To conclude, let’s take two operations on data: "a". The conflicting pairs are: 1.READ(a) - WRITE(a) 2.WRITE(a) - WRITE(a) 3.WRITE(a) - READ(a)
  • 20. t1 R(x) W(x) t2 R(y) W(y) R(x) W(x) Conflict Serializability A non-serial schedule is a conflict serializable if, after performing some swapping on the non-conflicting operation results in a serial schedule. It is checked using the non-serial schedule and an equivalent serial schedule. This process of checking is called Conflict Serializability. As there is no loop in the graph, it is a conflict serializable schedule as well as a serial schedule. Since it is a serial schedule, we can detect the order of transactions as well. The order of the Transactions: t1 will execute first as there is no incoming edge on T1. t3 will execute second as it depends on T1 only. t2 will execute at last as it depends on both T1 and T3. So, order of its equivalent serial schedule is: t1 --> t3 --> t2
  • 21.
  • 22. View Serializability If a non-serial schedule is view equivalent to some other serial schedule then the schedule is called View Serializable Schedule. It is needed to ensure the consistency of a schedule. view equivalency The two conditions needed by schedules(S1 and S2) to be view equivalent are: Initial read must be on the same piece of data. Example: If transaction t1 is reading "A" from database in schedule S1, then in schedule S2, t1 must read A. Final write must be on the same piece of data. Example: If a transaction t1 updated A at last in S1, then in S2, t1 should perform final write as well. The mid sequence should also be in the same order. Example: If t1 is reading A which is updated by t2 in S1, then in S2, t1 should read A which should be updated by t2. This process of checking view equivalency of a schedule is called View Serializability.
  • 23. t1 R(x) W(x) R(y) W(y) t2 R(x) W(x) R(y) W(y) t1 R(x) W(x) R(y) W(y) t2 R(x) W(x) R(y) Example: We have a schedule "S" having two transactions t1, and t2 working simultaneously. Let's form its view equivalent schedule (S') by interchanging mid-read-write operations of both the transactions. S': Since a view equivalent schedule is possible, it is a view serializable schedule.
  • 24. t1 R(x) W(x) t2 W(x) t3 W(x) Actual process for checking view serializability First, check for conflict serializability. Check for a blind write. If there is a blind write, then the schedule can be view serializable. So, check its view serializability using the view equivalent schedule technique (stated above). If there is no blind write, then the schedule can never be view serializable. Blind write is writing a value or piece of data without reading it. Example: We have a schedule "S" having two transactions t1, t2, and t3 working simultaneously. It's precedence graph:
  • 25. Since there is a loop present, the schedule is non-conflicting serializable schedule. Now, there are blind writes [t2 -> w(x) and t3 -> w(x)] present, hence check for View Serializability. Benefits of Serialization Serialization helps in checking concurrency control between multiple transactions. It also helps in maintaining consistency in the database before and after any transaction. Serializable schedules are resource-efficient and help in improving CPU throughput(total work done in a certain time). Note:- if we get loop or cycle in precedence graph then we can say that the schedule is not conflict serializable schedule