real time database

23
REAL TIME DATABASE REAL TIME DATABASE

Upload: arvinthsaran

Post on 25-May-2015

624 views

Category:

Technology


9 download

TRANSCRIPT

Page 1: Real time database

REAL TIME DATABASEREAL TIME DATABASE

Page 2: Real time database

A real-time database system is a database system in which a timely response to a user request is

needed

Page 3: Real time database

Types of Real-Time Database Systems• Hard real-time database systems, e.g. early warning system• Soft real-time database systems, e.g., banking system, airline reservation system, digital library, stock market etc.

Page 4: Real time database

TRANSACTION• It is said to be set of read or write operations.

QUERY• A transaction is said to be a query if it contains either

a read or update operation.

• Commit is a point of no return, once a transaction is commited we are certain that, the changes to the database are permanent.

Page 5: Real time database

ACID PROPERTIES

Page 6: Real time database

ACID PROPERTIES

A- ATOMICITY

C- CONSISTENCY

I-ISOLATION

D- DURABILITY

Page 7: Real time database

ACID PROPERTIESATOMICITY

Atomicity requires that each transaction is "all or nothing": if one part of the transaction fails, the entire transaction fails, and the database state is left unchanged.

CONSISTENCY

The consistency property ensures that any transaction will bring the database from one valid state to another. Any data written to the database must be valid according to all defined rules.

Page 8: Real time database

ISOLATION

Until and unless a transaction is commited, the actions of it are not visible to any other transactions

DURABILITY

Durability means that once a transaction has been committed, it will remain so, even in the event of power loss, crashes, or any errors.

Page 9: Real time database

QUERIES IN REALTIME DATA BASE SYSTEM

• The queries associated with a RTDBS are associated with a deadline, there may be some response after the queries passed the deadlines.

•The data returned in response to a query must have absolute and relative consistency

ABSOLUTE CONSISTENCY

It is accuracy. The data returned in response to a query must be close to the result expected. Ex. If temperature or pressure is interrogated in a chemical vessel the data returned to be close to the current temperature or pressure.

RELATIVE CONSISTENCY

In case of multiple data is to be collected, it must be close to each other.

Page 10: Real time database

MEMORY FOR RTDBS

MAIN MEMORY

•The entire database is residing on the main memory is the concept behind main memory databases

•Main memory databases are faster than disk based databases. Since accessing data in memory reduces the I/O reading activity when querying the data which provides faster and more predictable performance than disk

Page 11: Real time database

Many MMDBs add durability via the following mechanisms

•Snapshot files or checkpoint images which record the state of the database at a given moment in time.

•Transaction logging, which records changes to the database in a file and facilitates easy recovery

•Non-volatile random access memory (NVRAM), usually in the form of static RAM backed up with battery power or an electrically erasable programmable ROM (EEPROM). With this storage, the MMDB system can recover the data stored from its last consistent state upon reboot.

•A clone database is created, which can be used when the primary database crashes.

Page 12: Real time database
Page 13: Real time database

DEADLOCK CONDITION

Page 14: Real time database

DEAD LOCK CONDITION IN DATABASE

•There may be situations when two or more transactions are put into wait state simultaneously .

•In this position each would be waiting for the other transaction to get released.

•EXAMPLE

Suppose we have two transactions 1 and 2 both executing simultaneously.

The transaction 1 is to update student table and then update course table.

The transaction 2 is to update course table and then student table.

•When a table is updated by a transaction it is locked for preventing access from other transaction.

•In the example both transaction 1 and 2 lock student and course table respectively, so both are locked.

•The two transactions should be executed simultaneously, so each one waits for other and causing a deadlock.

Page 15: Real time database

DEAD LOCK REMOVAL IN RTDBS

•If a deadlock cycle is detected, one of the transactions involved in the cycle must be aborted in order to break the cycle.

•In a RTDB system, the victim transaction should be chosen such that the largest number of remaining transactions can meet their deadline

•Five deadlock resolution policies that take into account the timing properties of the transactions and the cost of abort operations have been given. They are

Always aborts the transaction invoking deadlock detection.

Trace the deadlock cycle, and abort the transaction with the furthest deadline.

Trace the deadlock cycle, abort the transaction with the earliest deadline.

Page 16: Real time database

Trace the deadlock cycle, and abort the transaction with the least criticalness.

Abort the infeasible transaction with the least criticalness. If all transactions are feasible, then abort a feasible transaction with the least criticalness.

Page 17: Real time database

T TREE INDEXING

•A T-tree is a balanced index tree data structure optimized for cases where both the index and the actual data are fully kept in memory

•The actual data is always in main memory together with the index so that they just contain pointers to the actual data fields.

•A T-tree node usually consists of pointers to the parent node, the left and right child node, an ordered array of data pointers and some extra control data

Page 18: Real time database

TTREE STRUCTURE

Page 19: Real time database

SEARCH

•Search starts at the root node •If the current node is the bounding node for the search value then search its data array. Search fails if the value is not found in the data array•If the search value is less than the minimum value of the current node then continue search in its left subtree. Search fails if there is no left sub tree •If the search value is greater than the maximum value of the current node then continue search in its right subtree. Search failes if there is no right sub tree

Page 20: Real time database

ALGORTHIM USED IN REAL TIME DATABASE.

•Most of the transactions in the real time DB are associated with a deadline, hence Earliest Deadline First (EDF) algorithm finds a greater solution to schedule those transactions. But EDF algorithm will be working efficiently if the number of transactions are moderate. But usually the DB transactions are huge in a systems and EDF may not be suitable which leads to congestion.

•To manage with huge transactions an algorithm called Adaptive Earliest Deadline (AED) is implemented. It uses the congestion control and can process huge number of transactions. It uses two groups HIT and MISS group.

Each transaction associated with deadline are put in HIT group

Transaction not having deadline are put in MISS group

First the HIT group transaction will be executed and then the MISS group transaction will be executed

Page 21: Real time database

Ex

In a flight cockpit the cabin temperature, pressure, humidity should be monitored continuously

In a flight other things such as entrainment system, air-conditioning system are also to be monitored

But they are not much important as cockpit status. So the earlier one is put in HIT group and the latter one is put in MISS group

Page 22: Real time database

WEBSITE

Pradeepkumar.org

Page 23: Real time database

THANK U