Overview
Thegeneraloperatingsystemisanoperatingsystemwithmanytypesofoperatingcharacteristics.Itcanhavemultiplebatchprocessing,time-sharing,real-timeprocessingfunctionsatthesametime,ortwoormoreofthem.
Forexample:real-timeprocessing+batchprocessing=real-timebatchprocessingsystem.Firstofall,ensurethatreal-timetasksareprocessedfirst,andbatchprocessingisperformed.Real-timetasksareoftencalledforegroundjobs,andbatchjobsarecalledbackgroundjobs.
Anotherexample:time-sharingprocessing+batchprocessing=time-sharingbatchprocessingsystem.Thatis:jobswithlowtimerequirementsareputintothe"background"(batchprocessing)forprocessing,jobsthatrequirefrequentinteractionareprocessedinthe"foreground"(time-sharing),andtheprocessorruns"foreground"jobsfirst.
Fromthemid-1960s,theinternationalcommunitybegantodevelopsomelarge-scalegeneral-purposeoperatingsystems.Thesesystemstrytoachievethegoalofbeingfullyfunctional,adaptabletovariousapplicationrangesandchangingoperatingmodes.However,thesesystemsaretoocomplexandlarge,notonlypayingahugeprice,butalsoencounteringgreatdifficultiesinsolvingtheirreliability,maintainabilityandunderstandability.
Incontrast,theUNIXoperatingsystemisanexception.Thisisauniversalmulti-usertime-sharinginteractiveoperatingsystem.Itfirstbuildsaleancore,butitsfunctionsarecomparabletomanylargeoperatingsystems.Outsidethecorelayer,itcansupporthugesoftwaresystems.Ithasbeenquicklyappliedandpromoted,andhasbeencontinuouslyimproved,whichhasasignificantimpactonmodernoperatingsystems.
Defects
Interrupts
Forcurrentlyrunningtasks,interruptsareItshowsgreatrandomnesstotheextent,soitisimpossibletopredictwhentheinterruptionwilloccur.InGPOS,thepriorityoftheinterruptishigherthanthepriorityofthetaskexecution,sotheexecutiontimeoftheinterruptedtaskbecomesuncertainduetotheuncertaintyoftheinterruptoccurrence.Thisuncertaintymaybefatalforreal-timesystemswithtimeconstraints.
Multitaskingandtaskscheduling
GPOSgenerallyadoptsround-robinpriorityschedulingalgorithm,anditscoreisasetofpriorityadjustablequeues.Eachqueuemaintainsasetoftaskswiththesamepriority.Theschedulingalgorithmallocatesatimesliceforeachtaskinthehighestpriorityqueue,andthetaskstime-divisionandreusetheCPUaccordingtothetimeslice.Theschedulingalgorithmwillgraduallyadjustthepriorityofeachqueue,sothatthetasksinthelow-priorityqueuecaneventuallybeexecuted.Inthiskindofschedulingalgorithm,sinceitisimpossibletoaccuratelypredicthowlongataskneedstowaittobeexecutedandhowlongitcanbeexecuted,thiskindofschedulingalgorithmcannotsatisfytheschedulingofreal-timetasks.
Virtualstorage
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.
Real-timeextensionmethod
(1)Integratedscheduling
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
ProcessorResourceReservation(PCR)isanabstractmechanism.PCRallowsuserstocontroltheallocationofprocessorcycles,trackreservedresourcesandmeasureprocessorresourcesusedbytasks,andsolvetheschedulingproblemsofreal-timetasksandnon-real-timetasks.InPCR,thereal-timetaskmodelisaperiodicmodel.InthePCRsolution,almostallfunctionalcomponentsoftheoperatingsystemneedtobemodifiedorredesigned.
(3)Real-timeMach
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.