您好,欢迎访问三七文档
当前位置:首页 > 行业资料 > 交通运输 > 作业系统第03章的PPT
Silberschatz,GalvinandGagne©2013!OperatingSystemConcepts–9thEdition!Chapter3:Processes3.2!Silberschatz,GalvinandGagne©2013!OperatingSystemConcepts–9thEdition!Chapter3:Processes ProcessConcept ProcessScheduling OperationsonProcesses InterprocessCommunication ExamplesofIPCSystems CommunicationinClient-ServerSystems3.3!Silberschatz,GalvinandGagne©2013!OperatingSystemConcepts–9thEdition!Objectives Tointroducethenotionofaprocess–aprograminexecution,whichformsthebasisofallcomputation Todescribethevariousfeaturesofprocesses,includingscheduling,creationandtermination,andcommunication Toexploreinterprocesscommunicationusingsharedmemoryandmessagepassing Todescribecommunicationinclient-serversystems3.4!Silberschatz,GalvinandGagne©2013!OperatingSystemConcepts–9thEdition!ProcessConcept Anoperatingsystemexecutesavarietyofprograms: Batchsystem–jobs! Time-sharedsystems–userprogramsortasks Textbookusesthetermsjobandprocessalmostinterchangeably Process–aprograminexecution;processexecutionmustprogressinsequentialfashion Programispassiveentitystoredondisk(executablefile),processisactive! Programbecomesprocesswhenexecutablefileloadedintomemory ExecutionofprogramstartedviaGUImouseclicks,commandlineentryofitsname,etc. Oneprogramcanbeseveralprocesses Considermultipleusersexecutingthesameprogram3.5!Silberschatz,GalvinandGagne©2013!OperatingSystemConcepts–9thEdition!ProcessConcept Processhasmultipleparts Theprogramcode,alsocalledtextsection! Currentactivityincludingprogramcounter,processorregisters Stackcontainingtemporarydata Functionparameters,returnaddresses,localvariables Datasectioncontainingglobalvariables Heapcontainingmemorydynamicallyallocatedduringruntime3.6!Silberschatz,GalvinandGagne©2013!OperatingSystemConcepts–9thEdition!ProcessinMemory:code+currentactivity:temporarydata:globalvariables:dynamicallyallocateddata3.7!Silberschatz,GalvinandGagne©2013!OperatingSystemConcepts–9thEdition!ProcessState Asaprocessexecutes,itchangesstate! new:Theprocessisbeingcreated running:Instructionsarebeingexecuted waiting:Theprocessiswaitingforsomeeventtooccur ready:Theprocessiswaitingtobeassignedtoaprocessor terminated:Theprocesshasfinishedexecution3.8!Silberschatz,GalvinandGagne©2013!OperatingSystemConcepts–9thEdition!DiagramofProcessState3.9!Silberschatz,GalvinandGagne©2013!OperatingSystemConcepts–9thEdition!ProcessControlBlock(PCB)Informationassociatedwitheachprocess(alsocalledtaskcontrolblock) Processstate–running,waiting,etc. Programcounter–locationofinstructiontonextexecute CPUregisters–contentsofallprocess-centricregisters CPUschedulinginformation–priorities,schedulingqueuepointers Memory-managementinformation–memoryallocatedtotheprocess Accountinginformation–CPUused,clocktimeelapsedsincestart,timelimits I/Ostatusinformation–I/Odevicesallocatedtoprocess,listofopenfiles3.10!Silberschatz,GalvinandGagne©2013!OperatingSystemConcepts–9thEdition!CPUSwitchfromProcesstoProcess3.11!Silberschatz,GalvinandGagne©2013!OperatingSystemConcepts–9thEdition!Threads Sofar,processhasasinglethreadofexecution Considerhavingmultipleprogramcountersperprocess Multiplelocationscanexecuteatonce Multiplethreadsofcontrol-threads! Mustthenhavestorageforthreaddetails,multipleprogramcountersinPCB SeeChapter43.12!Silberschatz,GalvinandGagne©2013!OperatingSystemConcepts–9thEdition!ProcessRepresentationinLinux RepresentedbytheCstructuretask_structpid_tpid;/*processidentifier*/longstate;/*stateoftheprocess*/unsignedinttime_slice;/*schedulinginformation*/structtask_struct*parent;/*thisprocess’parent*/structlist_headchildren;/*thisprocess’children*/structfiles_struct*files;/*listofopenfiles*/structmm_struct*mm;/*addressspaceofthisprocess*/3.13!Silberschatz,GalvinandGagne©2013!OperatingSystemConcepts–9thEdition!ProcessScheduling MultiprogrammingmaximizesCPUuse TimesharingquicklyswitchesprocessesontoCPUtoofferreactiveCPUtoallusers ProcessschedulerselectsamongavailableprocessesfornextexecutiononCPU Maintainsschedulingqueuesofprocesses Jobqueue–setofallprocessesinthesystem Readyqueue–setofallprocessesresidinginmainmemory,readyandwaitingtoexecute Devicequeues–setofprocesseswaitingforanI/Odevice Processesmigrateamongthevariousqueues3.14!Silberschatz,GalvinandGagne©2013!OperatingSystemConcepts–9thEdition!ReadyQueueandVariousI/ODeviceQueues3.15!Silberschatz,GalvinandGagne©2013!OperatingSystemConcepts–9thEdition!RepresentationofProcessScheduling Queuingdiagramcommonlyrepresentsqueues,resources,flowsterminating3.16!Silberschatz,GalvinandGagne©2013!OperatingSystemConcepts–9thEdition!Schedulers Long-termscheduler(orjobscheduler)–selectswhichprocessesshouldbebroughtintothereadyqueue(e.g.,oftenfromaspoolondisk) Short-termscheduler(orCPUscheduler)–selectswhichprocessshouldbeexecutednextandallocatesCPU Sometimestheonlyschedulerinasystem Short-termschedulerisinvokedveryfrequently(milliseconds)⇒(mustbefast) Long-termschedulerisinvokedveryinfrequently(seconds,minutes)⇒(maybeslow) Thelong-termschedulercontrolsthedegreeofmultiprogram
本文标题:作业系统第03章的PPT
链接地址:https://www.777doc.com/doc-7153423 .html