0% found this document useful (0 votes)
678 views7 pages

Serial Schedule Non-Serial Schedule: Checkpoints

Serial schedules preserve the order of operations in individual transactions and execute transactions sequentially. Non-serial schedules allow interleaving of transactions and concurrent execution but can lead to concurrency problems if the schedule is not properly arranged. The objective of serializability is to generate schedules that are equivalent to serial schedules, allowing concurrent transaction execution without interference.

Uploaded by

Sandeep Burman
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
678 views7 pages

Serial Schedule Non-Serial Schedule: Checkpoints

Serial schedules preserve the order of operations in individual transactions and execute transactions sequentially. Non-serial schedules allow interleaving of transactions and concurrent execution but can lead to concurrency problems if the schedule is not properly arranged. The objective of serializability is to generate schedules that are equivalent to serial schedules, allowing concurrent transaction execution without interference.

Uploaded by

Sandeep Burman
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Serial Schedule Non-Serial Schedule

A serial schedule is a sequence of operation by a set of A non-serial schedule is a schedule


concurrent transaction that preserves the order of operations of a group of concurrent tra
operations in each of the individual transactions. interleaved.
Transactions are performed in serial order. Transactions are performed in non-seri
result should be same as serial.
No interference between transactions Concurrency problem can arise here.
It does not matter which transaction is executed first, The problem we have seen earlier
as long as every transaction is executed in its entirely uncommitted data, inconsistent analys
from the beginning to end. scheduling is not proper.
A serial schedule gives the benefits of concurrent In this schedule there is no any benefit
execution without any problem execution.
Serial schedule that does interleaved the actions of Where non-serial schedule has no only
different transactions. any transaction.
EXAMPLE: EXAMPLE:
If some transaction T is long, the other transaction In this schedule the execution of othe
must wait for T to complete all its operations. goes on without waiting the completion o
If we consider transaction to be independent serial The objective behind serializability is to
schedule is correct based on (property ACID) above serial schedule that allows transaction
assumption is valid. concurrently without interfering one ano
Poste

Checkpoints

Checkpoints

When System failure occurs

o We must consult log to determine those transaction that need to be redone and
those transaction that need to be undone.

o We need to search entire log to determine this information.

There are two major difficulties with this

o Search process is time consuming

o Most of transaction that need to be redone have already written their update into
the database. Although redoing them will cause no harm.

 To reduce this type of overhead, we introduced checkpoints.

 During execution system maintains the log, using one of the two techniques Deferred
update or Immediate update.
 In addition, System periodically performs checkpoints, which requires following
sequence of action to take place

 Output onto stable storage all log records currently residing in main memory.

 Output to the disk all modified buffer blocks

 Output onto stable storage a log record.

 Transactions are not allowed to perform any update actions such as

o Writing to a buffer block or

o Writing to log record

While a checkpoint is in progress.

 Checkpoint can be occur automatically and manually.

 Checkpoints continue to occur whenever the database is shut down (normal or


immediate) or when a redo log switch occurs.

 To force a checkpoint, issue the following SQL command:

o alter system switch logfile;

o Alter system checkpoint;

Example :

 T1 can be ignored (updates already output to disk due to checkpoint)

 T2 and T3 redone.

 T4 undone

Posted by Parag Shukla at 10:40 PM


Labels: Checkpoints
Shadow Paging
 This technique does not require LOG in single user environment

 In multi-user may need LOG for concurrency control method

 Shadow paging considers

o The database is partitioned into fixed-length blocks referred to as PAGES.

o Page table has n entries – one for each database page.

o Each contain pointer to a page on disk (1 to 1st page on database and so


on…).

The idea is to maintain 2 pages tables during the life of transaction.

o The current page table


o The shadow page table

When transaction starts, both page tables are identical

o The shadow page table is never changed over the duration of the transaction.
o The current page table may be changed when a transaction performs a write
operation.
o All input and output operations use the current page table to locate database
pages on disk.

Advantages

 No Overhead for writing log records.


 No Undo /  No Redo algorithm.
 Recovery is faster.

Disadvantages
 Data gets fragmented  or scattered.
 After every transaction completion database pages containing old version of modified
data need to be garbage collected.
 Hard to extend algorithm to allow transaction to run concurrently.

Log Based Recovery

 The most widely used structure for recording database modification is the log.
 The log is a sequence of log records, recording all the update activities in the
database.
 In short Transaction log is a journal, which contains history of all transaction
performed.
 Log contains Start of transaction, trans-id, record-id, type of operation (insert, update,
delete), old value, new value, End of transaction that is commit or aborted.

Techniques for recovery

Log Based Crash Recovery

o Deferred update

Complete -> update

o Immediate update

Change -> update

o Checkpoints

Shadow Paging

Posted by Parag Shukla at 10:14 PM


Labels: backup, Database Management Systems – II, Log based Recovery, recovery

Q-1. Explain the Following Questions.

1). What is Concurrency Control? Why it is needed ? What is its importance?


2). Explain different problem of Concurrency control with and example?
3). What is Serializability? What is its objective?
4). What is locking? What are the Different types of Lock? Explain different level of locking?
5). How does Locking Protocol work?
6). What are the disadvantage of Basic locking protocal? What is Advantage of two phase
locking?
7). How does 2PL work?
8). What is Deadlock? How are deadlock handled? What is deadlock prevention? What is
deadlock detection and Recovery? Explain with an Example.
9). What is Timestamp Ordering protocol?
10). How does Timestamp Ordering protocol work? Explain with an example?
11). What is Thomas’s write rule and why is it important? (Ignore Obsolete Write Rule)
12). What are the different phases in a validation based concurrency technique?
13). How does validation based concurrency technique work? (Optmistic Technique)
14). What is cascading rollback? Explain with an Example?
15). Define the terms : Lock Point, Strict 2PL, Starvation

Q.2. Differentiate the following :

1). Dirty Read Vs Unrepeatable Read


2). Serial Schedule Vs Non-Serial Schedule
3). Lost Update Vs Uncommitted Data
4). Starvation Vs Deadlock

Q.3. State whether the following statements are true or false. Justify. No
Justification, no marks.

1.    Level 1 transaction is the minimum consistency requirement that allows a transaction to be
recovered in the event of system failure.
2.    There is no deadlock in the timestamp method of concurrency control.
3.    Level 0 transactions are recoverable.
4.    The objective of concurrency control is to schedule or arrange the transactions in such a
way as to avoid any interference.
5.    In a shrinking phase, a transaction release all locks and can not obtain any new locks.

Defferred Update method


Deferred update

 Do not physically update the database on disk until after a transaction reaches its
commit point;
 Then updates are recorded persistently in the log and the written to the database.
 Before reaching commit point, the transaction updates are recorded in the local
transaction workspace (buffers)
 During commit, the updates are first recorded persistently in log and then write to
the database.

Transaction fail

o If transaction fails before reaching commit point, it will not have changed the
database. (no need undo)

o It may necessary to REDO the effect of the operations of a committed


transaction from the log, because their effect may not yet have been recorded.
 Deferred update is known as “NO-UNDO/REDO Algorithm”

Recovery based on deferred update

This technique postpone any actual update to the database until the transaction
complete and reached check point.

During transaction execute

o Updates are recorded in log file and in cache buffer.

o After transaction reaches it commit point and the log file is forced to write to
disk, the update are record to database.

Fail before commit,

no need undo.

Simplify recovery,

 Can not use in practice because unless transaction are short and each transaction
change few times.
 May running out of buffer space because transaction change must be held in buffer
until commit.

State

 A transaction can not change the database on disk until it reaches it commit point.
 A transaction does not reach its commit point until all its update operations are
recorded in the log and the log is force written to disk.

Example of Deferred Update


Example

Example :

Posted by Parag Shukla at 9:47 PM


Labels: Deffered Update, Log based Deffered Update

You might also like