Real-timeDatabasesforEmbeddedSystemsIntroductionReal-timesystemsarenowusedinmanyapplicationdomains,includingnetworkinfrastructure,telecommunicationsandfinancialmarkets.Asreal-timesystemscontinuetoevolve,theirapplicationsbecomemorecomplex,andoftenrequiretimelyaccessto,andprocessingof,massiveamountsofdata.Atthestartofareal-timesystemdevelopmentproject,itisoftenassumedthatafastenoughdataprocessingengine,createdspecificallyforthesystemandtightlyintegratedwithitscode,willmeetreal-timerequirements.However,oftentheapplication’sinputdatamustbecorrelated,merged,orcomparedacrossalldataobjectsandacrosstime,forfilteringoranalysis.Inaddition,thedatamustbesharedbyconcurrenttasksthathavedifferentfunctions,timerequirementsanddegreesofimportance.Theseissuesarebetteraddressedbyaprovendatabasemanagementsystem(DBMS).Asaresult,real-timesystemsincreasinglyfeatureacommercial,off-theshelfDBMSasapartofthearchitecture,tosimplifydesign,streamlinedevelopmentandimproveperformance.Real-timevs.TraditionalDatabasesLiketraditionaldatabasesystems,real-timedatabasesystems(RTDBSs)serveasrepositoriesfordataandrovideefficientstorage,retrievalandmanipulationofdata.Themaindifferencesbetweenconventionalandreal-timedatabaseslieintemporalrequirementsofthemanageddata,timingconstraintsontransactions,andperformancegoals.Temporalconsistencyofdatarequirestheactualstateoftheexternalworldandthestaterepresentedinthedatabasetobecloseenoughtoremainwithinthelimitsoftheapplication.Themostcommonperformancemetricofalldatabases—whetherreal-timeornot—istransactionresponsetime.Fortraditionaldatabasesystemsthischaracteristicboilsdowntothenumberoftransactionspertimeunit;thismeasurementisusedheavilyinoptimizingaverageresponsetimefor“traditional”(not-real-time)applications.ForRTDBS,ontheotherhand,thetypicalmetricisthenumberoftransactionsthatviolatetimingconstraints(misstheirdeadline).Butevenwithinreal-time2systems,tolerancefortimingconstraintviolationsvaries.Thecostofmissedtransactiondeadlinesrangesfromadiminishingvaluereturn,tozerovalueformissedtransactions,tonegativevaluetoincreasinglynegativevalue.Thisdecreasingvalueoftencorrelatestodata’ssusceptibilitytoaging.Forexample,thevalueofthelastknownlocationofobjects(e.g.aircraftonaradarscreen)diminisheswithtime,andaftersomesmalltimeintervalbecomesirrelevantoruseless.Oneofthemostimportantdifferencesbetweenthedatabasesusedbyreal-timeandnon-real-timesystemsisthatwhiletheconventionalDBMSaimstoachievegoodthroughputoraverageresponsetime,thereal-timeDBMSmustprovideapredictableresponsetimetoguaranteethecompletionoftime-criticaltransactions.Therefore,thedesignofareal-timedatabasesubsystemshouldavoidusingcomponentsthatintroduceunpredictablelatencies,suchasdiskI/Ooperations,messagepassingorgarbagecollection.Thusreal-timedatabasestendtobedesignedasin-memorydatabasesystems.In-memorydatabasesforegodiskI/Oentirely,andtheirsimplifieddesign(comparedtoconventionaldatabases)minimizesmessagepassing.Thevalidityofthereal-timedatainthedatabasemayalsobecompromisedifitcannotbeupdatedfastenoughtoreflectreal-worldevents.Toavoidthis,thebestsolutionhasbeenafullytime-cognizanttransactionmanager.Attheveryleast,thedatabasedesignshouldprovidesomemeansoftransactionprioritization.HardReal-timevs.SoftReal-timeManyreal-timesystems,suchasnuclearpowerplantsandfly-by-wirevehicles,cannottolerateanymisseddeadlinesforcriticaltransactions.Thesearecommonlycalledhardreal-timesystems.Theresponsetimerequirementsofhardreal-timetransactionsaresuchthatafailuretoexecutebythedeadlinecouldresultincatastrophicconsequences.Butthemajorityofreal-timesystemsandtheirdatabasesfallintothesoftreal-timecategory,whereviolationoftimingconstraintsresultsindegradedquality,butistosomedegreetolerable.ManyfactorsmakeithardtobuildRTDBSs—andlimittheapplicabilityofcommercial,off-the-shelfRTDBSalmostexclusivelytothesoftreal-time3domain.Duetothecriticalnatureofcertainapplicationdomains(spacecraftcontrolsystems,forinstance),wholesystemdesigns,includingRTDBSs,arecustommadewithsparecapacity.Inahardreal-timesystem,designersoftenusecustomalgorithmsandscheduleexcessiveamountsoftimeforatransaction,especiallyacriticalone,justtocoveraworst-casescenario.Thesekindsofsystemsareoftentime-drivenandtime-slicescheduled(incontrasttosoftreal-timesystems,whichareoftenevent-drivenandpriorityscheduled).Virtuallyallcommercialdatabaseconcurrencycontrolapproacheshavebeendesignedtooptimizeaverage-caseperformanceratherthanworst-caselatency.Adaptingthesetechniquesforhard-realtimeisusuallyimpossible.However,inthesoftreal-timedatabasearena,thepastseveralyearshaveseenunprecedentedcommercialavailability,andsubstantialinnovation.Complexsoftreal-timesystemsneeddatabasestosupportconcurrentdataaccessandprovidewell-definedinterfacesbetweensoftwaremodules,whilesupportinglevelsofperformanceandpredictabilitylackingintraditionaldatabases.InthisarticleweconcentrateonsoftRTDBSthatarebasedonoff-theshelfhardwareandotherelements.Wewillanalyzesomecommonreal-timesystemsattributesandusagescenarios,andexaminehowthemoderncommerciallyavailableRTDB