Real-Time Databases

advertisement
Real-time Databases
Presented by
Parimala kyathsandra
CSE 666 fall 2006
Instructor
Prof. Subra ganesan
Introduction


A database is a structured and convenient
way to manage and sharing of large
quantities of data among multiple tasks
Real time databases occur in many real
time applications
In soft real time systems : banking, stock market,
and airline reservation systems
 In hard real time systems: early warning systems,
Emergency alarm systems

Basic Definitions

A transaction is a sequence of read and
write operations

In database terms ,


Query –consists of only read operations
Update- consists of write/other operations
ACID Properties




Atomicity: a transaction is done either
completely or not at all
Consistency: transactions are executed in
a given sequence
Isolation: the actions of a transaction are
not visible to any other transactions until it
is committed
Durability: the actions of a database are
permanent
Real-time Vs General Purpose
Databases



Real time database includes
- The ACID properties
- Timing issues
Queries to the database
-Have soft or hard deadlines
Data returned
-Must have both absolute consistency
and relative consistency
Real-time Vs General Purpose
Databases (Contd..)


Absolute consistency - is the accuracy
Relative consistency - for multiple data,
the data must have been collected
reasonably close to one another
Real-time Vs General Purpose
Databases (Contd..)

Example
Boiler temperature and pressure
Time
temperature
pressure
100
200
300
100
300
700
360
720
100
Need For Response Time
Predictability


Since the tasks in real time systems have
deadlines, it is important that transactions
response times be predictable
There are many factors that make it
difficult to predict response times
Factors Affecting Predictability


Transactions may be aborted to avoid
deadlock
Page faults -this occurs when part of the
data is stored on main memory and part
of it is stored on the disk systems
T1
system
Main
memory
Part of Data
for T1
Disk
Factors Affecting Predictability
(contd..)


Transaction read/write may be data
dependent
Transaction may suffer a delay because
they are waiting for another to complete
Pre Analysis


Pre analysis is done in order to make sure
A transaction completes within its
deadline
Dry run the transaction to evaluate the
processor,data and other needs
Dry Run the Transaction

During the process of dry run,




No writes are permitted
All the data required are brought to the main
memory by the end of dry run, so no page
fault occurs
Database recovery is not initiated if the
resources are not available, since nothing is
written to the database
Dry run guarantees that the transaction
completes within its deadline
Relaxing the ACID Properties

Durability : durability can not be
considered in some cases


Example- if some data is collected on
something, it is discarded after it is outdated
Serialization consistency can be relaxed in
cases
Disk Storage

Problems with the disk storage



How to prioritize and schedule disk accesses
How to position the data on the disk so that
access time is minimized
By tackling these two problems we can
improve transaction response time
Disk Storage
(Contd..)
Advantages



Since disks are passive data storage
devices,they hold data unless they are
physically damaged
A system crash does not affect the disk
When a single disk unit fails, the data on
the other units are not affected
Main Memory Databases


Since the disk accesses are slow, in order
to improve the response time, we have
the entire database in the main memory
This can be done only if the real time
database is small
Main Memory Databases

(Contd..)
If the response time is low, then the
probability of lock contention is also low,
since the transactions will be in the
system for a smaller duration
I.E, there won’t be many transactions
which are trying to access the same
resources
Main Memory Databases
(Contd..)
Transaction Log


Main memory can be used to write in the
log when the transaction commits
Since the entire log is too large to be held
in the main memory, it is copied to the
disk
Main Memory Databases
(Contd..)
Transaction Log

Transaction by transaction

Every time a transaction commits ,its log is
written to the disk
t1
t2
t3
t4
Main
memory
t1
t2
t3
t4
Disk
Main Memory Databases
(Contd..)
Transaction Log

Batch mode

The system waits until a certain volume of
transactions is committed and then copies the
entire batch to the disk
buffer
t1
t2
t3
t4
Main
memory
t1
t2
t3
t4
}
batch
Disk
Main Memory Databases

(Contd..)
Organizing


It is done by pointers, if the data occurs
more than once in the database,we can
simply store one copy of this and have
pointers to it
Using pointers makes many of the tasks
easier
Main Memory Databases
(Contd..)
Drawbacks




Frequent back ups are necessary
Main memory has to be restored after a
system crash
If the main memory fails , entire system
Has to be restored
In case of a crash , the database must be
stored with data along with the log
Databases for Hard Real Time
Systems


MDARTS - is an example of a hard real
time database system , it stands for
multiprocessor database architecture for
real time systems
Used mainly in control applications, such
as controlling machine tools and robots
etc
References



Real-time systems - C.M krishna and G shin
Real-time systems design and analysis
-Phillip A. Laplante
Real-time.Org
Thank You !
Download