A real-time database system is a database system in which a timely response to a user request is needed
Types of Real-Time Database Systems• Hard real-time database systems, e.g. early warningsystem• Soft real-time database systems, e.g., banking system,airline reservation system, digital library, stock market etc.
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.
ACID PROPERTIESATOMICITYAtomicity requires that each transaction is "all or nothing": if one part ofthe transaction fails, the entire transaction fails, and the database state isleft unchanged.CONSISTENCYThe consistency property ensures that any transaction will bring thedatabase from one valid state to another. Any data written to the databasemust be valid according to all defined rules.
ISOLATIONUntil and unless a transaction is commited, the actions of it are not visibleto any other transactionsDURABILITYDurability means that once a transaction has been committed, it willremain so, even in the event of power loss, crashes, or any errors.
QUERIES IN REALTIME DATA BASESYSTEM • 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.
MEMORY FOR RTDBSMAIN MEMORY•The entire database is residing on the main memory isthe concept behind main memory databases•Main memory databases are faster than disk baseddatabases. Since accessing data in memory reduces the I/O reading activity when querying the data which providesfaster and more predictable performance than disk
Many MMDBs add durability via the following mechanisms•Snapshot files or checkpoint images which record the state of thedatabase at a given moment in time.•Transaction logging, which records changes to the database in a fileand facilitates easy recovery•Non-volatile random access memory (NVRAM), usually in the form ofstatic RAM backed up with battery power or an electrically erasableprogrammable ROM (EEPROM). With this storage, the MMDBsystem can recover the data stored from its last consistent state uponreboot.•A clone database is created, which can be used when the primarydatabase crashes.
DEAD LOCK CONDITION IN DATABASE•There may be situations when two or more transactions are put into wait statesimultaneously .•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 otherand causing a deadlock.
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.
Trace the deadlock cycle, and abort the transaction with the leastcriticalness. Abort the infeasible transaction with the least criticalness. If alltransactions are feasible, then abort a feasible transaction with the leastcriticalness.
T TREE INDEXING•A T-tree is a balanced index tree data structure optimized for cases where boththe 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 justcontain pointers to the actual data fields.•A T-tree node usually consists of pointers to the parent node, the left and rightchild node, an ordered array of data pointers and some extra control data
SEARCH•Search starts at the root node•If the current node is the bounding node for the search valuethen search its data array. Search fails if the value is not foundin the data array•If the search value is less than the minimum value of thecurrent node then continue search in its left subtree. Searchfails if there is no left sub tree•If the search value is greater than the maximum value of thecurrent node then continue search in its right subtree. Searchfailes if there is no right sub tree
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 toschedule those transactions. But EDF algorithm will be working efficiently ifthe number of transactions are moderate. But usually the DB transactionsare huge in a systems and EDF may not be suitable which leads tocongestion.•To manage with huge transactions an algorithm called Adaptive EarliestDeadline (AED) is implemented. It uses the congestion control and canprocess huge number of transactions. It uses two groups HIT and MISSgroup. 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 MISSgroup transaction will be executed
Ex In a flight cockpit the cabin temperature, pressure, humidity should be monitoredcontinuously In a flight other things such as entrainment system, air-conditioning system are also tobe monitored But they are not much important as cockpit status. So the earlier one is put in HITgroup and the latter one is put in MISS group