What is processing. ? Processing basically points to anything that leads to a change in state. Before we go any further, let us first understand what a database is. A database is basically a collection of records or data that have an implicit meaning, for easy retrieval. A database management system is basically a system or a collection of programs that enable the creation and maintenance of a database. A transaction involves activities such as read and writes operations that change the stored data. It basically includes insertion, deletion and modification operations that change the state of a database. A transaction may be specified between begin transaction and end transaction boundaries. If such operations only retrieve data and do not update the database, then such operations are known as read-only transaction.
Multiprogramming operating systems allow a large no. of users to carry out transactions concurrently which is in contrast to the single-user DBMS which allows only one user to access the CPU at a time. Such multiprogramming operating systems use the concept of multiprogramming. In this, the CPU executes some commands from one process, then suspends the process and executes commands from some other process and so on. A process is resumed from where it was suspended, whenever it gets is chance to use the CPU again. And hence concurrent execution of commands is actually interleaved. There are various examples of such transactions. These can be systems in banks, ticket reservation systems and so on which use the concept of multiprogramming to carry out transactions. A transaction has certain basic desirable properties called the ACID properties that must be enforced by concurrency control or recovery methods of DBMS.
Atomicity, which states that a transaction is an atomic unit and must either be executed completely or not at all. Consistency preservation that is a transaction satisfies this property of and only if it takes a database from one consistent state to another. Isolation, that is a transaction must appear as it is executing in isolation from the other transactions and should not be interfered by them.
Durability that is the changes applied to the database must be permanent and must not be lost due to any one or the other failures. When transactions execute in a concurrent manner, several problems can occur. These can be the lost update problem in which the updated value of one transaction is lost because the other transaction reads the value before its update is permanently recorded in the database and hence the final value is also incorrect. Another problem is the temporary update problem in which a transaction updates the database but fails due to some reason. However before the value is updated back to its original value, another transaction accesses that incorrect value. This value is known as the dirty read and hence this problem is also known as the dirty read problem. If one transaction is updating some the values in the database, and other transaction calculating an aggregate , than the aggregate may calculate some value before they are updated and hence this problem Is known as the incorrect summary problem. Whenever a transaction is submitted to DBMS for execution, the system must ensure that all of its operations are completed and not just a few of them.
It is also the responsibility of the system to ensure that the effect of the transaction must be permanently recorded in the database. However, the system may fail to do the above stated if a transaction fails in the process of it being executed. There are several reasons as to why a transaction fails and these may be classified as hardware, system or media failures. A computer or a system crash may cause a transaction to fail. A hardware, software or a network error that occurs in the system may cause a transaction to fail in the middle of its execution. For example- a main memory failure. Certain operations in a transaction such as division by zero may also cause it to fail. A transaction may also fail if there is an arithmetic overflow or because of erroneous parameter values or logical programming errors. Logical errors or exception conditions detected by a transaction may necessitate the cancellation of a transaction.
Some of the disk blocks that store the data values may lose their data due to a read or write malfunction or because of a disk read or write head crash. An endless list of problems that may include physical problems and catastrophes such as power failure, theft, sabotage fire and so on may also be the factors that lead to the failure of a transaction. To be able to recover from such failures, the system maintains a system log that contains the records of all the transaction operations, when did it begin, when it ended, the read and write operations carried out and so on. This information facilitates recovery from failures by accessing these stores information and hence the failed transaction may be carried out to serve its purpose for which it was intended in the first place.
-Simran Mehta