This document provides an overview of transaction concepts in database management systems. It discusses the ACID properties that transactions must satisfy, including atomicity, consistency, isolation, and durability. Transaction concepts such as states, schedules, serializability, and concurrency control techniques are covered. The document defines transactions, reads and writes operations, and explains how transactions move between states like active, partially committed, aborted, and committed. It also discusses schedule equivalence, conflict serializability, and recoverable schedules. The goal of the document is to introduce fundamental transaction management topics in databases.
The Advanced Encryption Standard, also known by its original name Rijndael, is a specification for the encryption of electronic data established by the U.S.
Elliptic Curve Cryptography was presented by Ajithkumar Vyasarao. He began with an introduction to ECC, noting its advantages over RSA like smaller key sizes providing equal security. He described how ECC works using elliptic curves over real numbers and finite fields. He demonstrated point addition and scalar multiplication on curves. ECC can be used for applications like smart cards and mobile devices. For key exchange, Alice and Bob can agree on a starting point and generate secret keys by multiplying a private value with the shared point. ECC provides security through the difficulty of solving the elliptic curve discrete logarithm problem.
The document discusses the International Data Encryption Algorithm (IDEA). It was developed in 1990 as a replacement for the Data Encryption Standard. IDEA is a symmetric block cipher that uses a 128-bit key to encrypt 64-bit blocks of plaintext into ciphertext. The key is divided into 52 subkeys that are used in 8 rounds of encryption/decryption operations involving XOR, addition, and multiplication. IDEA was used in PGP v2.0 and can encrypt sensitive data for applications like financial services, broadcasting, and government use.
A graph G is composed of vertices V connected by edges E. It can be represented using an adjacency matrix or adjacency lists. Graph search algorithms like depth-first search (DFS) and breadth-first search (BFS) are used to traverse the graph and find paths between vertices. DFS recursively explores edges until reaching the end of a branch before backtracking, while BFS explores all neighbors at each level before moving to the next.
Data manipulation instructions perform operations on data and provide computational capabilities for computers. These instructions are divided into three basic types: arithmetic instructions, logical and bit manipulation instructions, and shift instructions. Arithmetic instructions include addition, subtraction, multiplication, division, and incrementing and decrementing values. Logical and bit manipulation instructions operate on individual bits and include AND, OR, XOR, and clearing, complementing, and manipulating carry bits. Shift instructions shift the contents of an operand left or right in logical, arithmetic, or rotate operations.
This document provides an overview of cryptography and its applications. It discusses the history of cryptography beginning in ancient Egypt. It defines basic cryptography terminology like plaintext, ciphertext, cipher, key, encryption, decryption, cryptography, and cryptanalysis. It describes classical ciphers like the Caesar cipher and substitution ciphers. It also discusses cryptanalysis techniques, transposition ciphers, modern symmetric ciphers, public key cryptography including RSA, key distribution methods, and hybrid encryption.
This document provides an overview of the chapters and content covered in a textbook on computer organization and architecture. The chapters cover digital logic circuits, digital components, data representation, register transfer and microoperations, basic computer organization and design, programming and instruction sets, control units, processor design, pipelining and parallel processing, arithmetic, input/output, and memory organization. Key concepts discussed include logic gates, boolean algebra, combinational and sequential circuits, registers, buses, arithmetic and logic operations, and memory.
Hashing is a technique used to uniquely identify objects by assigning each object a key, such as a student ID or book ID number. A hash function converts large keys into smaller keys that are used as indices in a hash table, allowing for fast lookup of objects in O(1) time. Collisions, where two different keys hash to the same index, are resolved using techniques like separate chaining or linear probing. Common applications of hashing include databases, caches, and object representation in programming languages.
The Advanced Encryption Standard, also known by its original name Rijndael, is a specification for the encryption of electronic data established by the U.S.
Elliptic Curve Cryptography was presented by Ajithkumar Vyasarao. He began with an introduction to ECC, noting its advantages over RSA like smaller key sizes providing equal security. He described how ECC works using elliptic curves over real numbers and finite fields. He demonstrated point addition and scalar multiplication on curves. ECC can be used for applications like smart cards and mobile devices. For key exchange, Alice and Bob can agree on a starting point and generate secret keys by multiplying a private value with the shared point. ECC provides security through the difficulty of solving the elliptic curve discrete logarithm problem.
The document discusses the International Data Encryption Algorithm (IDEA). It was developed in 1990 as a replacement for the Data Encryption Standard. IDEA is a symmetric block cipher that uses a 128-bit key to encrypt 64-bit blocks of plaintext into ciphertext. The key is divided into 52 subkeys that are used in 8 rounds of encryption/decryption operations involving XOR, addition, and multiplication. IDEA was used in PGP v2.0 and can encrypt sensitive data for applications like financial services, broadcasting, and government use.
A graph G is composed of vertices V connected by edges E. It can be represented using an adjacency matrix or adjacency lists. Graph search algorithms like depth-first search (DFS) and breadth-first search (BFS) are used to traverse the graph and find paths between vertices. DFS recursively explores edges until reaching the end of a branch before backtracking, while BFS explores all neighbors at each level before moving to the next.
Data manipulation instructions perform operations on data and provide computational capabilities for computers. These instructions are divided into three basic types: arithmetic instructions, logical and bit manipulation instructions, and shift instructions. Arithmetic instructions include addition, subtraction, multiplication, division, and incrementing and decrementing values. Logical and bit manipulation instructions operate on individual bits and include AND, OR, XOR, and clearing, complementing, and manipulating carry bits. Shift instructions shift the contents of an operand left or right in logical, arithmetic, or rotate operations.
This document provides an overview of cryptography and its applications. It discusses the history of cryptography beginning in ancient Egypt. It defines basic cryptography terminology like plaintext, ciphertext, cipher, key, encryption, decryption, cryptography, and cryptanalysis. It describes classical ciphers like the Caesar cipher and substitution ciphers. It also discusses cryptanalysis techniques, transposition ciphers, modern symmetric ciphers, public key cryptography including RSA, key distribution methods, and hybrid encryption.
This document provides an overview of the chapters and content covered in a textbook on computer organization and architecture. The chapters cover digital logic circuits, digital components, data representation, register transfer and microoperations, basic computer organization and design, programming and instruction sets, control units, processor design, pipelining and parallel processing, arithmetic, input/output, and memory organization. Key concepts discussed include logic gates, boolean algebra, combinational and sequential circuits, registers, buses, arithmetic and logic operations, and memory.
Hashing is a technique used to uniquely identify objects by assigning each object a key, such as a student ID or book ID number. A hash function converts large keys into smaller keys that are used as indices in a hash table, allowing for fast lookup of objects in O(1) time. Collisions, where two different keys hash to the same index, are resolved using techniques like separate chaining or linear probing. Common applications of hashing include databases, caches, and object representation in programming languages.
Block ciphers encrypt data in fixed-size blocks and can be categorized as stream or block ciphers. The document describes block cipher principles including the Feistel cipher structure, ideal block ciphers, and the practical block cipher Data Encryption Standard (DES). It provides details on the DES algorithm, key schedule, substitution boxes, diffusion and confusion properties, and modern cryptanalysis techniques such as differential and linear cryptanalysis. The DES standard utilizes a 56-bit key and has been superseded by algorithms with stronger 128-bit keys due to advances in computing power allowing brute force attacks on its 56-bit key.
Csc1401 lecture03 - computer arithmetic - arithmetic and logic unit (alu)IIUM
1. The document discusses various ways that computers represent integers and floating point numbers for processing, including unsigned, sign magnitude, one's complement, two's complement, and biased representations for integers. It also discusses the typical components of the floating point format including the sign, exponent, and significand.
2. Key aspects of arithmetic operations like addition, subtraction, multiplication, and division are described for different number representations. The two's complement system is highlighted as the most common approach used in computers due to its simplicity.
3. Standards like IEEE 754 are covered which define floating point standards to help ensure portability of numeric programs across systems.
In these slides the registration organization and stack organization have discussed in detail. Stack organization is discussed with the aid of animation to let the user understand it in a better and easy way.
This document defines and provides examples of graphs and their representations. It discusses:
- Graphs are data structures consisting of nodes and edges connecting nodes.
- Examples of directed and undirected graphs are given.
- Graphs can be represented using adjacency matrices or adjacency lists. Adjacency matrices store connections in a grid and adjacency lists store connections as linked lists.
- Key graph terms are defined such as vertices, edges, paths, and degrees. Properties like connectivity and completeness are also discussed.
The document provides an example of AES encryption with a 128-bit key and plaintext. It shows the steps of each round, including generating round keys, adding the round key, byte substitution, shifting rows, mixing columns (except for the last round), and xoring the state with the round key. The key schedule expands the initial key into 11 round keys. The example walks through all 10 rounds of encryption to produce the final ciphertext.
In cryptography, a one-time pad (OTP) is an encryption technique that cannot be cracked if used correctly. In this technique, a plaintext is paired with a random ...
This is a Presentation On use of AES Algorithm To Encrypt Or Decrypt a Text File. This Algorithm is the latest and better than DES. It is a Networking Presentation. Thank You.
Merge sort is a sorting technique based on divide and conquer technique. With worst-case time complexity being Ο(n log n), it is one of the most respected algorithms.
Merge sort first divides the array into equal halves and then combines them in a sorted manner.
The document discusses various searching and sorting algorithms. It describes linear search, binary search, and interpolation search for searching unsorted and sorted lists. It also explains different sorting algorithms like bubble sort, selection sort, insertion sort, quicksort, shellsort, heap sort, and merge sort. Linear search searches sequentially while binary search uses divide and conquer. Sorting algorithms like bubble sort, selection sort, and insertion sort are in-place and have quadratic time complexity in the worst case. Quicksort, mergesort, and heapsort generally have better performance.
This chapter discusses computer abstractions and technology. It covers the hardware/software interface and how high-level programs are translated to machine code. The chapter also examines different types of computers like PCs, servers, and embedded systems. It describes how computers use layers of abstraction in both hardware and software. The chapter concludes by discussing performance measures like response time and throughput, and how techniques like parallelism can improve performance within power constraints.
The document discusses the instruction cycle in a computer system. The instruction cycle retrieves program instructions from memory, decodes what actions they specify, and carries out those actions. It has four main steps: 1) fetching the next instruction from memory and storing it in the instruction register, 2) decoding the encoded instruction, 3) reading the effective address for direct or indirect memory instructions, and 4) executing the instruction by passing control signals to relevant components like the ALU to perform the specified actions. The instruction cycle is the basic operational process in which a computer executes instructions.
A linked list is a linear data structure consisting of nodes that are connected to each other through pointers. Each node contains a data field and a pointer to the next node. Linked lists allow for efficient insertion and removal of nodes and are more flexible than arrays in terms of memory allocation. Common types of linked lists include singly linked lists, doubly linked lists, circular linked lists, and header linked lists.
Chapter 02 instructions language of the computerBảo Hoang
Here are the steps to translate the MIPS assembly language into machine language:
1. lw $t0,300($t1) # Load A[300] into register $t0
Opcode: 35 (load word)
rs: 13 ($t1)
rt: 8 ($t0)
offset: 300
2. add $t2,$s2,$t0 # Calculate h + A[300] and put in $t2
Opcode: 0 (add)
rs: 17 ($s2)
rt: 8 ($t0)
rd: 9 ($t2)
3. sw $t2,300($t1) # Store result back into
This document summarizes simplified DES (SDES), a simplified version of the Data Encryption Standard (DES) designed for educational purposes. SDES uses an 8-bit plaintext, 10-bit key, and 8-bit ciphertext. It has two rounds that each apply an initial permutation, complex 2-input function fk using a key, bit-switching, and inverse permutation. The function fk applies expansion/permutation, XOR with a key to generate left and right halves, S-box lookups, permutation, XOR, and switching input bits for the next round. Key generation applies permutations and shifts to the input key to derive two 8-bit subkeys for each round.
This document provides an overview of serial communication and UART operation. It discusses asynchronous and synchronous serial communication, UART block diagrams, clock requirements, programming UARTs, operation modes, baud rate calculations using timers 1 and 2, and initializing UART0 using timers 1 and 2 to generate baud rates. Equations are provided to calculate the reload values for timers 1 and 2 to generate a desired baud rate given the system clock frequency. Code examples initialize UART0 for 115200 baud communication using timer 1 or timer 2 clock sources.
pipelining is the concept of decomposing the sequential process into number of small stages in which each stage execute individual parts of instruction life cycle inside the processor.
Block ciphers like DES encrypt data in blocks and are based on the Feistel cipher structure. DES encrypts 64-bit blocks using a 56-bit key and 16 rounds of encryption. Modern cryptanalysis techniques like differential and linear cryptanalysis use statistical analysis to reveal weaknesses in block ciphers, though DES remains relatively secure against these attacks. Careful design of block ciphers, including aspects like non-linear substitution boxes and complex key scheduling, aims to provide security against cryptanalysis.
The document discusses transaction management in database systems. It defines a transaction as a unit of program execution that accesses and updates data items. For transactions to preserve data integrity, the database system must ensure atomicity, consistency, isolation, and durability (ACID properties). Concurrency control schemes are mechanisms that achieve isolation by controlling interactions between concurrent transactions to prevent inconsistent database states. A schedule specifies the order of transaction instructions. For a schedule to be serializable, it must be equivalent to a serial schedule where transactions execute one after another.
This document discusses transaction concepts and properties in database systems. It covers:
- Transactions access and possibly update data items as a unit of execution.
- ACID properties that transactions must satisfy: Atomicity, Consistency, Isolation, and Durability.
- Serializability is required for concurrent transaction executions to be equivalent to a serial execution and preserve consistency.
- Concurrency control schemes ensure transactions are isolated and serializability is enforced.
Block ciphers encrypt data in fixed-size blocks and can be categorized as stream or block ciphers. The document describes block cipher principles including the Feistel cipher structure, ideal block ciphers, and the practical block cipher Data Encryption Standard (DES). It provides details on the DES algorithm, key schedule, substitution boxes, diffusion and confusion properties, and modern cryptanalysis techniques such as differential and linear cryptanalysis. The DES standard utilizes a 56-bit key and has been superseded by algorithms with stronger 128-bit keys due to advances in computing power allowing brute force attacks on its 56-bit key.
Csc1401 lecture03 - computer arithmetic - arithmetic and logic unit (alu)IIUM
1. The document discusses various ways that computers represent integers and floating point numbers for processing, including unsigned, sign magnitude, one's complement, two's complement, and biased representations for integers. It also discusses the typical components of the floating point format including the sign, exponent, and significand.
2. Key aspects of arithmetic operations like addition, subtraction, multiplication, and division are described for different number representations. The two's complement system is highlighted as the most common approach used in computers due to its simplicity.
3. Standards like IEEE 754 are covered which define floating point standards to help ensure portability of numeric programs across systems.
In these slides the registration organization and stack organization have discussed in detail. Stack organization is discussed with the aid of animation to let the user understand it in a better and easy way.
This document defines and provides examples of graphs and their representations. It discusses:
- Graphs are data structures consisting of nodes and edges connecting nodes.
- Examples of directed and undirected graphs are given.
- Graphs can be represented using adjacency matrices or adjacency lists. Adjacency matrices store connections in a grid and adjacency lists store connections as linked lists.
- Key graph terms are defined such as vertices, edges, paths, and degrees. Properties like connectivity and completeness are also discussed.
The document provides an example of AES encryption with a 128-bit key and plaintext. It shows the steps of each round, including generating round keys, adding the round key, byte substitution, shifting rows, mixing columns (except for the last round), and xoring the state with the round key. The key schedule expands the initial key into 11 round keys. The example walks through all 10 rounds of encryption to produce the final ciphertext.
In cryptography, a one-time pad (OTP) is an encryption technique that cannot be cracked if used correctly. In this technique, a plaintext is paired with a random ...
This is a Presentation On use of AES Algorithm To Encrypt Or Decrypt a Text File. This Algorithm is the latest and better than DES. It is a Networking Presentation. Thank You.
Merge sort is a sorting technique based on divide and conquer technique. With worst-case time complexity being Ο(n log n), it is one of the most respected algorithms.
Merge sort first divides the array into equal halves and then combines them in a sorted manner.
The document discusses various searching and sorting algorithms. It describes linear search, binary search, and interpolation search for searching unsorted and sorted lists. It also explains different sorting algorithms like bubble sort, selection sort, insertion sort, quicksort, shellsort, heap sort, and merge sort. Linear search searches sequentially while binary search uses divide and conquer. Sorting algorithms like bubble sort, selection sort, and insertion sort are in-place and have quadratic time complexity in the worst case. Quicksort, mergesort, and heapsort generally have better performance.
This chapter discusses computer abstractions and technology. It covers the hardware/software interface and how high-level programs are translated to machine code. The chapter also examines different types of computers like PCs, servers, and embedded systems. It describes how computers use layers of abstraction in both hardware and software. The chapter concludes by discussing performance measures like response time and throughput, and how techniques like parallelism can improve performance within power constraints.
The document discusses the instruction cycle in a computer system. The instruction cycle retrieves program instructions from memory, decodes what actions they specify, and carries out those actions. It has four main steps: 1) fetching the next instruction from memory and storing it in the instruction register, 2) decoding the encoded instruction, 3) reading the effective address for direct or indirect memory instructions, and 4) executing the instruction by passing control signals to relevant components like the ALU to perform the specified actions. The instruction cycle is the basic operational process in which a computer executes instructions.
A linked list is a linear data structure consisting of nodes that are connected to each other through pointers. Each node contains a data field and a pointer to the next node. Linked lists allow for efficient insertion and removal of nodes and are more flexible than arrays in terms of memory allocation. Common types of linked lists include singly linked lists, doubly linked lists, circular linked lists, and header linked lists.
Chapter 02 instructions language of the computerBảo Hoang
Here are the steps to translate the MIPS assembly language into machine language:
1. lw $t0,300($t1) # Load A[300] into register $t0
Opcode: 35 (load word)
rs: 13 ($t1)
rt: 8 ($t0)
offset: 300
2. add $t2,$s2,$t0 # Calculate h + A[300] and put in $t2
Opcode: 0 (add)
rs: 17 ($s2)
rt: 8 ($t0)
rd: 9 ($t2)
3. sw $t2,300($t1) # Store result back into
This document summarizes simplified DES (SDES), a simplified version of the Data Encryption Standard (DES) designed for educational purposes. SDES uses an 8-bit plaintext, 10-bit key, and 8-bit ciphertext. It has two rounds that each apply an initial permutation, complex 2-input function fk using a key, bit-switching, and inverse permutation. The function fk applies expansion/permutation, XOR with a key to generate left and right halves, S-box lookups, permutation, XOR, and switching input bits for the next round. Key generation applies permutations and shifts to the input key to derive two 8-bit subkeys for each round.
This document provides an overview of serial communication and UART operation. It discusses asynchronous and synchronous serial communication, UART block diagrams, clock requirements, programming UARTs, operation modes, baud rate calculations using timers 1 and 2, and initializing UART0 using timers 1 and 2 to generate baud rates. Equations are provided to calculate the reload values for timers 1 and 2 to generate a desired baud rate given the system clock frequency. Code examples initialize UART0 for 115200 baud communication using timer 1 or timer 2 clock sources.
pipelining is the concept of decomposing the sequential process into number of small stages in which each stage execute individual parts of instruction life cycle inside the processor.
Block ciphers like DES encrypt data in blocks and are based on the Feistel cipher structure. DES encrypts 64-bit blocks using a 56-bit key and 16 rounds of encryption. Modern cryptanalysis techniques like differential and linear cryptanalysis use statistical analysis to reveal weaknesses in block ciphers, though DES remains relatively secure against these attacks. Careful design of block ciphers, including aspects like non-linear substitution boxes and complex key scheduling, aims to provide security against cryptanalysis.
The document discusses transaction management in database systems. It defines a transaction as a unit of program execution that accesses and updates data items. For transactions to preserve data integrity, the database system must ensure atomicity, consistency, isolation, and durability (ACID properties). Concurrency control schemes are mechanisms that achieve isolation by controlling interactions between concurrent transactions to prevent inconsistent database states. A schedule specifies the order of transaction instructions. For a schedule to be serializable, it must be equivalent to a serial schedule where transactions execute one after another.
This document discusses transaction concepts and properties in database systems. It covers:
- Transactions access and possibly update data items as a unit of execution.
- ACID properties that transactions must satisfy: Atomicity, Consistency, Isolation, and Durability.
- Serializability is required for concurrent transaction executions to be equivalent to a serial execution and preserve consistency.
- Concurrency control schemes ensure transactions are isolated and serializability is enforced.
The document discusses transaction concepts in database systems. It defines a transaction as a unit of program execution that accesses and updates data. Transactions must satisfy the ACID properties: Atomicity, Consistency, Isolation, and Durability. Concurrency control schemes allow concurrent execution of transactions while maintaining isolation. A schedule specifies the order of transaction operations. A schedule is serializable if it is equivalent to a serial schedule where transactions execute one after another. Conflict serializability and view serializability are approaches to determine if a schedule is serializable.
This document summarizes key concepts from Chapter 15 of the textbook "Database System Concepts". It discusses transactions, which are units of program execution that access and update data. Transactions must have the ACID properties - atomicity, consistency, isolation, and durability. Concurrent execution of transactions is allowed for better performance but requires concurrency control techniques to maintain isolation. Serializability is a key correctness criterion for concurrent schedules, and can be tested using precedence graphs.
The document discusses transactions and the ACID properties that must be ensured to maintain data integrity in a database system. It defines a transaction, provides an example of a funds transfer transaction, and explains the goals of atomicity, consistency, isolation, and durability. It discusses issues that can arise from concurrent transaction execution like inconsistent views of data and lost updates. Mechanisms like concurrency control and locking are used to preserve the ACID properties when transactions run concurrently.
This document summarizes key concepts from Chapter 14 of the textbook "Database System Concepts, 6th Ed." including:
1) A transaction is a unit of program execution that accesses and updates data items. For integrity, transactions must have ACID properties: atomicity, consistency, isolation, and durability.
2) Concurrency control ensures serializable execution of concurrent transactions to maintain consistency. Schedules must be conflict serializable and recoverable.
3) SQL supports transactions and different isolation levels to balance consistency and concurrency. The default isolation level is usually serializable but some systems allow weaker isolation.
This document provides an overview of transactions in database systems. It discusses key concepts like atomicity, consistency, isolation, and durability (ACID) that transactions must satisfy. Transactions can execute concurrently for increased performance but the database must enforce serializability to maintain consistency. The document defines transactions, schedules, and conflicting operations. It introduces the concepts of conflict serializability and view serializability to determine when concurrent schedules are equivalent to serial schedules.
This document discusses transactions and concurrency control in database systems. It covers key concepts like atomicity, consistency, isolation, and durability (ACID) properties of transactions. It also discusses serialization, schedules, conflict serializability, and various concurrency control protocols like locking and timestamp ordering to achieve isolation while allowing concurrent execution of transactions.
Introduction to database-Transaction Concurrency and RecoveryAjit Nayak
Three key points about transactions from the document:
1. A transaction is a unit of program execution that accesses and possibly updates data items in a database. It must have ACID properties - Atomicity, Consistency, Isolation, and Durability - to preserve data integrity.
2. Concurrency control schemes allow multiple transactions to run concurrently for better performance, but they must enforce transaction isolation to prevent inconsistent outcomes.
3. A concurrent schedule is considered serializable, and thus preserves isolation, if it is equivalent to some serial schedule where transactions execute one after another. This can be determined using precedence graphs.
This document provides an introduction to transaction processing in database management systems. It discusses key concepts such as transactions, concurrency control, recovery from failures, and desirable transaction properties. The main points covered are:
- A transaction is a logical unit of work that includes database access operations like insert, delete, update, or retrieve.
- Concurrency control is needed to prevent problems that can occur from uncontrolled concurrent execution of transactions, like lost updates or dirty reads.
- Recovery is required to ensure transactions are fully committed or rolled back even after failures, maintaining atomicity and durability.
- Desirable transaction properties include atomicity, consistency, isolation, and durability (ACID).
Chapter 9 introduction to transaction processingJafar Nesargi
This document provides an introduction to transaction processing in database management systems. It discusses key concepts such as transactions, concurrency control, recovery from failures, and desirable transaction properties. The main points covered are:
- A transaction is a logical unit of work that includes database operations that must succeed as a whole or fail as a whole.
- Concurrency control is needed to prevent problems that can arise from uncontrolled concurrent execution of transactions, such as lost updates or dirty reads.
- Recovery is required to handle failures and ensure transactions are fully committed or rolled back. The system log tracks transaction operations.
- Desirable transaction properties include atomicity, consistency, isolation, and durability.
Chapter 9 introduction to transaction processingJafar Nesargi
This document provides an introduction to transaction processing in database management systems. It discusses how multiple users can concurrently access a database using concepts like multiprogramming and interleaving. It defines transactions as logical units of database processing that include database access operations. The document outlines problems that can occur without concurrency control, like lost updates, dirty reads, and incorrect summaries. It also discusses the need for recovery from failures and the basic transaction and system concepts used, including transaction states and operations.
This document discusses transaction management in databases. It defines a transaction as a unit of program execution that accesses and updates data items. Transactions must satisfy the ACID properties of atomicity, consistency, isolation, and durability to maintain data integrity. Atomicity ensures that transactions are fully completed or rolled back. Consistency means transactions preserve the consistency constraints of the database. Isolation ensures transactions execute independently without interfering with each other. Durability means transaction changes persist even after failures. The document discusses various concurrency control techniques like serializability to coordinate concurrent transaction execution while preserving isolation.
This document summarizes key concepts from Chapter 14 of the textbook "Database System Concepts". It discusses transactions, including the ACID properties of atomicity, consistency, isolation, and durability. Transactions must execute reliably even in the presence of failures or concurrent execution. The chapter covers transaction states, schedules, serializability, and concurrency control techniques to ensure serializable execution of concurrent transactions.
This document summarizes key concepts from Chapter 14 of the textbook "Database System Concepts". It discusses transactions, including the ACID properties of atomicity, consistency, isolation, and durability. Transactions must execute reliably even in the presence of failures or concurrent execution. The chapter covers transaction states, schedules, serializability, and concurrency control techniques to ensure serializable execution of concurrent transactions.
This document summarizes key concepts related to database transactions from Chapter 15 of the textbook "Database System Concepts". It discusses transaction concepts, properties of atomicity, consistency, isolation, and durability (ACID), transaction states, implementation of atomicity and durability, concurrent executions, serializability, recoverability, implementation of isolation, transaction definition in SQL, and testing for serializability.
The document discusses transaction management in database systems. It covers the ACID properties that transactions must satisfy - atomicity, consistency, isolation, and durability. It also discusses concurrency control techniques used to allow concurrent execution of transactions while preventing anomalies, including strict two-phase locking and lock-based concurrency control. Serializability is introduced as a way to ensure concurrent schedules have the same effect as serial schedules.
Introduction to transaction processing concepts and theoryZainab Almugbel
Modified version of Chapter 21 of the book Fundamentals_of_Database_Systems,_6th_Edition with review questions
as part of database management system course
Unit IV Knowledge and Hybrid Recommendation System.pdfArthyR3
This document details the knowledge based recommendation system and hybrid recommendation system. A knowledge and hybrid recommendation system combines the capabilities of knowledge-based and hybrid recommendation systems to provide personalized recommendations to users.
This tutorial provides an overview of content-based recommender systems, a type of recommendation system that suggests items based on the features of the items and a profile of the user's preferences. It covers the basic concepts, algorithms, and implementation steps involved in building a content-based recommender system.
This is a quick reference document that comprises the entire concepts of Java Programming. This document covers, the basic of OOPs, features of Java, basics of Java, Inheritance, Interface, Exception, Generic, Stream, Collection, Multithreading, Swings, etc.
This document discusses middleware in Express.js web application frameworks. It defines middleware as functions that have access to the request and response objects and can perform tasks like executing code, modifying requests and responses, ending the request-response cycle, or calling the next middleware function. The document then provides examples of different types of middleware like application-level middleware, router-level middleware, error-handling middleware, and built-in middleware from Express. It explains how middleware can be used for tasks like request processing, response handling, authentication, authorization, static file serving, logging, and routing. It also covers using middleware with routes, cookies, sessions, and other concepts in Express.
This document provides an overview of AngularJS concepts covered in Unit II of the course IT2304 – Full Stack Web Development, including modules and dependency injection, scopes, directives, filters, and services. It defines modules, controllers, dependencies, scopes, common directives like ng-repeat and ng-if, filters like currency and date, and services like $http, $timeout, and custom services. Example code is provided to demonstrate key concepts.
This document provides a cheat sheet for jQuery selectors, effects, and events covered in Unit I of the Full Stack Web Development course IT2304. It includes over 30 categories of selectors with examples, 17 methods for effects like hide/show, fade, and slide, and over 20 event methods like click, change, and resize. The document also covers 10 jQuery utility methods such as trim, each, and inArray.
This document discusses the syllabus for the course IT1301 - Object Oriented Programming. It covers key concepts in OOP like classes, objects, inheritance, polymorphism, abstraction and encapsulation. It also discusses features of Java like being platform independent, secure, robust etc. The document contains examples and questions related to OOP concepts in Java. Constructors and their types, access specifiers, object class and reflection are explained in detail with examples. Creation and accessing of user-defined packages in Java is also discussed.
This document discusses electronic mail security and web security. It covers Pretty Good Privacy (PGP) and S/MIME for securing email, describing their encryption, authentication, and key management functions. For web security, it outlines threats like eavesdropping, impersonation, and denial of service attacks. It also explains how Secure Sockets Layer (SSL) and Transport Layer Security (TLS) establish encrypted connections between web browsers and servers to protect data confidentiality and integrity during transmission. Cryptographic algorithms like SHA-1, MD5, DES, and RSA are used to authenticate, encrypt, and digitally sign messages.
The document discusses intrusion detection and various types of intruders and intrusion techniques. It covers password capture methods like watching someone enter their password or using a Trojan horse. It also discusses different types of intrusion detection approaches like statistical anomaly detection, rule-based detection, and honeypots. The document then covers password management, viruses, worms, and distributed denial of service attacks. It concludes by discussing firewall design principles and characteristics like packet filtering routers.
This material covers Authentication requirement, Authentication function, MAC, Hash function, Security of hash function and MAC, SHA, Digital signature and authentication protocols, DSS, Authentication protocols like Kerberos and X.509, entity authentication
This document provides an overview of message authentication and integrity. It discusses the need for authentication in network security and outlines different authentication functions including message encryption, message authentication codes (MACs), and hash functions. It describes how MACs are generated using a secret key and message and provides the requirements for MACs. The document also discusses the MD5 and SHA hash algorithms, explaining their processes and analyzing their security strengths and weaknesses.
This document is to guide in the basic topics of cryptographic and network security. The detail insight of classical encryption algorithm is given here. The step by step process is clearly explained in this document.
JAVA - A Quick Reference
A quick guide to learn more about JAVA Programming. This covers the core concepts of JAVA with OOP concepts. This also covers swing programming.
Cs8792 cns - Public key cryptosystem (Unit III)ArthyR3
This document provides an overview of public key cryptography and asymmetric key ciphers. It begins with the underlying mathematics including primes, primality testing, factorization, Euler's totient function, Fermat's theorem, and exponentiation. It then discusses asymmetric key ciphers like RSA and Diffie-Hellman key exchange. RSA is described in more detail, including how public and private key pairs are generated using large prime numbers and exponentiation modulo a composite integer. Security relies on the difficulty of factoring large numbers.
This document is a worksheet for a cryptography and network security course. It contains definitions of key terms like cryptography, encryption, decryption, and types of attacks. It also outlines classical encryption techniques like the Caesar cipher, Playfair cipher, Hill cipher, Vigenere cipher, and transposition techniques. Finally, it covers number theory topics such as prime numbers, factorization, Fermat's theorem, Euler's theorem, and primitive roots as they relate to cryptography.
This document discusses message authentication and hash functions. It begins by defining message authentication and its security requirements. It then describes three approaches to message authentication: message encryption, message authentication codes (MACs), and hash functions. It provides details on how MACs and hash functions work, including properties and requirements. Specific algorithms like MD5 are also covered. The document aims to explain the concepts and tradeoffs between different message authentication techniques.
This document contains a question bank for the subject Cryptography and Network Security. It includes questions grouped under different units of the subject: Introduction and Number Theory, Block Ciphers and Public Key Cryptography, Hash Functions and Digital Signatures. For each question, it provides the question number, question, marks allotted, knowledge level and number of times the question may appear in the assessment. The document also provides details of the subject code, name, class, staff in-charge and course code.
The document outlines the objectives, topics, and learning outcomes of the CS6660 Compiler Design course. The course aims to teach students about compiler design principles, parsing techniques, translation processes, optimization methods, and code generation. It is divided into 5 units that cover introduction to compilers, lexical analysis, syntax analysis, syntax directed translation and runtime environment, and code optimization and generation. At the end of the course, students should be able to design and implement a prototype compiler, apply optimization techniques, use compiler construction tools, and understand the different levels of translation.
Design and optimization of ion propulsion dronebjmsejournal
Electric propulsion technology is widely used in many kinds of vehicles in recent years, and aircrafts are no exception. Technically, UAVs are electrically propelled but tend to produce a significant amount of noise and vibrations. Ion propulsion technology for drones is a potential solution to this problem. Ion propulsion technology is proven to be feasible in the earth’s atmosphere. The study presented in this article shows the design of EHD thrusters and power supply for ion propulsion drones along with performance optimization of high-voltage power supply for endurance in earth’s atmosphere.
Rainfall intensity duration frequency curve statistical analysis and modeling...bijceesjournal
Using data from 41 years in Patna’ India’ the study’s goal is to analyze the trends of how often it rains on a weekly, seasonal, and annual basis (1981−2020). First, utilizing the intensity-duration-frequency (IDF) curve and the relationship by statistically analyzing rainfall’ the historical rainfall data set for Patna’ India’ during a 41 year period (1981−2020), was evaluated for its quality. Changes in the hydrologic cycle as a result of increased greenhouse gas emissions are expected to induce variations in the intensity, length, and frequency of precipitation events. One strategy to lessen vulnerability is to quantify probable changes and adapt to them. Techniques such as log-normal, normal, and Gumbel are used (EV-I). Distributions were created with durations of 1, 2, 3, 6, and 24 h and return times of 2, 5, 10, 25, and 100 years. There were also mathematical correlations discovered between rainfall and recurrence interval.
Findings: Based on findings, the Gumbel approach produced the highest intensity values, whereas the other approaches produced values that were close to each other. The data indicates that 461.9 mm of rain fell during the monsoon season’s 301st week. However, it was found that the 29th week had the greatest average rainfall, 92.6 mm. With 952.6 mm on average, the monsoon season saw the highest rainfall. Calculations revealed that the yearly rainfall averaged 1171.1 mm. Using Weibull’s method, the study was subsequently expanded to examine rainfall distribution at different recurrence intervals of 2, 5, 10, and 25 years. Rainfall and recurrence interval mathematical correlations were also developed. Further regression analysis revealed that short wave irrigation, wind direction, wind speed, pressure, relative humidity, and temperature all had a substantial influence on rainfall.
Originality and value: The results of the rainfall IDF curves can provide useful information to policymakers in making appropriate decisions in managing and minimizing floods in the study area.
Introduction- e - waste – definition - sources of e-waste– hazardous substances in e-waste - effects of e-waste on environment and human health- need for e-waste management– e-waste handling rules - waste minimization techniques for managing e-waste – recycling of e-waste - disposal treatment methods of e- waste – mechanism of extraction of precious metal from leaching solution-global Scenario of E-waste – E-waste in India- case studies.
Comparative analysis between traditional aquaponics and reconstructed aquapon...bijceesjournal
The aquaponic system of planting is a method that does not require soil usage. It is a method that only needs water, fish, lava rocks (a substitute for soil), and plants. Aquaponic systems are sustainable and environmentally friendly. Its use not only helps to plant in small spaces but also helps reduce artificial chemical use and minimizes excess water use, as aquaponics consumes 90% less water than soil-based gardening. The study applied a descriptive and experimental design to assess and compare conventional and reconstructed aquaponic methods for reproducing tomatoes. The researchers created an observation checklist to determine the significant factors of the study. The study aims to determine the significant difference between traditional aquaponics and reconstructed aquaponics systems propagating tomatoes in terms of height, weight, girth, and number of fruits. The reconstructed aquaponics system’s higher growth yield results in a much more nourished crop than the traditional aquaponics system. It is superior in its number of fruits, height, weight, and girth measurement. Moreover, the reconstructed aquaponics system is proven to eliminate all the hindrances present in the traditional aquaponics system, which are overcrowding of fish, algae growth, pest problems, contaminated water, and dead fish.
4. TRANSACTION CONCEPTS
Collections of operations that form a single logical unit
of work are called transactions.
A transaction is a unit of program execution that
accesses and possibly updates various data items.
A transaction is delimited by statements (or function
calls) of the form begin transaction and end
transaction.
Two main issues to deal with:
Failures of various kinds, such as hardware failures and
system crashes
Concurrent execution of multiple transactions
4
PreparedbyR.Arthy,AP/IT,KCET
5. ACID PROPERTIES
Atomicity. Either all operations of the transaction are properly
reflected in the database or none are.
Consistency. Execution of a transaction in isolation preserves the
consistency of the database.
Isolation. Although multiple transactions may execute concurrently,
each transaction must be unaware of other concurrently executing
transactions. Intermediate transaction results must be hidden from
other concurrently executed transactions.
That is, for every pair of transactions Ti and Tj, it appears to Ti
that either Tj, finished execution before Ti started, or Tj started
execution after Ti finished.
Durability. After a transaction completes successfully, the changes
it has made to the database persist, even if there are system failures.
5
PreparedbyR.Arthy,AP/IT,KCET
6. A SIMPLE TRANSACTION MODEL
Transactions access data using two
operations:
read(X), which transfers the data item X from the
database to a variable, also called X, in a buffer in
main memory belonging to the transaction that
executed the read operation.
write(X), which transfers the value in the variable
X in the main-memory buffer of the transaction
that executed the write to the data item X in the
database. 6
PreparedbyR.Arthy,AP/IT,KCET
7. [CONTD…]
Let Ti be a transaction that transfers $50 from account A to account
B. This transaction can be defined as:
Ti : read(A);
A := A − 50;
write(A);
read(B);
B := B + 50;
write(B).
Atomicity requirement
if the transaction fails after step 3 and before step 6, money will
be “lost” leading to an inconsistent database state
Failure could be due to software or hardware
the system should ensure that updates of a partially executed
transaction are not reflected in the database
7
PreparedbyR.Arthy,AP/IT,KCET
8. [CONTD…]
Durability requirement — once the user has been notified that the
transaction has completed (i.e., the transfer of the $50 has taken
place), the updates to the database by the transaction must persist
even if there are software or hardware failures.
Consistency requirement in above example:
the sum of A and B is unchanged by the execution of the
transaction
In general, consistency requirements include
Explicitly specified integrity constraints such as primary keys
and foreign keys
Implicit integrity constraints
e.g. sum of balances of all accounts, minus sum of loan
amounts must equal value of cash-in-hand
A transaction must see a consistent database.
During transaction execution the database may be temporarily
inconsistent.
When the transaction completes successfully the database must
be consistent
Erroneous transaction logic can lead to inconsistency
8
PreparedbyR.Arthy,AP/IT,KCET
9. [CONTD…]
Isolation requirement — if between steps 3 and 6, another
transaction T2 is allowed to access the partially updated database, it
will see an inconsistent database (the sum A + B will be less than it
should be).
T1 T2
1. read(A)
2. A := A – 50
3. write(A)
read(A), read(B), print(A+B)
4. read(B)
5. B := B + 50
6. write(B
Isolation can be ensured trivially by running transactions serially
that is, one after the other.
However, executing multiple transactions concurrently has
significant benefits, as we will see later.
9
PreparedbyR.Arthy,AP/IT,KCET
11. [CONTD…]
Active – the initial state; the transaction stays in this state while it is
executing
Partially committed – after the final statement has been executed.
Failed -- after the discovery that normal execution can no longer
proceed.
Aborted – after the transaction has been rolled back and the database
restored to its state prior to the start of the transaction. Two options
after it has been aborted:
restart the transaction
can be done only if no internal logical error
kill the transaction
Committed – after successful completion.
11
PreparedbyR.Arthy,AP/IT,KCET
12. QUIZ TIME
Collections of operations that form a single logical unit
of work are called __________
a) Views
b) Networks
c) Units
d) Transactions
12
PreparedbyR.Arthy,AP/IT,KCET
13. The “all-or-none” property is commonly referred to as
_________
a) Isolation
b) Durability
c) Atomicity
d) None of the mentioned
13
PreparedbyR.Arthy,AP/IT,KCET
14. Which of the following is a property of transactions?
a) Atomicity
b) Durability
c) Isolation
d) All of the mentioned
14
PreparedbyR.Arthy,AP/IT,KCET
15. Execution of translation in isolation preserves the
_________ of a database
a) Atomicity
b) Consistency
c) Durability
d) All of the mentioned
15
PreparedbyR.Arthy,AP/IT,KCET
16. Which of the following is not a property of a transaction?
a) Atomicity
b) Simplicity
c) Isolation
d) Durability
16
PreparedbyR.Arthy,AP/IT,KCET
17. A transaction that has not been completed successfully is
called as _______
a) Compensating transaction
b) Aborted transaction
c) Active transaction
d) Partially committed transaction
17
PreparedbyR.Arthy,AP/IT,KCET
18. Which of the following is not a transaction state?
a) Active
b) Partially committed
c) Failed
d) Compensated
18
PreparedbyR.Arthy,AP/IT,KCET
19. PART B QUESTIONS
Write a short note on Transaction concepts. [Nov 2014]
During execution, a transaction passes through several
states, until it finally commits or aborts. List all possible
sequences of states through which a transaction may
pass. Explain why each state transition may occur? [May
2018]
Explain with an example the properties that must be
satisfied by a transaction. [May 2018]
19
PreparedbyR.Arthy,AP/IT,KCET
21. CONCURRENT EXECUTIONS
Multiple transactions are allowed to run concurrently in
the system. Advantages are:
increased processor and disk utilization, leading to better
transaction throughput
E.g. one transaction can be using the CPU while another is reading
from or writing to the disk
reduced average response time for transactions: short
transactions need not wait behind long ones.
Concurrency control schemes – mechanisms to
achieve isolation
that is, to control the interaction among the concurrent
transactions in order to prevent them from destroying the
consistency of the database 21
PreparedbyR.Arthy,AP/IT,KCET
22. SCHEDULES
Schedule – a sequences of instructions that specify the
chronological order in which instructions of concurrent
transactions are executed
a schedule for a set of transactions must consist of all
instructions of those transactions
must preserve the order in which the instructions appear in
each individual transaction.
A transaction that successfully completes its execution
will have a commit instructions as the last statement
by default transaction assumed to execute commit instruction
as its last step
A transaction that fails to successfully complete its
execution will have an abort instruction as the last
statement
22
PreparedbyR.Arthy,AP/IT,KCET
23. SCHEDULE 1
Let T1 transfer $50 from A to B, and T2 transfer 10% of
the balance from A to B.
A serial schedule in which T1 is followed by T2 :
23
PreparedbyR.Arthy,AP/IT,KCET
24. SCHEDULE 2
A serial schedule where T2 is followed by T1
24
PreparedbyR.Arthy,AP/IT,KCET
25. SCHEDULE 3
Let T1 and T2 be the transactions defined previously. The
following schedule is not a serial schedule, but it is
equivalent to Schedule 1.
25
PreparedbyR.Arthy,AP/IT,KCET
26. SCHEDULE 4
The following concurrent schedule does not preserve the
value of (A + B ).
26
PreparedbyR.Arthy,AP/IT,KCET
27. SERIALIZABILITY
Basic Assumption – Each transaction preserves database
consistency.
Thus serial execution of a set of transactions preserves
database consistency.
A (possibly concurrent) schedule is serializable if it is
equivalent to a serial schedule. Different forms of schedule
equivalence give rise to the notions of:
1. Conflict serializability
2. View serializability
Simplified view of transactions
We ignore operations other than read and write instructions
We assume that transactions may perform arbitrary computations on
data in local buffers in between reads and writes.
Our simplified schedules consist of only read and write
instructions.
27
PreparedbyR.Arthy,AP/IT,KCET
28. CONFLICTING INSTRUCTIONS
Instructions li and lj of transactions Ti and Tj respectively,
conflict if and only if there exists some item Q accessed
by both li and lj, and at least one of these instructions
wrote Q.
1. li = read(Q), lj = read(Q). li and lj don’t conflict.
2. li = read(Q), lj = write(Q). They conflict.
3. li = write(Q), lj = read(Q). They conflict
4. li = write(Q), lj = write(Q). They conflict
Intuitively, a conflict between li and lj forces a (logical)
temporal order between them.
If li and lj are consecutive in a schedule and they do not
conflict, their results would remain the same even if they had
been interchanged in the schedule. 28
PreparedbyR.Arthy,AP/IT,KCET
29. CONFLICT SERIALIZABILITY
If a schedule S can be transformed into a schedule S´ by
a series of swaps of non-conflicting instructions, we say
that S and S´ are conflict equivalent.
We say that a schedule S is conflict serializable if it is
conflict equivalent to a serial schedule
29
PreparedbyR.Arthy,AP/IT,KCET
30. [CONTD…]
Schedule 3 can be transformed into Schedule 6, a serial schedule
where T2 follows T1, by series of swaps of non-conflicting
instructions.
Therefore Schedule 3 is conflict serializable.
30
PreparedbyR.Arthy,AP/IT,KCET
Schedule 3 Schedule 6
31. [CONTD…]
Example of a schedule that is not conflict serializable:
We are unable to swap instructions in the above schedule
to obtain either the serial schedule < T3, T4 >, or the
serial schedule < T4, T3 >.
31
PreparedbyR.Arthy,AP/IT,KCET
32. [CONTD…]
To determine conflict serializability of a schedule.
Consider a schedule S. We construct a directed graph, called a
precedence graph, from S.
This graph consists of a pair G = (V, E), where
V is a set of vertices and E is a set of edges. The set of vertices
consists of all the transactions participating in the schedule.
The set of edges consists of all edges
Ti →Tj for which one of three conditions holds:
Ti executes write(Q) before Tj executes read(Q).
Ti executes read(Q) before Tj executes write(Q).
Ti executes write(Q) before Tj executes write(Q).
32
PreparedbyR.Arthy,AP/IT,KCET
33. [CONTD…]
If an edge Ti → Tj exists in the precedence graph, then,
in any serial schedule S equivalent to S, Ti must appear
before Tj .
33
PreparedbyR.Arthy,AP/IT,KCET
34. [CONTD…]
If the precedence graph for S has a cycle, then schedule S
is not conflict serializable.
If the graph contains no cycles, then the schedule S is
conflict serializable.
34
PreparedbyR.Arthy,AP/IT,KCET
35. TEST FOR CONFLICT SERIALIZABILITY
A schedule is conflict serializable if
and only if its precedence graph is
acyclic.
Cycle-detection algorithms exist which
take order n2 time, where n is the
number of vertices in the graph.
(Better algorithms take order n + e
where e is the number of edges.)
If precedence graph is acyclic, the
serializability order can be obtained by
a topological sorting of the graph.
This is a linear order consistent
with the partial order of the graph.
35
PreparedbyR.Arthy,AP/IT,KCET
36. VIEW SERIALIZABILITY
Let S and S´ be two schedules with the same set of transactions. S and S´
are view equivalent if the following three conditions are met, for each data
item Q,
1. If in schedule S, transaction Ti reads the initial value of Q, then in
schedule S’ also transaction Ti must read the initial value of Q.
2. If in schedule S transaction Ti executes read(Q), and that value was
produced by transaction Tj (if any), then in schedule S’ also
transaction Ti must read the value of Q that was produced by the same
write(Q) operation of transaction Tj .
3. The transaction (if any) that performs the final write(Q) operation in
schedule S must also perform the final write(Q) operation in schedule
S’.
As can be seen, view equivalence is also based purely on reads and writes
alone.
36
PreparedbyR.Arthy,AP/IT,KCET
37. [CONTD…]
A schedule S is view serializable if it is view equivalent
to a serial schedule.
Every conflict serializable schedule is also view
serializable.
Every view serializable schedule that is not conflict
serializable has blind writes.
37
PreparedbyR.Arthy,AP/IT,KCET
38. TEST FOR VIEW SERIALIZABILITY
The precedence graph test for conflict serializability cannot be used directly
to test for view serializability.
Extension to test for view serializability has cost exponential in the size
of the precedence graph.
The problem of checking if a schedule is view serializable falls in the class
of NP-complete problems.
Thus existence of an efficient algorithm is extremely unlikely.
However practical algorithms that just check some sufficient conditions for
view serializability can still be used.
38
PreparedbyR.Arthy,AP/IT,KCET
39. RECOVERABLE SCHEDULES
Recoverable schedule — if a transaction Tj reads a data item
previously written by a transaction Ti , then the commit
operation of Ti appears before the commit operation of Tj.
The following schedule (Schedule 11) is not recoverable if T9
commits immediately after the read
If T8 should abort, T9 would have read (and possibly shown to
the user) an inconsistent database state. Hence, database must
ensure that schedules are recoverable. 39
PreparedbyR.Arthy,AP/IT,KCET
40. CASCADING ROLLBACKS
Cascading rollback – a single transaction failure leads to a
series of transaction rollbacks. Consider the following
schedule where none of the transactions has yet committed (so
the schedule is recoverable)
If T10 fails, T11 and T12 must also be rolled back.
Can lead to the undoing of a significant amount of work 40
PreparedbyR.Arthy,AP/IT,KCET
41. QUIZ TIME
I and J are _________ if they are operations by different
transactions on the same data item, and at least one of
them is a write operation.
a) Conflicting
b) Overwriting
c) Isolated
d) Durable
41
PreparedbyR.Arthy,AP/IT,KCET
42. If a schedule S can be transformed into a schedule S’ by
a series of swaps of non-conflicting instructions, then S
and S’ are
a) Non conflict equivalent
b) Equal
c) Conflict equivalent
d) Isolation equivalent
42
PreparedbyR.Arthy,AP/IT,KCET
43. A schedule is __________ if it is conflict equivalent to a
serial schedule.
a) Conflict serializable
b) Conflicting
c) Non serializable
d) None of the mentioned
43
PreparedbyR.Arthy,AP/IT,KCET
44. The set of ________ in a precedence graph consists of all
the transactions participating in the schedule
a) Vertices
b) Edges
c) Directions
d) None of the mentioned
44
PreparedbyR.Arthy,AP/IT,KCET
45. A ___________of the transactions can be obtained by
finding a linear order consistent with the partial order of
the precedence graph.
a) Serializability order
b) Direction graph
c) Precedence graph
d) Scheduling scheme
45
PreparedbyR.Arthy,AP/IT,KCET
46. State true or false: If I = read(Q) and J = read(Q) then the
order of I and J does not matter.
a) True
b) False
46
PreparedbyR.Arthy,AP/IT,KCET
47. State true or false: If I = read(Q) and J = write(Q) then
the order of I and J does not matter.
a) True
b) False
47
PreparedbyR.Arthy,AP/IT,KCET
48. The phenomenon in which one failure leads to a series of
transaction rollbacks is called as ________
a) Cascading rollback
b) Cascadeless rollback
c) Cascade cause
d) None of the mentioned
48
PreparedbyR.Arthy,AP/IT,KCET
49. A ___________ is one where, for each pair of
transactions Ti and Tj such that Tj reads a data item
previously written by Ti , the commit operation of Ti
appears before the commit operation of Tj
a) Partial schedule
b) Dependent schedule
c) Recoverable schedule
d) None of the mentioned
49
PreparedbyR.Arthy,AP/IT,KCET
50. Which of the following are the advantages of transaction
concurrency?
a) Increased throughput
b) Increased utilization
c) Reduces average response time
d) All of the mentioned
50
PreparedbyR.Arthy,AP/IT,KCET
51. GATE QUESTIONS
The following functional dependencies hold true for the
relational schema R{V, W, X, Y, Z}:
V -> W
VW -> X
Y -> VX
Y -> Z
Which of the following is irreducible equivalent for this set of
functional dependencies?
GATE | GATE-CS-2017 (Set 1) | Question 15
(A) A
(B) B
(C) C
(D) D
51
PreparedbyR.Arthy,AP/IT,KCET
52. [CONTD…]
Consider a database that has the relation schemas EMP (EmpId, EmpName, DepId),
and DEPT(DeptName, DeptId). Note that the DepId can be permitted to be NULL
in the relation EMP. Consider the following queries on the database expressed in
tuple relational calculus.
I. {t | ∃ u ∈ EMP (t[EMPName] = u[EmpName] ∧ ∀ v ∈ DEPT (t[DeptId] ≠
DeptId]))}
II. {t | ∃ u ∈ EMP (t[EMPName] = u[EmpName] ∧ ∃ v ∈ DEPT (t[DeptId] ≠
DeptId]))}
III. {t | ∃ u ∈ EMP (t[EMPName] = u[EmpName] ∧ ∃ v ∈ DEPT (t[DeptId] =
DeptId]))}
GATE | GATE-CS-2017 (Set 1) | Question 36
(A) I and II only
(B) I and III only
(C) II and III only
(D) I, II, and III
52
PreparedbyR.Arthy,AP/IT,KCET
53. PART B QUESTIONS
Discuss view serializability and conflict serializability. [Nov
2015, May 2018]
Consider the following extension to the tree locking protocol,
which allows both shared and exclusive locks:
i) A transaction can be either a read only transaction, in which
case it can request only shared locks or an update transaction
in which case it can request only exclusive locks.
ii) Each transaction must follow the rules of the tree protocol.
Read only transactions may lock any data item first, where as
update transactions must lock the root first.
Show that the protocol ensures Serializability and deadlock
freedom. [Nov 2016]
Discuss in detail about the testing of serializability. [May
2019] 53
PreparedbyR.Arthy,AP/IT,KCET
55. NEED FOR CONCURRENCY CONTROL
In the concurrency control, the multiple transactions can
be executed simultaneously.
It may affect the transaction result. It is highly important
to maintain the order of execution of those transactions.
Several problems can occur when concurrent
transactions are executed in an uncontrolled manner.
Following are the three problems in concurrency control.
Lost updates
Dirty read
Unrepeatable read
55
PreparedbyR.Arthy,AP/IT,KCET
56. LOST UPDATE PROBLEM
When two transactions that access the same database
items contain their operations in a way that makes the
value of some database item incorrect, then the lost
update problem occurs.
If two transactions T1 and T2 read a record and then
update it, then the effect of updating of the first record
will be overwritten by the second update.
56
PreparedbyR.Arthy,AP/IT,KCET
57. DIRTY READ
A dirty read is the situation when a transaction reads a
data that has not yet been committed.
Example:
Transaction 1 updates a row and leaves it uncommitted
Transaction 2 reads the updated row
If transaction 1 rolls back the change, transaction 2 will have
read data that is considered never to have existed.
57
PreparedbyR.Arthy,AP/IT,KCET
58. UNREPEATABLE READ
Non repeatable read occurs when a transaction reads
same row twice but received a different value each time.
Example:
Transaction T1 reads a data
Due to concurrency, another transaction T2 updates the same
data and commit
Transaction T1 rereads the same data, it will retrieve a
different value
58
PreparedbyR.Arthy,AP/IT,KCET
59. CONCURRENCY CONTROL PROTOCOL
Concurrency control protocols ensure atomicity,
isolation, and serializability of concurrent transactions.
The concurrency control protocol can be divided into
three categories:
Lock based protocol
Time-stamp protocol
Validation based protocol
59
PreparedbyR.Arthy,AP/IT,KCET
60. LOCK-BASED PROTOCOLS
A lock is a mechanism to control concurrent access to a
data item
Data items can be locked in two modes :
1. exclusive (X) mode. Data item can be both read as
well as written. X-lock is requested using lock-X
instruction.
2. shared (S) mode. Data item can only be read. S-lock
is requested using lock-S instruction.
Lock requests are made to concurrency-control manager.
Transaction can proceed only after request is granted.
60
PreparedbyR.Arthy,AP/IT,KCET
61. [CONTD…]
Lock-compatibility matrix
A transaction may be granted a lock on an item if the
requested lock is compatible with locks already held on the
item by other transactions
Any number of transactions can hold shared locks on an item,
but if any transaction holds an exclusive on the item no other
transaction may hold any lock on the item.
If a lock cannot be granted, the requesting transaction is made
to wait till all incompatible locks held by other transactions
have been released. The lock is then granted.
61
PreparedbyR.Arthy,AP/IT,KCET
62. RULES FOR LOCKING
If a transaction has a read lock on a data item, then it can
only read the item but cannot update.
If a transaction has a write lock on a data item, then it
can both read and update the data item.
If a transaction has a write lock on a data item, then other
transactions cannot acquire read or write locks on the
data item.
62
PreparedbyR.Arthy,AP/IT,KCET
63. PRE-CLAIMING LOCK PROTOCOL
It evaluate their operations and create a list of data items
on which they need locks.
Before initiating an execution, the transaction requests
the system for all the locks it needs beforehand.
If all the locks are granted, the transaction executes and
releases all the locks when all its operations are over.
If all the locks are not granted, the transaction rolls back
and waits until all t he locks are granted.
63
PreparedbyR.Arthy,AP/IT,KCET
T begin T end Time
Lock acquisition
phase
64. [CONTD…]
Example of a transaction performing locking:
T2: lock-S(A);
read (A);
unlock(A);
lock-S(B);
read (B);
unlock(B);
display(A+B)
Locking as above is not sufficient to guarantee serializability
— if A and B get updated in-between the read of A and B, the
displayed sum would be wrong.
A locking protocol is a set of rules followed by all
transactions while requesting and releasing locks. Locking
protocols restrict the set of possible schedules. 64
PreparedbyR.Arthy,AP/IT,KCET
66. PROBLEM
Consider the partial schedule
Neither T3 nor T4 can make progress — executing lock-S(B)
causes T4 to wait for T3 to release its lock on B, while
executing lock-X(A) causes T3 to wait for T4 to release its
lock on A.
Such a situation is called a deadlock.
To handle a deadlock one of T3 or T4 must be rolled back
and its locks released.
66
PreparedbyR.Arthy,AP/IT,KCET
67. [CONTD…]
The potential for deadlock exists in most locking
protocols. Deadlocks are a necessary evil.
Starvation is also possible if concurrency control
manager is badly designed. For example:
A transaction may be waiting for an X-lock on an item, while
a sequence of other transactions request and are granted an S-
lock on the same item.
The same transaction is repeatedly rolled back due to
deadlocks.
Concurrency control manager can be designed to prevent
starvation.
67
PreparedbyR.Arthy,AP/IT,KCET
68. TWO-PHASE LOCKING PROTOCOL
This is a protocol which ensures conflict-serializable
schedules.
Phase 1: Growing Phase
transaction may obtain locks
transaction may not release locks
Phase 2: Shrinking Phase
transaction may release locks
transaction may not obtain locks
68
PreparedbyR.Arthy,AP/IT,KCET
69. [CONTD…]
The protocol assures serializability.
It can be proved that the transactions can be serialized in
the order of their lock points (i.e. the point where a
transaction acquired its final lock). 69
PreparedbyR.Arthy,AP/IT,KCET
T begin T end
Time
Lock acquisition phase Lock releasing phase
70. [CONTD…]
Two-phase locking does not ensure freedom from
deadlocks
Cascading roll-back is possible under two-phase locking.
To avoid this, follow a modified protocol called strict
two-phase locking. Here a transaction must hold all its
exclusive locks till it commits/aborts.
Rigorous two-phase locking is even stricter: here all
locks are held till commit/abort.
In this protocol transactions can be serialized in the order
in which they commit.
70
PreparedbyR.Arthy,AP/IT,KCET
71. [CONTD…]
Two-phase locking with lock conversions:
– First Phase:
can acquire a lock-S on item
can acquire a lock-X on item
can convert a lock-S to a lock-X (upgrade)
– Second Phase:
can release a lock-S
can release a lock-X
can convert a lock-X to a lock-S (downgrade)
This protocol assures serializability. But still relies on the
programmer to insert the various locking instructions. 71
PreparedbyR.Arthy,AP/IT,KCET
72. [CONTD…]
A transaction Ti issues the standard read/write
instruction, without explicit locking calls.
The operation read(D) is processed as:
if Ti has a lock on D
then
read(D)
else begin
if necessary wait until no other
transaction has a lock-X on D
grant Ti a lock-S on D;
read(D)
end 72
PreparedbyR.Arthy,AP/IT,KCET
73. [CONTD…]
write(D) is processed as:
if Ti has a lock-X on D
then
write(D)
else begin
if necessary wait until no other trans. has any lock
on D,
if Ti has a lock-S on D
then
upgrade lock on D to lock-X
else
grant Ti a lock-X on D
write(D)
end;
All locks are released after commit or abort
73
PreparedbyR.Arthy,AP/IT,KCET
74. IMPLEMENTATION OF LOCKING
A lock manager can be implemented as a separate
process to which transactions send lock and unlock
requests
The lock manager replies to a lock request by sending a
lock grant messages (or a message asking the transaction
to roll back, in case of a deadlock)
The requesting transaction waits until its request is
answered
The lock manager maintains a data-structure called a
lock table to record granted locks and pending requests
The lock table is usually implemented as an in-memory
hash table indexed on the name of the data item being
locked 74
PreparedbyR.Arthy,AP/IT,KCET
75. LOCK TABLE
Black rectangles indicate granted locks,
white ones indicate waiting requests
Lock table also records the type of lock
granted or requested
New request is added to the end of the
queue of requests for the data item, and
granted if it is compatible with all earlier
locks
Unlock requests result in the request
being deleted, and later requests are
checked to see if they can now be
granted
If transaction aborts, all waiting or
granted requests of the transaction are
deleted
lock manager may keep a list of
locks held by each transaction, to
implement this efficiently`
75
PreparedbyR.Arthy,AP/IT,KCET
76. TIMESTAMP-BASED PROTOCOLS
Each transaction is issued a timestamp when it enters the
system. If an old transaction Ti has time-stamp TS(Ti), a
new transaction Tj is assigned time-stamp TS(Tj) such
that TS(Ti) <TS(Tj).
The protocol manages concurrent execution such that the
time-stamps determine the serializability order.
In order to assure such behavior, the protocol maintains
for each data Q two timestamp values:
W-timestamp(Q) is the largest time-stamp of any transaction
that executed write(Q) successfully.
R-timestamp(Q) is the largest time-stamp of any transaction
that executed read(Q) successfully. 76
PreparedbyR.Arthy,AP/IT,KCET
77. VALIDATION-BASED PROTOCOL
Execution of transaction Ti is done in three phases.
1. Read and execution phase: Transaction Ti writes only to
temporary local variables
2. Validation phase: Transaction Ti performs a ``validation test''
to determine if local variables can be written without violating
serializability.
3. Write phase: If Ti is validated, the updates are applied to the
database; otherwise, Ti is rolled back.
The three phases of concurrently executing transactions can be
interleaved, but each transaction must go through the three phases in
that order.
Assume for simplicity that the validation and write phase occur
together, atomically and serially
i.e., only one transaction executes validation/write at a time.
Also called as optimistic concurrency control since transaction
executes fully in the hope that all will go well during validation
77
PreparedbyR.Arthy,AP/IT,KCET
78. PART B QUESTIONS
What is concurrency? Explain it in terms of locking
mechanism and two phase locking protocol. [Nov 2014,
May 2016, Nov 2016, Nov 2017, May 2018]
What is concurrency control? How is it implemented in
DBMS? Illustrate with a suitable example. [Nov 2015]
Explain about locking protocols. [May 2016]
Explain lock based concurrency control with suitable
example. [Nov 2017]
Differentiate strict two phase locking protocol and
rigorous two phase locking protocol. [Nov 2018]
How the time stamps are implemented? Explain. [Nov
2018]
78
PreparedbyR.Arthy,AP/IT,KCET
79. [CONTD…]
Consider the following two transactions:
T1 and T2 works in parallel. Add lock and unlock
instructions to transactions T1 and T2 so that they
observe the two phase locking protocol. Can the
execution of these transactions result in a deadlock?
[Nov 2016] 79
PreparedbyR.Arthy,AP/IT,KCET
T1 T2
read(A);
read(B),
if A=0 then B:=B+1;
write(B).
read(B);
read(A);
if B=0 then A:A+1;
write(A).
81. INTRODUCTION
In a multi-process system, deadlock is an unwanted
situation that arises in a shared resource environment.
Where a process indefinitely waits for a resource that is
held by another process.
Definition
System is deadlocked if there is a set of transactions such that
every transaction in the set is waiting for another transaction
in the set.
For example:
Assume a set of transactions {T0, T1, T2}
81
PreparedbyR.Arthy,AP/IT,KCET
82. [CONTD…]
T0 needs a resource X to complete its task
Resource X is held by T1, and T1 is waiting for a
resource Y, which is held by T2
T2 is waiting for the resource Z, which is held by T0
82
PreparedbyR.Arthy,AP/IT,KCET
T0
T1
T2
83. DEADLOCK PREVENTION
Deadlock prevention protocols ensure that the system
will never enter into a deadlock state.
Some prevention strategies :
Require that each transaction locks all its data items before it
begins execution (predeclaration).
Impose partial ordering of all data items and require that a
transaction can lock data items only in the order specified by
the partial order (graph-based protocol).
Schemes:
Wait – Die Scheme
Wound – Wait Scheme
83
PreparedbyR.Arthy,AP/IT,KCET
84. WAIT-DIE SCHEME — NON-PREEMPTIVE
In this scheme, is a transaction requests to lock a data
item, which is already locked by another transaction,
then one of the two possibilities may occur:
If TS(Ti) < TS(Tj) – that is Ti is older than Tj, which is
requesting a conflicting lock, is older than Tj – then Ti is
allowed to wait until the data item is available.
If TS(Ti) > TS(Tj) – that is Ti is younger than Tj – then Ti is
aborted. Ti is restarted later with a random delay but with the
same timestamp.
Older transaction may wait for younger one to release data item.
Younger transactions never wait for older ones; they are rolled
back instead.
A transaction may die several times before acquiring needed data
item 84
PreparedbyR.Arthy,AP/IT,KCET
85. WOUND-WAIT SCHEME
In this scheme, is a transaction requests to lock a data
item, which is already locked by another transaction,
then one of the two possibilities may occur:
If TS(Ti) < TS(Tj) – that is Ti is older than Tj, then Ti forces
Tj to be rolled back – that is Ti wounds Tj. Tj is restarted later
with a random delay but with the same timestamp.
If TS(Ti) > TS(Tj) – that is Ti is younger than Tj – Ti is
forced to wait until the resource is available.
Older transaction wounds (forces rollback) of younger
transaction instead of waiting for it. Younger transactions
may wait for older ones.
May be fewer rollbacks than wait-die scheme. 85
PreparedbyR.Arthy,AP/IT,KCET
86. DEADLOCK AVOIDANCE
Deadlocks can be described as a wait-for graph, which
consists of a pair G = (V,E),
V is a set of vertices (all the transactions in the system)
E is a set of edges; each element is an ordered pair Ti Tj.
If Ti Tj is in E, then there is a directed edge from Ti to Tj,
implying that Ti is waiting for Tj to release a data item.
When Ti requests a data item currently being held by Tj, then
the edge Ti Tj is inserted in the wait-for graph. This edge is
removed only when Tj is no longer holding a data item needed
by Ti.
The system is in a deadlock state if and only if the wait-for
graph has a cycle. Must invoke a deadlock-detection
algorithm periodically to look for cycles. 86
PreparedbyR.Arthy,AP/IT,KCET
88. DEADLOCK RECOVERY
When deadlock is detected :
Some transaction will have to rolled back (made a victim) to
break deadlock. Select that transaction as victim that will
incur minimum cost.
Rollback -- determine how far to roll back transaction
Total rollback: Abort the transaction and then restart it.
More effective to roll back transaction only as far as necessary to
break deadlock.
Starvation happens if same transaction is always chosen as
victim. Include the number of rollbacks in the cost factor to
avoid starvation
88
PreparedbyR.Arthy,AP/IT,KCET
89. PART B QUESTIONS
Write a short note on deadlock. [Nov 2014]
What is deadlock? How does it occur? How transactions
be written to avoid deadlock and guarantee correct
execution. Illustrate with suitable example. [Nov 2015]
Outline the deadlock handling mechanisms. [Nov 2016,
Nov 2018]
Explain the concepts of Deadlock avoidance and
prevention in detail. [Nov 2018]
89
PreparedbyR.Arthy,AP/IT,KCET
90. PROBLEMS
Consider the following schedules. The actions are listed in the
order they are scheduled and prefixed with the transaction
name:
S1: T1:R(X),T2:R(X),T1:W(Y),T2:W(Y),T1:R(Y),T2:R(Y)
S2: T3:W(X),T1:R(X),T1:W(Y),T2:W(Z),T3:R(Z)
For each of the schedules answer the following questions:
What is the precedence graph for the schedule?
Is the schedule conflict serializable? If so what are all the
conflict equivalent serial schedules?
Is the schedule view serializable? If so what are all the view
equivalent serial schedule?
[May 2015] 90
PreparedbyR.Arthy,AP/IT,KCET
91. [CONTD…]
Consider the following schedules S1 and S2 with three
transactions T1,T2 and T3 as follows;
S1:r1(X);r3(X);w1(X);r2(X);w3(X)
S2:r3(X);r2(X);w3(X);r1(X);w1(X)
Is the schedule S1 and S2 conflict serializable?
91
PreparedbyR.Arthy,AP/IT,KCET
92. [CONTD…]
Consider a schedule S with three transactions T1,T2 and
T3 as follows;
S1: R1(x);W2(x);R1(x);W1(y);commit1;commit2;
S2: R1(A) , R2(A) , R1(B) , R2(B) , R3(B) , W1(A) ,
W2(B)
Is the schedule S1 and S2 conflict serializable?
92
PreparedbyR.Arthy,AP/IT,KCET
93. [CONTD…]
Consider schedules s3,s4,and s5 below. Determine whether
each schedule is strict, cascadeless, recoverable or
nonrecoverable. (Determine the strictest recoverability
condition that each schedule satisfies.)
S3:r1(X);r2(Z);r3(X);r3(Y);w1(X);c1;w3(Y);c3;r2(Y);w2(Z
);w2(Y);C2;
s4 :
r1(X);r2(Z);r1(Z);r3(X),r3(Y);w1(X);w3(Y);r2(Y);w2(Z);w
2(Y);c1;c2;c3;
s5 :
r1(X);r2(Z);r3(X);r1(Z);r2(Y);r3(Y);w1(X);C1;w2(Z);w3(Y
);w2(Y);c3;c2; 93
PreparedbyR.Arthy,AP/IT,KCET
95. PART B QUESTIONS
Explain deferred and immediate modification versions of
the log based recovery scheme. [May 2019]
Explain why timestamp based concurrency control
allows schedules that are not recoverable. Describe how
it can be modified through buffering to disallow such
schedules.
95
PreparedbyR.Arthy,AP/IT,KCET
96. FAILURE CLASSIFICATION
Transaction failure :
Logical errors: transaction cannot complete due to some internal
error condition
System errors: the database system must terminate an active
transaction due to an error condition (e.g., deadlock)
System crash: a power failure or other hardware or software
failure causes the system to crash.
Fail-stop assumption: non-volatile storage contents are assumed to
not be corrupted by system crash
Database systems have numerous integrity checks to prevent corruption
of disk data
Disk failure: a head crash or similar disk failure destroys all
or part of disk storage
Destruction is assumed to be detectable: disk drives use checksums
to detect failures
96
PreparedbyR.Arthy,AP/IT,KCET
97. RECOVERY ALGORITHMS
Recovery algorithms are techniques to ensure database
consistency and transaction atomicity and durability
despite failures
Focus of this chapter
Recovery algorithms have two parts
1. Actions taken during normal transaction processing to
ensure enough information exists to recover from failures
2. Actions taken after a failure to recover the database contents
to a state that ensures atomicity, consistency and durability
97
PreparedbyR.Arthy,AP/IT,KCET
98. STORAGE STRUCTURE
Volatile storage:
does not survive system crashes
examples: main memory, cache memory
Nonvolatile storage:
survives system crashes
examples: disk, tape, flash memory,
non-volatile (battery backed up) RAM
Stable storage:
a mythical form of storage that survives all failures
approximated by maintaining multiple copies on distinct
nonvolatile media
98
PreparedbyR.Arthy,AP/IT,KCET
99. STABLE-STORAGE IMPLEMENTATION
Maintain multiple copies of each block on separate disks
copies can be at remote sites to protect against disasters such as fire
or flooding.
Failure during data transfer can still result in inconsistent
copies: Block transfer can result in
Successful completion
Partial failure: destination block has incorrect information
Total failure: destination block was never updated
Protecting storage media from failure during data transfer
(one solution):
Execute output operation as follows (assuming two copies of each
block):
1. Write the information onto the first physical block.
2. When the first write successfully completes, write the same
information onto the second physical block.
3. The output is completed only after the second write successfully
completes.
99
PreparedbyR.Arthy,AP/IT,KCET
100. [CONTD…]
Protecting storage media from failure during data transfer (cont.):
Copies of a block may differ due to failure during output
operation. To recover from failure:
1. First find inconsistent blocks:
1. Expensive solution: Compare the two copies of every disk block.
2. Better solution:
Record in-progress disk writes on non-volatile storage (Non-volatile
RAM or special area of disk).
Use this information during recovery to find blocks that may be
inconsistent, and only compare copies of these.
Used in hardware RAID systems
2. If either copy of an inconsistent block is detected to have an error (bad
checksum), overwrite it by the other copy. If both have no error, but are
different, overwrite the second block by the first block.
100
PreparedbyR.Arthy,AP/IT,KCET
101. DATA ACCESS
Physical blocks are those blocks residing on the disk.
Buffer blocks are the blocks residing temporarily in main
memory.
Block movements between disk and main memory are initiated
through the following two operations:
input(B) transfers the physical block B to main memory.
output(B) transfers the buffer block B to the disk, and replaces the
appropriate physical block there.
Each transaction Ti has its private work-area in which local
copies of all data items accessed and updated by it are kept.
Ti's local copy of a data item X is called xi.
We assume, for simplicity, that each data item fits in, and is
stored inside, a single block.
101
PreparedbyR.Arthy,AP/IT,KCET
102. [CONTD…]
Transaction transfers data items between system buffer blocks
and its private work-area using the following operations :
read(X) assigns the value of data item X to the local variable xi.
write(X) assigns the value of local variable xi to data item {X} in the
buffer block.
both these commands may necessitate the issue of an input(BX)
instruction before the assignment, if the block BX in which X resides
is not already in memory.
Transactions
Perform read(X) while accessing X for the first time;
All subsequent accesses are to the local copy.
After last access, transaction executes write(X).
output(BX) need not immediately follow write(X). System
can perform the output operation when it deems fit.
102
PreparedbyR.Arthy,AP/IT,KCET
103. EXAMPLE OF DATA ACCESS
X
Y
A
B
x1
y1
buffer
Buffer Block A
Buffer Block B
input(A)
output(B)
read(X)
write(Y)
disk
work area
of T1
work area
of T2
memory
x2
103
PreparedbyR.Arthy,AP/IT,KCET
104. RECOVERY AND ATOMICITY
Modifying the database without ensuring that the
transaction will commit may leave the database in an
inconsistent state.
Consider transaction Ti that transfers $50 from account A to
account B; goal is either to perform all database
modifications made by Ti or none at all.
Several output operations may be required for Ti (to output
A and B). A failure may occur after one of these
modifications have been made but before all of them are
made.
104
PreparedbyR.Arthy,AP/IT,KCET
105. [CONTD…]
To ensure atomicity despite failures, we first output
information describing the modifications to stable
storage without modifying the database itself.
We study two approaches:
log-based recovery, and
shadow-paging
We assume (initially) that transactions run serially, that
is, one after the other.
105
PreparedbyR.Arthy,AP/IT,KCET
106. LOG-BASED RECOVERY
A log is kept on stable storage.
The log is a sequence of log records, and maintains a record of update
activities on the database.
When transaction Ti starts, it registers itself by writing a
<Ti start>log record
Before Ti executes write(X), a log record <Ti, X, V1, V2> is written,
where V1 is the value of X before the write, and V2 is the value to be
written to X.
Log record notes that Ti has performed a write on data item Xj Xj had value
V1 before the write, and will have value V2 after the write.
When Ti finishes it last statement, the log record <Ti commit> is
written.
We assume for now that log records are written directly to stable
storage (that is, they are not buffered)
Two approaches using logs
Deferred database modification
Immediate database modification
106
PreparedbyR.Arthy,AP/IT,KCET
107. DEFERRED DATABASE MODIFICATION
The deferred database modification scheme records all
modifications to the log, but defers all the writes to after partial
commit.
Assume that transactions execute serially
Transaction starts by writing <Ti start> record to log.
A write(X) operation results in a log record <Ti, X, V> being written,
where V is the new value for X
Note: old value is not needed for this scheme
The write is not performed on X at this time, but is deferred.
When Ti partially commits, <Ti commit> is written to the log
Finally, the log records are read and used to actually execute the
previously deferred writes.
107
PreparedbyR.Arthy,AP/IT,KCET
108. [CONTD…]
During recovery after a crash, a transaction needs to be redone if
and only if both <Ti start> and<Ti commit> are there in the log.
Redoing a transaction Ti ( redoTi) sets the value of all data items
updated by the transaction to the new values.
Crashes can occur while
the transaction is executing the original updates, or
while recovery action is being taken
example transactions T0 and T1 (T0 executes before T1):
T0: read (A) T1 : read (C)
A: - A - 50 C:- C- 100
Write (A) write (C)
read (B)
B:- B + 50
write (B) 108
PreparedbyR.Arthy,AP/IT,KCET
109. [CONTD…]
Below we show the log as it appears at three instances of time.
If log on stable storage at time of crash is as in case:
(a) No redo actions need to be taken
(b) redo(T0) must be performed since <T0 commit> is present
(c) redo(T0) must be performed followed by redo(T1) since
<T0 commit> and <Ti commit> are present
109
PreparedbyR.Arthy,AP/IT,KCET
110. IMMEDIATE DATABASE MODIFICATION
The immediate database modification scheme allows
database updates of an uncommitted transaction to be made as
the writes are issued
since undoing may be needed, update logs must have both old value
and new value
Update log record must be written before database item is
written
We assume that the log record is output directly to stable storage
Can be extended to postpone log record output, so long as prior to
execution of an output(B) operation for a data block B, all log
records corresponding to items B must be flushed to stable storage
Output of updated blocks can take place at any time before or
after transaction commit
Order in which blocks are output can be different from the
order in which they are written.
110
PreparedbyR.Arthy,AP/IT,KCET
111. IMMEDIATE DATABASE MODIFICATION EXAMPLE
Log Write Output
<T0 start>
<T0, A, 1000, 950>
To, B, 2000, 2050
A = 950
B = 2050
<T0 commit>
<T1 start>
<T1, C, 700, 600>
C = 600
BB, BC
<T1 commit>
BA
Note: BX denotes block containing X.
x1
111
PreparedbyR.Arthy,AP/IT,KCET
112. [CONTD…]
Recovery procedure has two operations instead of one:
undo(Ti) restores the value of all data items updated by Ti to their
old values, going backwards from the last log record for Ti
redo(Ti) sets the value of all data items updated by Ti to the new
values, going forward from the first log record for Ti
Both operations must be idempotent
That is, even if the operation is executed multiple times the effect is
the same as if it is executed once
Needed since operations may get re-executed during recovery
When recovering after failure:
Transaction Ti needs to be undone if the log contains the record
<Ti start>, but does not contain the record <Ti commit>.
Transaction Ti needs to be redone if the log contains both the record
<Ti start> and the record <Ti commit>.
Undo operations are performed first, then redo operations.
112
PreparedbyR.Arthy,AP/IT,KCET
113. IMMEDIATE DB MODIFICATION RECOVERY EXAMPLE
Below we show the log as it appears at three instances of time.
Recovery actions in each case above are:
(a) undo (T0): B is restored to 2000 and A to 1000.
(b) undo (T1) and redo (T0): C is restored to 700, and then A and B are
set to 950 and 2050 respectively.
(c) redo (T0) and redo (T1): A and B are set to 950 and 2050
respectively. Then C is set to 600
113
PreparedbyR.Arthy,AP/IT,KCET
114. CHECKPOINTS
Problems in recovery procedure as discussed earlier :
1. searching the entire log is time-consuming
2. we might unnecessarily redo transactions which have
already
3. output their updates to the database.
Streamline recovery procedure by periodically
performing checkpointing
1. Output all log records currently residing in main memory
onto stable storage.
2. Output all modified buffer blocks to the disk.
3. Write a log record < checkpoint> onto stable storage.
114
PreparedbyR.Arthy,AP/IT,KCET
115. [CONTD…]
During recovery we need to consider only the most recent
transaction Ti that started before the checkpoint, and transactions
that started after Ti.
1. Scan backwards from end of log to find the most recent
<checkpoint> record
2. Continue scanning backwards till a record <Ti start> is found.
3. Need only consider the part of log following above start
record. Earlier part of log can be ignored during recovery, and
can be erased whenever desired.
4. For all transactions (starting from Ti or later) with no <Ti
commit>, execute undo(Ti). (Done only in case of immediate
modification.)
5. Scanning forward in the log, for all transactions starting
from Ti or later with a <Ti commit>, execute redo(Ti). 115
PreparedbyR.Arthy,AP/IT,KCET
116. EXAMPLE OF CHECKPOINTS
T1 can be ignored (updates already output to disk due to
checkpoint)
T2 and T3 redone.
T4 undone
Tc Tf
T1
T2
T3
T4
checkpoint system failure
116
PreparedbyR.Arthy,AP/IT,KCET
117. RECOVERY WITH CONCURRENT TRANSACTIONS
We modify the log-based recovery schemes to allow multiple
transactions to execute concurrently.
All transactions share a single disk buffer and a single log
A buffer block can have data items updated by one or more transactions
We assume concurrency control using strict two-phase locking;
i.e. the updates of uncommitted transactions should not be visible to
other transactions
Otherwise how to perform undo if T1 updates A, then T2 updates A and
commits, and finally T1 has to abort?
Logging is done as described earlier.
Log records of different transactions may be interspersed in the log.
The checkpointing technique and actions taken on recovery have
to be changed
since several transactions may be active when a checkpoint is performed.
117
PreparedbyR.Arthy,AP/IT,KCET
118. [CONTD…]
Checkpoints are performed as before, except that the checkpoint log record
is now of the form
< checkpoint L>
where L is the list of transactions active at the time of the checkpoint
We assume no updates are in progress while the checkpoint is carried
out (will relax this later)
When the system recovers from a crash, it first does the following:
1. Initialize undo-list and redo-list to empty
2. Scan the log backwards from the end, stopping when the first
<checkpoint L> record is found.
For each record found during the backward scan:
if the record is <Ti commit>, add Ti to redo-list
if the record is <Ti start>, then if Ti is not in redo-list, add Ti to undo-list
3. For every Ti in L, if Ti is not in redo-list, add Ti to undo-list
118
PreparedbyR.Arthy,AP/IT,KCET
119. [CONTD…]
At this point undo-list consists of incomplete transactions which
must be undone, and redo-list consists of finished transactions that
must be redone.
Recovery now continues as follows:
1. Scan log backwards from most recent record, stopping when
<Ti start> records have been encountered for every Ti in undo-
list.
During the scan, perform undo for each log record that belongs to a
transaction in undo-list.
2. Locate the most recent <checkpoint L> record.
3. Scan log forwards from the <checkpoint L> record till the end
of the log.
During the scan, perform redo for each log record that belongs to a
transaction on redo-list
119
PreparedbyR.Arthy,AP/IT,KCET
120. EXAMPLE OF RECOVERY
Go over the steps of the recovery algorithm on the
following log:
<T0 start>
<T0, A, 0, 10>
<T0 commit>
<T1 start> /* Scan at step 1 comes up to here */
<T1, B, 0, 10>
<T2 start>
<T2, C, 0, 10>
<T2, C, 10, 20>
<checkpoint {T1, T2}>
<T3 start>
<T3, A, 10, 20>
<T3, D, 0, 10>
<T3 commit>
120
PreparedbyR.Arthy,AP/IT,KCET
121. LOG RECORD BUFFERING
Log record buffering: log records are buffered in main
memory, instead of of being output directly to stable storage.
Log records are output to stable storage when a block of log
records in the buffer is full, or a log force operation is executed.
Log force is performed to commit a transaction by forcing all
its log records (including the commit record) to stable
storage.
Several log records can thus be output using a single output
operation, reducing the I/O cost.
121
PreparedbyR.Arthy,AP/IT,KCET
122. [CONTD…]
The rules below must be followed if log records are
buffered:
Log records are output to stable storage in the order in which
they are created.
Transaction Ti enters the commit state only when the log
record
<Ti commit> has been output to stable storage.
Before a block of data in main memory is output to the
database, all log records pertaining to data in that block must
have been output to stable storage.
This rule is called the write-ahead logging or WAL rule
Strictly speaking WAL only requires undo information to be
output 122
PreparedbyR.Arthy,AP/IT,KCET
123. DATABASE BUFFERING
Database maintains an in-memory buffer of data blocks
When a new block is needed, if buffer is full an existing block needs to be
removed from buffer
If the block chosen for removal has been updated, it must be output to disk
If a block with uncommitted updates is output to disk, log records with undo
information for the updates are output to the log on stable storage first
(Write ahead logging)
No updates should be in progress on a block when it is output to disk. Can
be ensured as follows.
Before writing a data item, transaction acquires exclusive lock on block
containing the data item
Lock can be released once the write is completed.
Such locks held for short duration are called latches.
Before a block is output to disk, the system acquires an exclusive latch on the
block
Ensures no update can be in progress on the block
123
PreparedbyR.Arthy,AP/IT,KCET
124. BUFFER MANAGEMENT (CONT.)
Database buffer can be implemented either
in an area of real main-memory reserved for the database, or
in virtual memory
Implementing buffer in reserved main-memory has
drawbacks:
Memory is partitioned before-hand between database buffer
and applications, limiting flexibility.
Needs may change, and although operating system knows
best how memory should be divided up at any time, it cannot
change the partitioning of memory.
124
PreparedbyR.Arthy,AP/IT,KCET
125. BUFFER MANAGEMENT (CONT.)
Database buffers are generally implemented in virtual memory in spite
of some drawbacks:
When operating system needs to evict a page that has been
modified, the page is written to swap space on disk.
When database decides to write buffer page to disk, buffer page
may be in swap space, and may have to be read from swap space
on disk and output to the database on disk, resulting in extra I/O!
Known as dual paging problem.
Ideally when OS needs to evict a page from the buffer, it should
pass control to database, which in turn should
1. Output the page to database instead of to swap space (making sure to output
log records first), if it is modified
2. Release the page from the buffer, for the OS to use
Dual paging can thus be avoided, but common operating systems do not support
such functionality.
125
PreparedbyR.Arthy,AP/IT,KCET
126. FAILURE WITH LOSS OF NONVOLATILE
STORAGE
So far we assumed no loss of non-volatile storage
Technique similar to checkpointing used to deal with loss of non-volatile
storage
Periodically dump the entire content of the database to stable storage
No transaction may be active during the dump procedure; a procedure
similar to checkpointing must take place
Output all log records currently residing in main memory onto stable
storage.
Output all buffer blocks onto the disk.
Copy the contents of the database to stable storage.
Output a record <dump> to log on stable storage.
126
PreparedbyR.Arthy,AP/IT,KCET
127. RECOVERING FROM FAILURE OF NON-VOLATILE STORAGE
To recover from disk failure
restore database from most recent dump.
Consult the log and redo all transactions that committed after the
dump
Can be extended to allow transactions to be active during dump;
known as fuzzy dump or online dump
Will study fuzzy checkpointing later
127
PreparedbyR.Arthy,AP/IT,KCET