Docsity

Database Transactions and Concurrency Control, Assignments of Computer Science

Toggle sidebar
bg1
Assignment 3
Part 1: Concept and Principles.
Question 1.
a. A - Atomic โ€“ a transaction in a DBMS can only be processed entirely or not processed at
all, i.e., it cannot be processed as one part. A DBMS ensures this through a COMMIT or
ROLE BACK.
b. C โ€“ Consistency โ€“ a transaction should not affect the database constraints i.e., if a
transaction was TRUE before a constraint, it should be TRUE after the transaction.
Consistency is ensured through defining constraints at the field level. Rules are specified
constraints to govern a given record or field โ€“ level value.
c. I - Isolated โ€“ the results of a transaction are not seen by the user until it finishes and be
committed. Isolation also means, execution of one transaction should not affect execution
of another transaction. DBMS ensures isolation through locking a row until it finishes so
that it cannot ne accesses by another task.
d. D โ€“ Durable โ€“ committed transactions are permanent i.e., when a transition committed
and failures occur after, failure cannot affect already committed transaction. DBMS
ensures durability by making use of transaction logs. DBMS writes to transaction log
where incase of failure a system can be restored using the logs.
Question 2.
Concurrent execution is when more than one user can access the same database at one given
time. A database is basically executed at one time in a multi user system by more than one user.
Anomalies do not occur if the users only perform a read as the data integrity problems are not
encountered. On the other side, if more than one user is updating the data at the same time, then,
there are bound to be integrity issues. That is why concurrency control is required. There are two
problems that occurs when concurrent executions especially those that handles data are not
controlled;
pf2

Partial preview of the text

Download Database Transactions and Concurrency Control and more Assignments Computer Science in PDF only on Docsity!

Assignment 3 Part 1: Concept and Principles. Question 1. a. A - Atomic โ€“ a transaction in a DBMS can only be processed entirely or not processed at all, i.e., it cannot be processed as one part. A DBMS ensures this through a COMMIT or ROLE BACK. b. C โ€“ Consistency โ€“ a transaction should not affect the database constraints i.e., if a transaction was TRUE before a constraint, it should be TRUE after the transaction. Consistency is ensured through defining constraints at the field level. Rules are specified constraints to govern a given record or field โ€“ level value. c. I - Isolated โ€“ the results of a transaction are not seen by the user until it finishes and be committed. Isolation also means, execution of one transaction should not affect execution of another transaction. DBMS ensures isolation through locking a row until it finishes so that it cannot ne accesses by another task. d. D โ€“ Durable โ€“ committed transactions are permanent i.e., when a transition committed and failures occur after, failure cannot affect already committed transaction. DBMS ensures durability by making use of transaction logs. DBMS writes to transaction log where incase of failure a system can be restored using the logs. Question 2. Concurrent execution is when more than one user can access the same database at one given time. A database is basically executed at one time in a multi user system by more than one user. Anomalies do not occur if the users only perform a read as the data integrity problems are not encountered. On the other side, if more than one user is updating the data at the same time, then, there are bound to be integrity issues. That is why concurrency control is required. There are two problems that occurs when concurrent executions especially those that handles data are not controlled;

i. Problem of lost updates, This problem happens when more than one user is attempting to update data at a given time due to insufficient concurrency control. An example is, if a bank account is receiving a deposit from another account while the account holder is withdrawing at the same time. That means, the bank will lose track of what happened exactly. ii. The inconsistent read problem. This kind of a problem occurs when a user gets an access and reads partially updated data done by another user. This kind of read is also called dirty read or an unrepeatable read because it is incorrect.