Přehled
Thegeneraloperatingsystemisanoperatingsystemwithmanytypesofoperatingcharacteristics.Itcanhavemultiplebatchprocessing,time-sharing,real-timeprocessingfunctionsatthesametime,ortwoormoreofthem.
Například:zpracování v reálném čase+dávkové zpracování=systém dávkového zpracování v reálném čase. Nejprve se ujistěte, že úlohy v reálném čase jsou zpracovány jako první a že se provádí dávkové zpracování. Úlohy v reálném čase se často nazývají popředí a dávkové úlohy se nazývají úlohy na pozadí.
Jiný příklad:zpracování se sdílením času+dávkové zpracování=systém dávkového zpracování se sdílením času.To znamená:úlohy s nízkými časovými požadavky jsou zadávány do „pozadí“ (dávkové zpracování), úlohy, které vyžadují časté interakce, se zpracovávají v „popředí“ (sdílení v čase) a procesor“ běží „v popředí“.
Fromthemid-1960s,theinternationalcommunitybegantodevelopsomelarge-scalegeneral-purposeoperatingsystems.Thesesystemstrytoachievethegoalofbeingfullyfunctional,adaptabletovariousapplicationrangesandchangingoperatingmodes.However,thesesystemsaretoocomplexandlarge,notonlypayingahugeprice,butalsoencounteringgreatdifficultiesinsolvingtheirreliability,maintainabilityandunderstandability.
Incontrast,theUNIXoperatingsystemisanexception.Thisisauniversalmulti-usertime-sharinginteractiveoperatingsystem.Itfirstbuildsaleancore,butitsfunctionsarecomparabletomanylargeoperatingsystems.Outsidethecorelayer,itcansupporthugesoftwaresystems.Ithasbeenquicklyappliedandpromoted,andhasbeencontinuouslyimproved,whichhasasignificantimpactonmodernoperatingsystems.
Vady
Přerušuje
Forcurrentlyrunningtasks,interruptsareItshowsgreatrandomnesstotheextent,soitisimpossibletopredictwhentheinterruptionwilloccur.InGPOS,thepriorityoftheinterruptishigherthanthepriorityofthetaskexecution,sotheexecutiontimeoftheinterruptedtaskbecomesuncertainduetotheuncertaintyoftheinterruptoccurrence.Thisuncertaintymaybefatalforreal-timesystemswithtimeconstraints.
Multitasking a plánování úloh
GPOSgenerallyadoptsround-robinpriorityschedulingalgorithm,anditscoreisasetofpriorityadjustablequeues.Eachqueuemaintainsasetoftaskswiththesamepriority.Theschedulingalgorithmallocatesatimesliceforeachtaskinthehighestpriorityqueue,andthetaskstime-divisionandreusetheCPUaccordingtothetimeslice.Theschedulingalgorithmwillgraduallyadjustthepriorityofeachqueue,sothatthetasksinthelow-priorityqueuecaneventuallybeexecuted.Inthiskindofschedulingalgorithm,sinceitisimpossibletoaccuratelypredicthowlongataskneedstowaittobeexecutedandhowlongitcanbeexecuted,thiskindofschedulingalgorithmcannotsatisfytheschedulingofreal-timetasks.
Virtuální úložiště
AlmostallGPOSusespage-basedvirtualstoragetechnology.Inthevirtualmemorymechanism,whenapagefails,itmustbeaccompaniedbyapagechangeoperation,whichhasanegativeimpactonthereal-timeperformanceofthetask.Ontheonehand,ifthecurrenttaskhasapagefailure,thetaskisinterruptedandthesystemperformsapagechangeoperation;ontheotherhand,ifmultipletasksshareaphysicalpage,therewillbepagethrashing.Theprocessofpagefailureisverycomplicated,involvingmanyfactors,suchasfailureinterruption,diskoperation,systemstoragecapacity,etc.Inpage-basedGPOS,frequentpagefailurescanmakeitimpossibletoaccuratelypredicttheexecutiontimeofatask.
DMA
DMAtechnologygreatlyimprovestheoverallthroughputofthesystem,effectivelyreducestheprocessor’sinterventionintheoperationofI/Odevices,andimprovestheprocessorUtilizationrate.ButbecauseDMAmustvisitthemainmemory,soduringDMAtransfer,I/OdeviceandCPUaretime-sharingcontentionformainmemory.WhentheDMAtransferoccupiesthestoragebus,theprocessorcannotreadorwritethemainmemory.Althoughinmanysystems,theprocessorreadsandwritesthememorythroughtheCacheinsteadofdirectlyreadingandwritingthemainmemory,butwhentheCachefailsandthesystemisundergoingDMAtransfer,theCachestillcannotreadandwritethemainmemoryimmediately.TheDMAtransmissionmethodaddsuncertainfactorstoaccuratelypredictthetimefortheCPUtocompleteatask.
Metoda prodloužení v reálném čase
(1) Integrované plánování
Integratedschedulingisaconceptthatreferstothesimultaneoususeofreal-timeschedulingalgorithmsandnon-standardschedulingalgorithmsinthesameoperatingsystem.Real-timeschedulingalgorithmsareusedtoschedulereal-timetasksandnon-real-timetasksrespectively.Intheintegratedschedulingscheme,sincereal-timetasksareassigneddeadlines,real-timetasksandnon-real-timetasksarefairlyscheduledbythescheduler,andthesystemdoesnotgivereal-timetasksahigherpriority.Theschedulerfirstallocatesprocessortimeslicestoreal-timetasks,andtheallocationalgorithmiscarriedoutaccordingtotheendofthedeadline.Accordingtotherequirementsofreal-timetasksforprocessortimeslicesandtheworkloadofnon-real-timetasks,theschedulingalgorithmmaintainsafairallocationschemebetweenreal-timetasksandnon-real-timetasks.Fornon-real-timetasks,theschedulerusesaround-robinschedulingalgorithmforscheduling.Althoughintegratedschedulingcanfairlyallocateprocessortimeslicestoreal-timetasksandnon-real-timetasks,experimentaldatashowsthatthecompletiontimeofreal-timetasksfluctuatesgreatlydependingonthesystemload.Whenthefluctuationistoolarge,theperformancepredictionoftheentiresystemisinaccurate,andtheresultisthattheutilizationrateoftheprocessorisgreatlyreducedorotherreal-timetaskscannotbeexecuted.
(2)Rezervace zdroje procesoru
ProcessorResourceReservation(PCR)isanabstractmechanism.PCRallowsuserstocontroltheallocationofprocessorcycles,trackreservedresourcesandmeasureprocessorresourcesusedbytasks,andsolvetheschedulingproblemsofreal-timetasksandnon-real-timetasks.InPCR,thereal-timetaskmodelisaperiodicmodel.InthePCRsolution,almostallfunctionalcomponentsoftheoperatingsystemneedtobemodifiedorredesigned.
(3) Real-time Mach
Thereal-timeMachprojecthopestodevelopareal-timeversionoftheMachkernel.Inreal-timeMach,allsub-partsoftheoriginalMachkernelhavebeenredesigned.Real-timeMachaddsreal-timethreadmanagement,integratedtime-drivenscheduler,real-timesynchronizationandmemory-residentobjectsonthebasisoftheoriginalkernel.Inreal-timeMach,theprocesscancreatebothreal-timeandnon-real-timethreads.Whencreatingareal-timethread,theuserneedstoprovidesomeparametersaboutthreadtimecharacteristics,suchasperiod,maximumoverhead,deadline,andwhetherthedeadlineisharddeadlineorsoftdeadline.Real-timeMachimplementsareal-timesynchronizationmechanismthroughpriorityinheritancetosolvethepriorityinversionprobleminGPOS.Throughthereal-timesynchronizationmechanism,whenahigh-prioritytaskissuspendedbecauseasharedresourceislockedbyalow-prioritytask,itssuspensionwaitingtimehasanupperlimit.