2023年全國碩士研究生考試考研英語一試題真題(含答案詳解+作文范文)_第1頁
已閱讀1頁,還剩5頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認(rèn)領(lǐng)

文檔簡介

1、進程:線程:調(diào)度隊列的種類:1.jobqueue–setofallprocessesinthesystem2.readyqueue–setofallprocessesresidinginmainmemyreadywaitingtoexecutegenerallystedasalinkedlist3.devicequeues–setofprocesseswaitingfaparticularIOdeviceeg.atapedriverad

2、isk進程狀態(tài):1.new:beingcreated2.running:instructionsarebeingexecuted3.waiting:waitingfsomeeventtooccur4.ready:waitingtobeassignedtoaprocess5.terminated:hasfinishedexecutionFCB的內(nèi)容:1.Processstate2.Programcounter3.CPUregisters4

3、.CPUschedulinginfmation5.Memymanagementinfmation6.Accountinginfmation7.IOstatusinfmation8.pagetablerelocationregisterlimitregister9.fileopentable調(diào)度器scheduler分類:longtermscheduler(jobscheduler)–swhichprocessesshouldbeloade

4、dfexecutionshttermscheduler(CPUscheduler)–swhichprocessshouldbeexecutednextallocatesCPU生產(chǎn)者消費者問題(指利用了n1個單元)shareddata#defineBUFFER_SIZE10typedefstruct...itemitembuffer[BUFFER_SIZE]intin=0intout=0itemnextProducedlocalvaria

5、blewhile(1)produceaniteminnextProducedwhile(((in1)%BUFFER_SIZE)==out)buffer[in]=nextProducedin=(in1)%BUFFER_SIZEitemnextConsumedlocalvariablewhile(1)while(in==out)bufferisemptynextConsumed=buffer[out]out=(out1)%BUFFER_SI

6、ZEconsumetheiteminnextConsumed用戶線程和內(nèi)核線程Userthreads:supptedabovethekernelimplementedbyathreadlibraryattheuserlevelthelibrarysupptthreadcreationschedulingmanagementwithnosupptfromthekernel(onasinglethreadkernel)anyuserleve

7、lthreadperfmsablockingsystemcallblocksthewholeprocessKernelthreads:suppteddirectlybytheoperatingsystem:thekernelperfmsthreadcreationschedulingmanagementinkernelspaceslowertocreatemanagethanuserthreadsindependentblockamon

8、gthreadsgoodsupptfmultiprocesssManytoone:manyuserlevelthreadsmappedtosinglekernelthreadthreadmanagementisdoneinuserspace,usedonsystemsthatdonotsupptkernelthreadsdrawbacks:badblockingbad,utilizationofmultiprocesssonetoone

9、:eachuserlevelthreadmapstoakernelthread:meconcurrencythanmanytoone,supptmultiprocesssdrawback:overheadofcreatingkernelthreadsexamples:Windows9598NT2000,OS2manytomany:multiplexesmanyuserlevelthreadstoasmallerequalnumberof

10、kernelthreadsallowstheprogrammertocreateasufficientnumberofuserthreadsavoidbadblockingsupptmultiprocesssExamples:Solaris2,WindowsNT2000withtheThreadFiberpackage線程的終止:threadcancellation?targetthread:thethreadtobecancelled

11、?asynchronouscancellation:onethreadimmediatelyterminatesthetargetthread,maybecancelledinthedleofupdatingdatasharedwithotherthreads,maynotfreeasystemwideresource?deferredcancellation:thetargetthreadcanperiodicallycheckifi

12、tshouldterminate(atsocalledcancellationpointsinPthread)同步信號和異步信號:synchronoussignalsanillegalmemyaccessadivisionbyzerodeliveredtothesameprocessthatcausethesignalasynchronoussignalsauserkeystroke(CtrlC)atimerexpirationtypi

13、callysenttoanotherprocess線程池:Whythethreadpools1.avoidcreationterminationoverheadsothatitisfastertoservicearequest2.putboundonnumberofthreadsthuslimitCPUmemyusageconsiderationsnumberofCPUsamountofphysicalmemyexpectednumbe

14、rofconcurrentrequests進程同步種類:1.blocking(synchronous)versusnonblocking(asynchronous)2.blockingsend:thesendingprocessisblockeduntilthemessageisreceivedbythereceivingprocessbythemailbox3.nonblockingsend:thesendingprocesssend

15、sthemessageresumesoperation4.blockingreceive:thereceiverblocksuntilamessageisavailable5.nonblockingreceive:thereceiverretrieveseitheravalidmessageanullresumesoperationCPU調(diào)度算法1.FCFS:等待時間不穩(wěn)定,響應(yīng)時間不穩(wěn)定。特點:easytoundersteasytoi

16、mplement(anFIFOqueue)largevarianceofwaitingresponsetime.convoyeffect.nonpreemptivebadftimesharingsystem2.SJF:分為preemptivetarget=truereturnrv進程共享變量booleanlock=false對于第i個進程dowhile(TestSet(lock))CriticalSectionlock=falseRem

17、ainderSectionwhile(1)分析:滿足了互斥,但不滿足有限等待條件。假設(shè)系統(tǒng)調(diào)度不幸使得某個號數(shù)的進程每次都如下述情況運行則這個號數(shù)的進程會一直霸占進入臨界區(qū)的機會,使得其他號數(shù)的進程無限等待。lock=falseRemainderSectionwhile(1)dowhile(TestSet(lock))CriticalSection死鎖檢測算法:1.LetWkFinishbevectsoflengthmnrespecti

18、vely.Initialize:(a)Wk=Available(b)Fi=12…nifAllocationi?0thenFinish[i]=falseotherwiseFinish[i]=true.2.Findanindexisuchthatboth:(a)Finish[i]==false(b)Requesti?WkIfnosuchiexistsgotostep4.3.Wk=WkAllocationiFinish[i]=truegoto

19、step2.4.IfFinish[i]==falsefsomei1?i?nthenthesystemisindeadlockstateMeoverifFinish[i]==falsethenPiisdeadlocked.ThealgithmrequiresanderofO(mxn2)operationstodetectwhetherthesystemisindeadlockedstate地址綁定:addressesintheprogra

20、maregenerallysymbolicacompilerbindthesesymbolicaddressestorelocatableaddressesalinkageedit(loader)bindtheserelocatableaddressestoabsoluteaddresses1.Compiletime:Ifmemylocationknownapriiabsolutecodecanbegeneratedmustrecomp

21、ilecodeifstartinglocationchanges.2.Loadtime:Mustgeneraterelocatablecodeifmemylocationisnotknownatcompiletime.3.Executiontime:Bindingdelayeduntilruntimeiftheprocesscanbemovedduringitsexecutionfromonememysegmenttoanother.N

22、eedhardwaresupptfaddressmaps(e.g.baselimitregisters).邏輯地址于物理地址:theconceptofalogicaladdressspacethatisboundtoaseparatephysicaladdressspaceiscentraltopropermemymanagement1.logicaladdress–generatedbytheCPUalsoreferredtoasvi

23、rtualaddress2.physicaladdress–addressseenbythememyunitlogicalphysicaladdressesarethesameincompiletimeloadtimeaddressbindingschemes.logical(virtual)physicaladdressesdifferinexecutiontimeaddressbindingscheme內(nèi)存管理單元,MMU:MMUi

24、sahardwaredevicethatmapsvirtualtophysicaladdressInMMUschemethevalueintherelocationregisterisaddedtoeveryaddressgeneratedbyauserprocessatthetimeitissenttomemy.Theuserprogramdealswithlogicaladdressesitneverseestherealphysi

25、caladdresses.動態(tài)連接:?linkingpostponeduntilexecutiontimesmallpieceofcodestubusedtolocatetheappropriatememyresidentlibraryroutinestubreplacesitselfwiththeaddressoftheroutineexecutestheroutine?dynamiclinkingisparticularlyusef

26、ulf(shared)libraries:WindowsDLLs?bettermemyusageeasierlibraryupdates?operatingsystemneedtocheckifroutineisinprocesses’memyaddress哲學(xué)家就餐問題:五個哲學(xué)家五個筷子,如何才能共享?采用信號量semaphechopstick[5],初始值均為1。對于第i哲學(xué)家:dowait(chopstick[i])wait(c

27、hopstick[(i1)%5])eatsignal(chopstick[i])signal(chopstick[(i1)%5])thinkwhile(1)其他解決方法:1.allowatmostfourphilosopherstobesittingsimultaneouslyatthetableaspareresource2.allowaphilosophertopickupchopsticksonlyifbothareavailab

28、lepickupthemsimultaneously3.useaasymmetricsolution:anoddphilosopherpicksupfirsttheleftchopstickthentherightchopstickwhereasanevenonepicksupfirsttherightthentheleft銀行家算法1.IfRequesti?Needigotostep2.Otherwiseraiseerrconditi

29、onsinceprocesshasexceededitsmaximumclaim.2.IfRequesti?Availablegotostep3.OtherwisePimustwaitsinceresourcesarenotavailable.3.PretendtoallocaterequestedresourcestoPibymodifyingthestateasfollows:Available=AvailableRequestiA

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 眾賞文庫僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論