
- DBMS Tutorial
- DBMS - Home
- DBMS - Overview
- DBMS - Architecture
- DBMS - Data Models
- DBMS - Data Schemas
- DBMS - Data Independence
- Entity Relationship Model
- DBMS - ER Model Basic Concepts
- DBMS - ER Diagram Representation
- DBMS - Generalization, Aggregation
- Relational Model
- DBMS - Codd's Rules
- DBMS - Relational Data Model
- DBMS - Relational Algebra
- DBMS - ER to Relational Model
- DBMS- SQL Overview
- Relational Database Design
- DBMS - Database Normalization
- DBMS - Database Joins
- Storage and File Structure
- DBMS - Storage System
- DBMS - File Structure
- Indexing and Hashing
- DBMS - Indexing
- DBMS - Hashing
- Transaction And Concurrency
- DBMS - Transaction
- DBMS - Concurrency Control
- DBMS - Deadlock
- Backup and Recovery
- DBMS - Data Backup
- DBMS - Data Recovery
- DBMS Useful Resources
- DBMS - Quick Guide
- DBMS - Useful Resources
- DBMS - Discussion
What are the different ways the transaction can be executed(DBMS)?
There are three possible ways in which a transaction can be executed. These are as follows −
Serial execution − In serial execution, the second transaction can begin its execution only after the first transaction has completed. This is possible on a uniprocessor system.
Parallel execution − In parallel execution, two transactions can start their execution exactly at the same instant of time. For this, we require more than one processor.
Concurrent execution − In concurrent execution, execution of the second process can begin even before the process has completed its execution.
Let us consider two transactions T1 and T2. In concurrent execution, the CPU executes some instructions of transaction T1, then moves to the second transaction and executes its instructions for some time and again it comes back to the first transaction.
The cycle is repeated until all the instructions of both the transactions are executed. The process is called context switching.
Advantages
The advantages of transaction in the database management system (DBMS) are as follows −
- Optimum utilization of resources.
- Average waiting time is less.
- Response time is shorter.
- Throughput is more (number of processors executed on one unit of time).
Example
Given below is an example of the serial execution −
Let us consider two transactions T1 and T2 where T1 performs transfer Rs.150 from account A to account B and similarly T2 transfers 10% of balance from A to B.
Solution
T1 T2 Read(A) Read(A) A=A-150 temp =0.1 *A Write(A) A=A-temp Read(B) Write(A) B=B-150 Read(B) B=B+temp Write(B)
The order in which the instruction of transactions T1 and T2 are executed is called a Schedule. The possible serial schedules are as follows −
Let A= 200, B=200
Schedule S1 and S2 keeps the database in consistent state.
In general if the system consists of n number of transactions, then we can generate n! number of valid serial schedules.
- Related Articles
- What are different transaction isolation levels in DBMS?
- What are the states of transaction in DBMS?
- What is transaction processing? Explain the properties of the transaction(DBMS)
- What are the different types of DBMS?
- What will happen to the current MySQL transaction if a START TRANSACTION command is executed in the middle of that current transaction?
- What will happen to MySQL current transaction, if in the middle of that transaction, the DDL statement is executed?
- What are the different types of schedules in DBMS?
- What are the different ways for a method to be overloaded in C#?
- What are the different ways of cooking eggs?
- What are the different ways to install pandas?
- What are all the ways keyword ‘this’ can be used in Java?
- What are all the ways an object can be created in Java?
- What is dirty read in a transaction(DBMS)?
- What are different types of DBMS languages?
- What are different hashing methods in DBMS?
