资源描述:
《Understanding the Linux operating system》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、UnderstandingtheLinuxoperatingsystemProcessMemoryIONetwork9/2/20212LinuxPerformanceandTuningSchematicinteractionofdifferentperformancecomponents9/2/20213LinuxPerformanceandTuningLinuxprocessmanagementtimeslice:30ms10mscell,pageframe9/2/20215LinuxPerformanceandT
2、uningWhatisaprocess?AprocessisaninstanceofexecutionthatrunsonaprocessorFromthekernel'spointofview,thepurposeofaprocessistoactasanentitytowhichsystemresources(CPUtime,memory,etc.)areallocatedTheyincludeasetofresourcessuchasopenfilesandpendingsignals,internalkerne
3、ldata,processorstate,amemoryaddressspacewithoneormorememorymappings,oneormorethreadsofexecution,andadatasectioncontainingglobalvariables9/2/20216LinuxPerformanceandTuningProcessDescriptorandtheTaskStructureTomanageprocesses,thekernelmusthaveaclearpictureofwhatea
4、chprocessisdoingThekernelstoresthelistofprocessesinacirculardoublylinkedlistcalledthetasklistAllprocessesrunningonLinuxoperatingsystemaremanagedbythetask_structstructure,whichisalsocalledaprocessdescriptorThetask_structisarelativelylargedatastructure,ataround1.7
5、kilobytesona32-bitmachine9/2/20217LinuxPerformanceandTuningTheprocessdescriptorandtasklist链表9/2/20218LinuxPerformanceandTuning9/2/20219LinuxPerformanceandTuningTheLinuxprocessdescriptor9/2/202110LinuxPerformanceandTuningProcessStateTASK_RUNNINGTheprocessiseither
6、executingonaCPUorwaitingtobeexecutedTASK_INTERRUPTIBLETheprocessissuspended(sleeping)untilsomeconditionbecomestrue.Raisingahardwareinterrupt,releasingasystemresourcetheprocessiswaitingfor,ordeliveringasignalareexamplesofconditionsthatmightwakeuptheprocess(putits
7、statebacktoTASK_RUNNING)AtypicalexampleofaTASK_INTERRUPTIBLEprocessisaprocesswaitingforkeyboardinterrupt9/2/202111LinuxPerformanceandTuningTASK_UNINTERRUPTIBLELikeTASK_INTERRUPTIBLE,exceptthatdeliveringasignaltothesleepingprocessleavesitsstateunchangedAtypicalex
8、ampleofaTASK_UNINTERRUPTIBLEprocessisaprocesswaitingfordiskI/OoperationTASK_STOPPEDProcessexecutionhasbeenstopped;theprocessentersthisstateafterreceivingaSIGSTOP,SIGT