You are on page 1of 5

Q.

1 answer

a)
DBMS RDBMS
DBMS stores data as file. RDBMS stores data in tabular form.

Data elements need to access Multiple data elements can be accessed at


individually. the same time.

Data is stored in the form of tables which are


No relationship between data. related to each other.

Normalization is not present. Normalization is present.

DBMS does not support distributed


database. RDBMS supports distributed database.

It uses a tabular structure where the headers


It stores data in either a are the column names, and the rows contain
navigational or hierarchical form. corresponding values.

It deals with small quantity of data. It deals with large amount of data.

Data redundancy is common in this Keys and indexes do not allow Data
model. redundancy.

It is used for small organization and


deal with small data. It is used to handle large amount of data.

It supports single user. It supports multiple users.

Data fetching is slower for the large Data fetching is fast because of relational
amount of data. approach.

The data in a DBMS is subject to


low security levels with regards to There exists multiple levels of data security
data manipulation. in a RDBMS.

Low software and hardware


necessities. Higher software and hardware necessities.
Q.1 answer

a)
DBMS RDBMS
Examples: XML, Window Registry, Examples: MySQL, PostgreSQL, SQL
etc. Server, Oracle, Microsoft Access etc.

b)

Concurrency Control can be implemented in different ways. One way to implement it is by using Locks. Now,
let us discuss Time Stamp Ordering Protocol. 
As earlier introduced, Timestamp is a unique identifier created by the DBMS to identify a transaction. They
are usually assigned in the order in which they are submitted to the system. Refer to the timestamp of a
transaction T as TS(T). For the basics of Timestamp, you may refer here. 

c)

The transaction refers to a small unit of any given program that consists of various low-level tasks. Every
transaction in DBMS must maintain ACID – A (Atomicity), C (Consistency), I (Isolation), D (Durability). One must
maintain ACID so as to ensure completeness, accuracy, and integrity of data

d)

. A cursor is a temporary work area created in the system memory when a SQL statement is executed. A cursor
contains information on a select statement and the rows of data accessed by it. This temporary work area is used to
store the data retrieved from the database, and manipulate this data

e)

A schedule is serialized if it is equivalent to a serial schedule. A concurrent schedule


must ensure it is the same as if executed serially means one after another. It refers to
the sequence of actions such as read, write, abort, commit are performed in a serial
manner.

Example
Let’s take two transactions T1 and T2,
If both transactions are performed without interfering each other then it is called as
serial schedule, it can be represented as follows −

T1 T2

READ1(A)
T1 T2

WRITE1(A)

READ1(B)

C1

READ2(B)

WRITE2(B)

READ2(B)

C2

Non serial schedule − When a transaction is overlapped between the transaction T1


and T2.

Example
Consider the following example −

T1 T2

READ1(A)

WRITE1(A)

READ2(B)

WRITE2(B)

READ1(B)
T1 T2

WRITE1(B)

READ1(B)

2PL locking protocol

Every transaction will lock and unlock the data item in two different phases.
 Growing Phase − All the locks are issued in this phase. No locks are released, after all changes to data-items
are committed and then the second phase (shrinking phase) starts.
 Shrinking phase − No locks are issued in this phase, all the changes to data-items are noted (stored) and
then locks are released.
The 2PL locking protocol is represented diagrammatically as follows −

In the growing phase transaction reaches a point where all the locks it may need has been acquired. This point is
called LOCK POINT.
After the lock point has been reached, the transaction enters a shrinking phase.

Types

Two phase locking is of two types −


Strict two phase locking protocol

A transaction can release a shared lock after the lock point, but it cannot release any exclusive lock until the
transaction commits. This protocol creates a cascade less schedule.
Cascading schedule: In this schedule one transaction is dependent on another transaction. So if one has to rollback
then the other has to rollback.

Rigorous two phase locking protocol

A transaction cannot release any lock either shared or exclusive until it commits.
The 2PL protocol guarantees serializability, but cannot guarantee that deadlock will not happen.

Example

Let T1 and T2 are two transactions.


T1=A+B and T2=B+A

T1 T2

Lock-X(A) Lock-X(B)

Read A; Read B;

Lock-X(B) Lock-X(A)
Here,
Lock-X(B) : Cannot execute Lock-X(B) since B is locked by T2.
Lock-X(A) : Cannot execute Lock-X(A) since A is locked by T1.
In the above situation T1 waits for B and T2 waits for A. The waiting time never ends. Both the transaction cannot
proceed further at least any one releases the lock voluntarily. This situation is called deadlock.
The wait for graph is as follows −

Wait for graph: It is used in the deadlock detection method, creating a node for each transaction, creating an edge Ti
to Tj, if Ti is waiting to lock an item locked by Tj. A cycle in WFG indicates a deadlock has occurred. WFG is created
at regular intervals

You might also like