Преглед
Thegeneraloperatingsystemisanoperatingsystemwithmanytypesofoperatingcharacteristics.Itcanhavemultiplebatchprocessing,time-sharing,real-timeprocessingfunctionsatthesametime,ortwoormoreofthem.
Например:обработка в реално време+пакетна обработка=система за партидна обработка в реално време.Firstofall гарантира, че първо се обработват задачи в реално време и пакетната обработка се изпълнява.
Друг пример:обработка със споделяне на време+пакетна обработка=система за партидна обработка с споделяне на време. Тоест: задачи с ниски изисквания за време се поставят на "заден план" (пакетна обработка) за обработка, задачи, които изискват често взаимодействие, се обработват на "преден план" (споделяне на време) и процесорът първо изпълнява задачи на "преден план".
Fromthemid-1960s,theinternationalcommunitybegantodevelopsomelarge-scalegeneral-purposeoperatingsystems.Thesesystemstrytoachievethegoalofbeingfullyfunctional,adaptabletovariousapplicationrangesandchangingoperatingmodes.However,thesesystemsaretoocomplexandlarge,notonlypayingahugeprice,butalsoencounteringgreatdifficultiesinsolvingtheirreliability,maintainabilityandunderstandability.
Incontrast,theUNIXoperatingsystemisanexception.Thisisauniversalmulti-usertime-sharinginteractiveoperatingsystem.Itfirstbuildsaleancore,butitsfunctionsarecomparabletomanylargeoperatingsystems.Outsidethecorelayer,itcansupporthugesoftwaresystems.Ithasbeenquicklyappliedandpromoted,andhasbeencontinuouslyimproved,whichhasasignificantimpactonmodernoperatingsystems.
Дефекти
Прекъсва
Forcurrentlyrunningtasks,interruptsareItshowsgreatrandomnesstotheextent,soitisimpossibletopredictwhentheinterruptionwilloccur.InGPOS,thepriorityoftheinterruptishigherthanthepriorityofthetaskexecution,sotheexecutiontimeoftheinterruptedtaskbecomesuncertainduetotheuncertaintyoftheinterruptoccurrence.Thisuncertaintymaybefatalforreal-timesystemswithtimeconstraints.
Многозадачност и планиране на задачи
GPOSgenerallyadoptsround-robinpriorityschedulingalgorithm,anditscoreisasetofpriorityadjustablequeues.Eachqueuemaintainsasetoftaskswiththesamepriority.Theschedulingalgorithmallocatesatimesliceforeachtaskinthehighestpriorityqueue,andthetaskstime-divisionandreusetheCPUaccordingtothetimeslice.Theschedulingalgorithmwillgraduallyadjustthepriorityofeachqueue,sothatthetasksinthelow-priorityqueuecaneventuallybeexecuted.Inthiskindofschedulingalgorithm,sinceitisimpossibletoaccuratelypredicthowlongataskneedstowaittobeexecutedandhowlongitcanbeexecuted,thiskindofschedulingalgorithmcannotsatisfytheschedulingofreal-timetasks.
Виртуално хранилище
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.
Метод на разширение в реално време
(1) Интегрирано планиране
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)Резервация на процесорен ресурс
ProcessorResourceReservation(PCR)isanabstractmechanism.PCRallowsuserstocontroltheallocationofprocessorcycles,trackreservedresourcesandmeasureprocessorresourcesusedbytasks,andsolvetheschedulingproblemsofreal-timetasksandnon-real-timetasks.InPCR,thereal-timetaskmodelisaperiodicmodel.InthePCRsolution,almostallfunctionalcomponentsoftheoperatingsystemneedtobemodifiedorredesigned.
(3) Мах в реално време
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.