Outline Real-Time Databases Thomas Gustafsson Real-Time Database

advertisement
Outline
Real-Time Databases
•
•
•
•
Real-Time Database
Enforcing Temporal Consistency
Updating of data
Similarity
Thomas Gustafsson
Real-Time Systems Laboratory
Department of Computer and Information Science
Linköpings universitet
Sweden
Real-Time Databases
Thomas Gustafsson
24 pages
2004-11-22
Real-Time Databases
Thomas Gustafsson
Real-Time Database
•
•
•
•
Timely monitoring of sensors
– Real-time data items
– Continuous or discrete data items
Derived data items are derived from real-time data items and
must be refreshed on changes
Timely processing of transactions
A traditional database does not have support for these
requirements
2 of 24
2004-11-22
Overview of Engine Control Software
•
•
•
•
Software for Electronic Control Unit
Divided into applications
Data stored in global or application-wide data areas
Data freshness ensured by periodic task invocations
Air flow sensor
Engine temperature sensor
ECU
Application
Global data
Air
Fuel
...
Application data
Sensor data
Task
Real-Time Databases
Thomas Gustafsson
3 of 24
2004-11-22
Real-Time Databases
Thomas Gustafsson
4 of 24
2004-11-22
Database and Engine Control Software
Air flow sensor
Engine temperature sensor
ECU
Application
Updates
Fuel
Air
...
Temporal Consistency
•
Temporal consistency: maintain coherency between
environment and stored data
•
Traditional databases only maintain logical consistency
– Atomicity
– Consistency
– Isolation
– Durability
Transaction
reading and/or
writing data
Database interface
Level 1
Trans
Level 2
CC
EDF
Data
Meta-inf
Rubus
Real-Time Databases
Thomas Gustafsson
5 of 24
2004-11-22
Real-Time Databases
Thomas Gustafsson
Temporal Consistency, cont’d
•
Temporal Consistency, cont’d
•
Data items need to be valid at the same time
value
value
•
Values of real-time data items get invalid by the passage of
time
An absolute validity interval is assigned to real-time data
items
6 of 24
2004-11-22
RVI
Value stored
in DB
AVI
Value stored
in DB
t
Real-Time Databases
Thomas Gustafsson
t
7 of 24
2004-11-22
Real-Time Databases
Thomas Gustafsson
8 of 24
2004-11-22
Updating
•
•
•
•
Traditional database systems do not know about AVI and
RVI
Refresh data items before they are used
Triggering of transactions to refresh data items
– Triggering criterion
On-demand updating can be either
– Consistency-centric, or
– Throughput-centric
Updating, cont’d
•
Triggering criterion: check if data item accessed by read
operation is absolutely valid
R:D1
W:D3
time-ts(d1)<avi(d1)
time-ts(d2)<avi(d2)
R:B1
Real-Time Databases
Thomas Gustafsson
R:D2
9 of 24
2004-11-22
W:D1
Real-Time Databases
Thomas Gustafsson
10 of 24
2004-11-22
Updating, cont’d
Add a check if an update can be executed still meeting
deadlines
R:D1
R:D2
•
•
•
W:D3
time-ts(d1)<avi(d1) and wcet(Td1)<slack(Td3)
time-ts(d2)<avi(d2) and
wcet(Td2)<slack(Td3)
R:B1
AVIs are pessimistic about value changes
A read value can be valid a longer time than the AVI
If updates are made periodically, some are unnecessarily
done
value
•
Similarity
AVI
W:D1
t
Real-Time Databases
Thomas Gustafsson
11 of 24
2004-11-22
Real-Time Databases
Thomas Gustafsson
12 of 24
2004-11-22
Similarity, cont’d
•
•
Similarity is a relation on values of a data item
Similarity states if two values are considered equal
– 75 and 77 degrees on the water temperature might be
considered as equal
•
•
Goal by using similarity: executing fewer updates
Effects of using similarity: CPU resource can be used for
other calculations, e.g., extensive diagnosis
Updating algorithms with similarity
•
•
•
Objective: make data items up-to-date before they are used
Prerequisite: graph G, flags, and values on data items
Need: a way to determine which data items to update
b1
b2
d1
b3
d3
b4
Level 1
d2
d4
Level 2
Level 3
d5
Level 4
d6
Real-Time Databases
Thomas Gustafsson
Real-Time Databases
Thomas Gustafsson
13 of 24
2004-11-22
Updating algorithms w. similarity, cont’d
•
•
Keep base items up-to-date
The software makes periodic requests of user transactions
Scheduling Algorithm: ODDFT
•
•
•
•
b1
d1
d3
Update if
needed
Execute updates when needed
Potentially affected data items need to be updated
Precedence constraints
On-Demand Depth First Traversal
Limited time available.
b1
b2
b4
b3
Prioritize
d5
d1
b2
Periodically
update to
keep fresh
14 of 24
2004-11-22
•
•
•
Periodic requests
Update if needed
•
A request for d5 arrives
b1 and b3 change
Traverse bottom-up in
depth first order
d4 higher priority
d3
d1
Arrival
time
Real-Time Databases
Thomas Gustafsson
15 of 24
2004-11-22
Real-Time Databases
Thomas Gustafsson
d2
d4
d3
d5
Potentially changed and value
d2
d4
changed too much at deadline
d5
Deadline
16 of 24
2004-11-22
Relevance Check
•
Transient and steady states
Perform a check if an update is relevant before it is started
d3
d1
d3
d2
d4
d5
d1:10
d3:30
b3:20 b2:64 d3:30
d2:64 d4:100 d4:100
d5:50
Skip!
Skip!
b3
d2
d4
Real-Time Databases
Thomas Gustafsson
17 of 24
2004-11-22
Real-Time Databases
Thomas Gustafsson
18 of 24
2004-11-22
Download