real-time databases presented by parimala kyathsandra cse 666 fall 2006 instructor prof. subra...

25
Real-time Databases Real-time Databases Presented by Presented by Parimala kyathsandra Parimala kyathsandra CSE 666 fall 2006 CSE 666 fall 2006 Instructor Instructor Prof. Subra ganesan Prof. Subra ganesan

Upload: helena-white

Post on 13-Dec-2015

217 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Real-time Databases Presented by Parimala kyathsandra CSE 666 fall 2006 Instructor Prof. Subra ganesan

Real-time DatabasesReal-time Databases

Presented byPresented by

Parimala kyathsandraParimala kyathsandraCSE 666 fall 2006CSE 666 fall 2006

InstructorInstructor

Prof. Subra ganesanProf. Subra ganesan

Page 2: Real-time Databases Presented by Parimala kyathsandra CSE 666 fall 2006 Instructor Prof. Subra ganesan

IntroductionIntroduction A database is a structured and convenient A database is a structured and convenient

way to manage and sharing of large way to manage and sharing of large quantities of data among multiple tasksquantities of data among multiple tasks

Real time databases occur in many real Real time databases occur in many real time applicationstime applications

In soft real time systems : banking, stock market, In soft real time systems : banking, stock market, and airline reservation systemsand airline reservation systems

In hard real time systems: early warning systems,In hard real time systems: early warning systems,

Emergency alarm systemsEmergency alarm systems

Page 3: Real-time Databases Presented by Parimala kyathsandra CSE 666 fall 2006 Instructor Prof. Subra ganesan

Basic DefinitionsBasic Definitions

A transaction is a sequence of read A transaction is a sequence of read and write operationsand write operations

In database terms ,In database terms , Query –consists of only read operationsQuery –consists of only read operations Update- consists of write/other Update- consists of write/other

operationsoperations

Page 4: Real-time Databases Presented by Parimala kyathsandra CSE 666 fall 2006 Instructor Prof. Subra ganesan

ACID PropertiesACID Properties

Atomicity: a transaction is done either Atomicity: a transaction is done either completely or not at allcompletely or not at all

Consistency: transactions are executed in Consistency: transactions are executed in a given sequencea given sequence

Isolation: the actions of a transaction are Isolation: the actions of a transaction are not visible to any other transactions until not visible to any other transactions until it is committedit is committed

Durability: the actions of a database are Durability: the actions of a database are permanentpermanent

Page 5: Real-time Databases Presented by Parimala kyathsandra CSE 666 fall 2006 Instructor Prof. Subra ganesan

Real-time Vs General Real-time Vs General Purpose DatabasesPurpose Databases

Real time database includesReal time database includes

- The ACID properties - The ACID properties

- Timing issues- Timing issues Queries to the databaseQueries to the database

-Have soft or hard deadlines-Have soft or hard deadlines Data returned Data returned

-Must have both absolute consistency -Must have both absolute consistency and relative consistency and relative consistency

Page 6: Real-time Databases Presented by Parimala kyathsandra CSE 666 fall 2006 Instructor Prof. Subra ganesan

Real-time Vs General Real-time Vs General Purpose Databases (Contd..)Purpose Databases (Contd..) Absolute consistency - is the Absolute consistency - is the

accuracyaccuracy

Relative consistency - for multiple Relative consistency - for multiple data, the data must have been data, the data must have been collected reasonably close to one collected reasonably close to one anotheranother

Page 7: Real-time Databases Presented by Parimala kyathsandra CSE 666 fall 2006 Instructor Prof. Subra ganesan

Real-time Vs General Real-time Vs General Purpose Databases (Contd..)Purpose Databases (Contd..) ExampleExample

Boiler temperature and pressureBoiler temperature and pressure

TimeTime temperaturetemperaturepressurepressure

100100 100100 360360

200200 300300 720720

300300 700700 100100

Page 8: Real-time Databases Presented by Parimala kyathsandra CSE 666 fall 2006 Instructor Prof. Subra ganesan

Need For Response Time Need For Response Time PredictabilityPredictability

Since the tasks in real time systems Since the tasks in real time systems have deadlines, it is important that have deadlines, it is important that transactions response times be transactions response times be predictablepredictable

There are many factors that make it There are many factors that make it difficult to predict response timesdifficult to predict response times

Page 9: Real-time Databases Presented by Parimala kyathsandra CSE 666 fall 2006 Instructor Prof. Subra ganesan

Factors Affecting Factors Affecting PredictabilityPredictability

Transactions may be aborted to Transactions may be aborted to avoid deadlockavoid deadlock

Page faults -this occurs when part of Page faults -this occurs when part of the data is stored on main memory the data is stored on main memory and part of it is stored on the disk and part of it is stored on the disk systemssystems

system

Main memory

T1

DiskPart of Data for T1

Page 10: Real-time Databases Presented by Parimala kyathsandra CSE 666 fall 2006 Instructor Prof. Subra ganesan

Factors Affecting Factors Affecting Predictability Predictability (contd..)(contd..)

Transaction read/write may be data Transaction read/write may be data dependent dependent

Transaction may suffer a delay Transaction may suffer a delay because they are waiting for another because they are waiting for another to completeto complete

Page 11: Real-time Databases Presented by Parimala kyathsandra CSE 666 fall 2006 Instructor Prof. Subra ganesan

Pre Analysis Pre Analysis

Pre analysis is done in order to make Pre analysis is done in order to make suresure

A transaction completes within its A transaction completes within its

deadlinedeadline

Dry run the transaction to evaluate Dry run the transaction to evaluate the processor,data and other needsthe processor,data and other needs

Page 12: Real-time Databases Presented by Parimala kyathsandra CSE 666 fall 2006 Instructor Prof. Subra ganesan

Dry Run the TransactionDry Run the Transaction During the process of dry run,During the process of dry run,

No writes are permittedNo writes are permitted All the data required are brought to the main All the data required are brought to the main

memory by the end of dry run, so no page fault memory by the end of dry run, so no page fault occursoccurs

Database recovery is not initiated if the Database recovery is not initiated if the resources are not available, since nothing is resources are not available, since nothing is written to the databasewritten to the database

Dry run guarantees that the transaction Dry run guarantees that the transaction completes within its deadlinecompletes within its deadline

Page 13: Real-time Databases Presented by Parimala kyathsandra CSE 666 fall 2006 Instructor Prof. Subra ganesan

Relaxing the ACID Relaxing the ACID PropertiesProperties

Durability : durability can not be Durability : durability can not be considered in some casesconsidered in some cases Example- if some data is collected on Example- if some data is collected on

something, it is discarded after it is something, it is discarded after it is outdatedoutdated

Serialization consistency can be Serialization consistency can be relaxed in casesrelaxed in cases

Page 14: Real-time Databases Presented by Parimala kyathsandra CSE 666 fall 2006 Instructor Prof. Subra ganesan

Disk StorageDisk Storage

Problems with the disk storage Problems with the disk storage How to prioritize and schedule disk How to prioritize and schedule disk

accessesaccesses How to position the data on the disk so How to position the data on the disk so

that access time is minimizedthat access time is minimized

By tackling these two problems we can By tackling these two problems we can improve transaction response timeimprove transaction response time

Page 15: Real-time Databases Presented by Parimala kyathsandra CSE 666 fall 2006 Instructor Prof. Subra ganesan

Disk Storage Disk Storage (Contd..)(Contd..)

AdvantagesAdvantages

Since disks are passive data storage Since disks are passive data storage devices,they hold data unless they devices,they hold data unless they are physically damagedare physically damaged

A system crash does not affect the A system crash does not affect the diskdisk

When a single disk unit fails, the data When a single disk unit fails, the data on the other units are not affectedon the other units are not affected

Page 16: Real-time Databases Presented by Parimala kyathsandra CSE 666 fall 2006 Instructor Prof. Subra ganesan

Main Memory DatabasesMain Memory Databases

Since the disk accesses are slow, in Since the disk accesses are slow, in order to improve the response time, order to improve the response time, we have the entire database in the we have the entire database in the main memorymain memory

This can be done only if the real time This can be done only if the real time database is smalldatabase is small

Page 17: Real-time Databases Presented by Parimala kyathsandra CSE 666 fall 2006 Instructor Prof. Subra ganesan

Main Memory Databases Main Memory Databases (Contd..)(Contd..)

If the response time is low, then the If the response time is low, then the probability of lock contention is also probability of lock contention is also low, since the transactions will be in low, since the transactions will be in the system for a smaller durationthe system for a smaller duration

I.E, there won’t be many transactions I.E, there won’t be many transactions which are trying to access the same which are trying to access the same resourcesresources

Page 18: Real-time Databases Presented by Parimala kyathsandra CSE 666 fall 2006 Instructor Prof. Subra ganesan

Main Memory Databases Main Memory Databases (Contd..)(Contd..)

Transaction LogTransaction Log

Main memory can be used to write in Main memory can be used to write in the log when the transaction the log when the transaction commitscommits

Since the entire log is too large to be Since the entire log is too large to be held in the main memory, it is copied held in the main memory, it is copied to the diskto the disk

Page 19: Real-time Databases Presented by Parimala kyathsandra CSE 666 fall 2006 Instructor Prof. Subra ganesan

Main Memory Databases Main Memory Databases (Contd..)(Contd..)

Transaction LogTransaction Log Transaction by transactionTransaction by transaction

Every time a transaction commits ,its Every time a transaction commits ,its log is written to the disklog is written to the disk

Main memory Disk

t1t2

t3t4

t1t2

t3

t4

Page 20: Real-time Databases Presented by Parimala kyathsandra CSE 666 fall 2006 Instructor Prof. Subra ganesan

Main Memory Databases Main Memory Databases (Contd..)(Contd..)

Transaction LogTransaction Log Batch modeBatch mode

The system waits until a certain volume The system waits until a certain volume of transactions is committed and then of transactions is committed and then copies the entire batch to the diskcopies the entire batch to the disk

Main memory

Disk

t1t2

t3t4

t1t2

t3

t4

}batch

buffer

Page 21: Real-time Databases Presented by Parimala kyathsandra CSE 666 fall 2006 Instructor Prof. Subra ganesan

Main Memory Databases Main Memory Databases (Contd..)(Contd..)

OrganizingOrganizing It is done by pointers, if the data occurs It is done by pointers, if the data occurs

more than once in the database,we can more than once in the database,we can simply store one copy of this and have simply store one copy of this and have pointers to itpointers to it

Using pointers makes many of the tasks Using pointers makes many of the tasks easiereasier

Page 22: Real-time Databases Presented by Parimala kyathsandra CSE 666 fall 2006 Instructor Prof. Subra ganesan

Main Memory Databases Main Memory Databases (Contd..)(Contd..)

DrawbacksDrawbacks

Frequent back ups are necessaryFrequent back ups are necessary Main memory has to be restored after Main memory has to be restored after

a system crasha system crash If the main memory fails , entire If the main memory fails , entire

system system

Has to be restoredHas to be restored In case of a crash , the database must In case of a crash , the database must

be stored with data along with the logbe stored with data along with the log

Page 23: Real-time Databases Presented by Parimala kyathsandra CSE 666 fall 2006 Instructor Prof. Subra ganesan

Databases for Hard Real Databases for Hard Real Time SystemsTime Systems

MDARTS - is an example of a hard MDARTS - is an example of a hard real time database system , it stands real time database system , it stands for multiprocessor database for multiprocessor database architecture for real time systemsarchitecture for real time systems

Used mainly in control applications, Used mainly in control applications, such as controlling machine tools such as controlling machine tools and robots etcand robots etc

Page 24: Real-time Databases Presented by Parimala kyathsandra CSE 666 fall 2006 Instructor Prof. Subra ganesan

ReferencesReferences

Real-time systems - C.M krishna and G Real-time systems - C.M krishna and G shinshin

Real-time systems design and analysisReal-time systems design and analysis

-Phillip A. Laplante-Phillip A. Laplante Real-time.OrgReal-time.Org

Page 25: Real-time Databases Presented by Parimala kyathsandra CSE 666 fall 2006 Instructor Prof. Subra ganesan

Thank You !Thank You !