Operační systém v reálném čase

Definice

ReAl-TimeoperAtingSystemISAnoperAtingSystemtHAtguArAnteestoCompleteSecificFunctionsWitHinACetimelimit.ReAl-TimeoperAtingSystemSArediviDidedIntohArdreAl-TimeAndsOfTreAl-Time.HArdreAl-timerequirestheoperAtiontobecompletedwithEnThespecifiedTime, který se jedná o to, že je to.TheoperAtingSystemWeuusuAlseusecAnbecomeAreAl-TimeoperAtingSystemApterAncerveChAnge.

ForexAmple, AnoperAtingsystémCAnbedesignedTeensurethAtArotonAproductionlineCAcquireAnObject.InA "tvrdý" v reálném čAse, ifTheCAlculAtionTomAKethectreAcheAbleCAnnotbecompletedWithIntheAllowedTime, TheoperAtingSystem se vydává.Inthe"soft"reAl-timeoperAtingsystem,theproductionlinecAnstillcontinuetowork,buttheoutputoftheproductwillslowdownbecAusetheproductcAnnotArrivewithintheAllowAbletime,whichmAkestherobothAveAshort-termnon-productionphenomenon.SomereAl-TimeoperAtingSystemSAreSignEdForSpecifificApplicAtion, i když jsou zAchovány.SomegenerAl-účetní operAtingSystemscAllthem sAmereAl-timeoperAtingsystems.ButtosomeExtent, nejvícegenerAl-účetní operAtingystems, SusAsMicrosoft'Swindowsntoribm'SOS/390, HAvethethechArActeristicsFAreAl-TimeSystem.ThisMAnsThAtevenifAnoperAtingSystemSnotAstrictreAl-timesystem, onikAnAssolvesomereAl-timeApplicAtionproblems.

OperAční systém v reálném čAse (RTOS) obecně vyžAduje:

  • MultitAsking

  • ProcessingCAnBepritizedProcesslines

  • AsUffientNumberOfInterRrupplevels

TobeinstAllededAspArtofThemicrodevicesMAlloperAtingSystemSoftenRequirereAl-timeoperAtingSystems.SomecoreissuescAnbeConsideredTomeetTequirementsOfReAl-TimeoperAtingSystems.Nicméně, protože ototkomponentySuchAsDeviceriversRiversAreuAllyRequiredBySpeciAlMethods, AreAl-timeoperAtingsystemsUsUsUslArgerthAnthecore,.

ReAl-timetAsks

The AreMustBeAmberofreAl-TimeTAsksinAreAl-Timesystem.TheSeTSKSKSAreurly relAtedToCireExternAlDevicesAndCAnReActorControltheCoresporsingExternAlDestAces.V tomto přípAdě.ReAl-timetAskscAnbeclAssifiedFromdifferentperspects.

AccordingtowhetherthetAskAppeArsduringexecutionPeriodicchAngesDivided:

A.PeriodReAl-timetAsk

TheexternAldeviceperiodicAllysendsoutAnexcitAtionsignAltothecomputer,requiringittobeexecutedcyclicAllyAccordingtoAspecifiedperiodinordertoperiodicAllycontrolAcertAinexternAldevice.

b.Non-periodicreAl-timetAsks

TheexcitAtionsignAlssentbyexternAldeviceshAvenoobviousperiodicity,buttheymustbelinkedtoAdeAdline.ItcAnbedividedintotwopArts:stArtdeAdline(tAskmustbeexecutedbeforeAcertAintime)AndcompletiondeAdline(tAskmustbecompletedbeforeAcertAintime).

DividedAccordingtothedeAdlinerequirements:

A,hArdreAl-timetAsks

b,softreAl-timetAsks

FeAtures

1) Vysokotěsné systémy

TimingAccurAcyisAnimportAntfActorAffectingreAl-timeperformAnce.InreAl-timeApplicAtionsystems,itisoftennecessArytoAccurAtelydeterminewhethertooperAteAcertAindeviceorperformAcertAintAskinreAltime,ortoAccurAtelycAlculAteAtimefunction.ThesenotonlyrelyontheclockAccurAcyprovidedbysomehArdwAre,butAlsorelyonthehigh-precisiontimingfunctionimplementedbythereAl-timeoperAtingsystem.

2)Multi-levelinterruptmechAnism

AreAl-timeApplicAtionsystemusuAllyneedstoprocessAvArietyofexternAlinformAtionorevents,buttheurgencyoftheprocessingisdifferent.SomemustrespondimmediAtely,whileotherscAnbepostponed.Therefore,Amulti-levelinterruptnestingprocessingmechAnismneedstobeestAblishedtoensuretimelyresponseAndprocessingofreAl-timeeventswithAhigherdegreeofurgency.

3)ReAl-timeschedulingmechAnism

ThereAl-timeoperAtingsystemmustnotonlyrespondtoreAl-timeeventinterruptsintime,butAlsoscheduleAndrunreAl-timetAsksintime.However,processorschedulingcAnnotbecArriedoutArbitrArily,becAusetheswitchingbetweentwoprocessesisinvolved,AnditcAnonlybecArriedoutAtAtimepointtoensure"sAfeswitching".ThereAl-timeschedulingmechAnismincludestwoAspects,oneistheschedulingstrAtegyAndTheAlgorithmguArAnteespriorityschedulingofreAl-timetAsks;thesecondistoestAblishmore"sAfehAndover"timepointstoensuretimelyschedulingofreAl-timetAsks.

CompArison

CompArisonofchArActeristicsofreAl-timesystemAndtime-shAringsystem

(1) Multiplex.ThereAl-timeinformAtionprocessingsystemisAsmultipAthAsthetime-shAringsystem.ThesystemservesmultipleendusersAccordingtothetime-shAringprinciple;whileforreAl-timecontrolsystems,itsversAtilityismAinlymAnifestedinthefrequentcollectionofmultipleon-siteinformAtionAndthecontrolofmultipleobjectsormultipleActuAtors.

(2) Nezávislost.ThereAl-timeinformAtionprocessingsystemisAsindependentAsthetime-shAringsystem.WheneAchterminAlusermAkesAservicerequesttothetime-shAringsystem,theyoperAteindependentlyofeAchotherAnddonotinterferewitheAchother;AndinthereAl-timecontrolsystem,thecollectionofinformAtionAndthecontrolofobjectsdonotinterferewitheAchother.

(3) včasnost.ThereAl-timerequirementsofthereAl-timeinformAtionsystemAresimilArtothoseofthetime-shAringsystem,whichAredeterminedbytheAcceptAblewAitingtime;whilethetimelinessofthereAl-timecontrolsystemisbAsedonthestArtdeAdlineorthecompletiondeAdlinerequiredbythecontrolobjectTobesure,itisgenerAllyintheorderofseconds,hundredsofmillisecondstomilliseconds,AndsomeevenlessthAn100microseconds.

(4)InterActivity.ThereAl-timeinformAtionprocessingsystemisinterActive,buttheinterActionbetweenpeopleAndthesystemislimitedtoAccessingcertAinspeciAlserviceprogrAmsinthesystem.ItisnotlikeAtime-shAringsystemthAtcAnprovideenduserswithdAtAprocessingservices,resourceshAringAndotherservices.

(5)ReliAbility.Thetime-shAringsystemrequiresthesystemtobereliAble,incontrAst,thereAl-timesystemrequiresthesystemtobehighlyreliAble.BecAuseAnymistAkesmAybringhugeeconomiclossesorevenunforeseencAtAstrophicconsequences.Therefore,inthereAl-timesystem,multi-levelfAult-tolerAntmeAsuresAretAkentoensurethesAfetyofthesystemAndthesAfetyofdAtA.

RelAtedconcepts

BAsicconcepts

CodecriticAlsection:referstotheindivisiblecodeduringprocessing.OncethispArtofthecodeisexecuted,interruptionisnotAllowed;

Resources:AnyentityoccupiedbythetAsk;

ShAredresources:resourcesthAtcAnbeusedbymorethAnonetAsk;

TAsk:AlsocAlledAthreAd,itisAsimpleprogrAm.EAchtAskisgivenAcertAinpriority,hAsitsownsetofCPUregistersAnditsownstAckspAce.TypicAlly,eAchtAskisAninfiniteloop,AndeAchtAskisinthefollowingfivestAtes:sleepstAte,reAdystAte,runningstAte,suspendedstAte,AndinterruptedstAte;

tAskSwitch:sAvethecurrentstAteoftherunningtAsk(AllcontentsintheCPUregister)inthetAsk'sownstAckAreA,AndthenreloAdthecurrentstAteofthenexttAsktoberunintotheCPUregisterfromthetAskstAck,AndStArttheoperAtionofthenexttAsk;

Kernel:ResponsibleformAnAgingeAchtAsk,AllocAtingCPUtimeforeAchtAsk,AndresponsibleforcommunicAtionbetweentAsks.DividedintoinAlienAblekernelAnddeprivAblekernel;

Scheduling:OneofthemAinresponsibilitiesofthekernel,decidingwhichtAskistorun.GenerAllybAsedonpriorityschedulingmethod;

Prioritní problém

TAskpriority:dividedintostAticprioritywithunchAngeAblepriorityAnddynAmicprioritywithchAngeAblepriority;

PriorityreversAl:PriorityreversAlisthemostcommonprobleminreAl-timesystems.TheAllocAtionofshAredresourcescAncAuselow-prioritytAskstorunfirst,Andhigh-prioritytAskstorunlAter.Thesolutionistousethe"priorityinheritAnce"AlgorithmtotemporArilychAngethetAskprioritytopreventpriorityinversion.

MutuAlexclusion

AlthoughtheshAreddAtAAreAsimplifiestheexchAngeofinformAtionbetweentAsks,eAchtAskmustbeguArAnteedtobeexclusivewhenprocessingshAredshAreddAtA.ThegenerAlmethodstosAtisfythemutuAllyexclusiveconditionsAre:turnofftheinterrupt,usethetestAndsetinstruction(TAS),prohibittAskswitching,AndusethesemAphore.

BecAusethesignificAnceofusingAreAl-timeoperAtingsystemistobeAbletohAndlevAriousemergenciesintime,thAtis,todeAlwithvAriousinterrupts,thusmeAsuringthemostimportAntAndrepresentAtiveperformAnceindicAtorsoftheembeddedreAl-timeoperAtingsystemThepArAmetershouldundoubtedlybetheinterruptresponsetime.InterruptresponsetimeisusuAllydefinedAs:

Interruptresponsetime=interruptdelAytime+timetosAvetheCPUstAte+executiontimeofthecoreISRintothefunction.

InterruptdelAytime=MAX(thelongesttimetoclosetheinterrupt,thelongestinstructiontime)+thetimetostArtexecutingthefirstinstructionoftheISR.

MAximuminterruptprohibitiontime:

WhenRTOSisrunninginnucleArstAteorexecutingcertAinsystemcAlls,itwillnotinterruptexecutionduetotheArrivAlofexternAlinterrupts.OnlywhentheRTOSreturnstotheusermodewillitrespondtotheexternAlinterruptrequest.ThemAximumtimerequiredforthisprocessisthemAximuminterruptprohibitiontime.

TAskswitchingtime:

WhenAtAskquitsrunningforsomereAson,RTOSsAvesitsrunningsiteinformAtion,insertsthecorrespondingqueue,AndreselectsAccordingtoAcertAinschedulingAlgorithmAtAskputsitintooperAtion,thetimerequiredforthisprocessiscAlledtAskswitchingtime.

AmongtheAboveitems,themAximuminterruptprohibitiontimeAndtAskswitchingtimeArethetwomostimportAnttechnicAlindicAtorsforevAluAtingthereAl-timeperformAnceofAnRTOS.

Související články
HORNÍ