entrieslinuxwindows

linuxwindows  时间:2021-03-28  阅读:()
ProcessesinUnix,Linux,andWindowsCS502OperatingSystems(SlidesincludematerialsfromOperatingSystemConcepts,7thed.
,bySilbershatz,Galvin,&GagneandfromModernOperatingSystems,2nded.
,byTanenbaum)GenericProcesses–ReviewProcessstate–informationmaintainedbyOSforrepresentingprocess,inPCBPSW,registers,conditioncodes,etc.
Memory,files,resources,etc.
Priority,blockingstatus,etc.
QueuesReadyQueueSemaphorequeuesOtherkindsofqueuesnotyetcovered(e.
g.
,fordisks,communicationresources,etc.
)GenericProcesses–Review(continued)InterruptsandtrapsSwitchingcontextsSavingstateofoneprocessLoadingstateofanotherprocessSchedulingDecidingwhichprocesstorun(orserve)nextMorenextweekInterprocessCommunicationLaterinthecourseReadingAssignmentChapter3ofSilbershatzEspecially:§3.
1–3.
3Process(withcapital"P")AProcessinUnix,Linux,orWindowscomprises:–anaddressspace–usuallyprotectedandvirtual–mappedintomemorythecodefortherunningprogramthedatafortherunningprogramanexecutionstackandstackpointer(SP)theprogramcounter(PC)asetofprocessorregisters–generalpurposeandstatusasetofsystemresourcesfiles,networkconnections,pipes,…privileges,(human)userassociation,……Processes–AddressSpace0x000000000xFFFFFFFFVirtualaddressspaceprogramcode(text)staticdataheap(dynamicallyallocated)stack(dynamicallyallocated)PCSPSeealsoSilbershatz,figure3.
1ProcessesintheOS–RepresentationTousers(andotherprocesses)aprocessisidentifiedbyitsProcessID(PID)IntheOS,processesarerepresentedbyentriesinaProcessTable(PT)PIDisindexto(orpointerto)aPTentryPTentry=ProcessControlBlock(PCB)PCBisalargedatastructurethatcontainsorpointstoallinfoabouttheprocessLinux-definedintask_struct–over70fieldsseeinclude/linux/sched.
hNT–definedinEPROCESS–about60fieldsProcessesintheOS–PCBTypicalPCBcontains:executionstatePC,SP&processorregisters–storedwhenprocessisnotinrunningstatememorymanagementinfoPrivilegesandownerinfoschedulingpriorityresourceinfoaccountinginfoProcess–startingandendingProcessesarecreated…WhenthesystembootsBytheactionsofanotherprocess(morelater)BytheactionsofauserBytheactionsofabatchmanagerProcessesterminate…Normally–exitVoluntarilyonanerrorInvoluntarilyonanerrorTerminated(killed)bytheactionsauseroraprocessProcesses–SwitchingWhenaprocessisrunning,itshardwarestateisintheCPU–PC,SP,processorregistersWhentheOSsuspendsrunningaprocess,itsavesthehardwarestateinthePCBContextswitchistheactofswitchingtheCPUfromoneprocesstoanothertimesharingsystemsmaydo100sor1000sofswitches/sectakes1-100microsecondsontoday'shardwareProcesses–StatesProcesshasanexecutionstateready:waitingtobeassignedtoCPUrunning:executingontheCPUwaiting:waitingforanevent,e.
g.
I/OProcesses–StateQueuesTheOSmaintainsacollectionofprocessstatequeuestypicallyonequeueforeachstate–e.
g.
,ready,waiting,…eachPCBisputontoaqueueaccordingtoitscurrentstateasaprocesschangesstate,itsPCBisunlinkedfromonequeue,andlinkedtoanotherProcessstateandthequeueschangeinresponsetoevents–interrupts,trapsProcesses–PrivilegesUsersaregivenprivilegesbythesystemadministratorPrivilegesdeterminewhatrightsauserhasforanobject.
Unix/Linux–Read|Write|eXecutebyuser,groupand"other"(i.
e.
,"world")WinNT–AccessControlListProcesses"inherit"privilegesfromuserProcesses–CreationUnix/LinuxCreateanew(child)process–fork();AllocatesnewPCBClonesthecallingprocess(almost)CopyofparentprocessaddressspaceCopiesresourcesinkernel(e.
g.
files)PlacesnewPCBonReadyqueueReturnfromfork()call0forchildchildPIDforparentExampleoffork()intmain(intargc,char**argv){char*name=argv[0];intchild_pid=fork();if(child_pid==0){printf("Childof%sseesPIDof%d\n"name,child_pid);return0;}else{printf("Iamtheparent%s.
Mychildis%d\n",name,child_pid);return0;forktestChildofforktestseesPIDof0Iamtheparentforktest.
Mychildis486StartingNewProgramsUnix&Linux:–intexec(char*prog,char**argv)CheckprivilegesandfiletypeLoadsprogram"prog"intoaddressspaceReplacingpreviouscontents!
Executionstartsatmain()Initializescontext–e.
g.
passesarguments*argvPlacePCBonreadyqueuePreserves,pipes,openfiles,privileges,etc.
ForkingaNewProgramfork()followedbyexec()CreatesanewprocessascloneofpreviousoneFirstthingthatclonedoesistoreplaceitselfwithnewprogramFork+Exec–shell-likeintmain(intargc,char**argv){char*argvNew[5];intpid;if((pid=fork())<0){printf("Forkerror\n");exit(1);}elseif(pid==0){/*childprocess*/argvNew[0]="/bin/ls";argvNew[1]="-l";argvNew[2]=NULL;if(execve(argvNew[0],argvNew,environ)<0){printf("Execveerror\n");exit(1);}}else{/*parent*/wait(pid);/*waitforthechildtofinish*/}}Processes–NewProgramsWindows/NT–combinesfork&execCreateProcess(10arguments)NotaparentchildrelationshipNote–privilegesrequiredtocreateanewprocessWindows,Unix,andLinux(traditional)ProcessesareinseparateaddressspacesBydefault,nosharedmemoryProcessesareunitofschedulingAprocessisready,waiting,orrunningProcessesareunitofresourceallocationFiles,I/O,memory,privileges,…Processesareusedfor(almost)everything!
ANoteonImplementationManyOSimplementationsinclude(partsof)kernelineveryaddressspaceProtectedEasytoaccessAllowskerneltoseeintoclientprocessesTransferringdataExaminingstate…Processes–AddressSpace0x000000000xFFFFFFFFVirtualaddressspacecode(text)staticdataheap(dynamicallyallocated)KernelCodeandDataPCSPUserSpacestack(dynamicallyallocated)KernelSpace32-bitLinux&WinXP–3G/1Guserspace/kernelspaceLinuxKernelImplementationKernelmayexecuteineitherProcesscontextvs.
InterruptcontextInProcesscontext,kernelhasaccesstoVirtualmemory,files,otherprocessresourcesMaysleep,takepagefaults,etc.
,onbehalfofprocessInInterruptcontext,noassumptionaboutwhatprocesswasexecuting(ifany)Noaccesstovirtualmemory,files,resourcesMaynotsleep,takepagefaults,etc.
ProcessesinOtherOperatingSystemsImplementationswilldifferSometimesasubsetofUnix/Linux/WindowsSometimesquitedifferentMayhavemorerestrictedsetofresourcesOften,specializeinreal-timeconstraintsQuestionsImplementationReadyqueuePCBPCBPCBPCBSemaphoreAcount=0PCBPCBSemaphoreBcount=2

WHloud Date鲸云数据($9.00/月), 韩国,日本,香港

WHloud Date(鲸云数据),原做大数据和软件开发的团队,现在转变成云计算服务,面对海内外用户提供中国大陆,韩国,日本,香港等多个地方节点服务。24*7小时的在线支持,较为全面的虚拟化构架以及全方面的技术支持!官方网站:https://www.whloud.com/WHloud Date 韩国BGP云主机少量补货随时可以开通,随时可以用,两小时内提交退款,可在工作日期间全额原路返回!支持pa...

RAKSmart VPS主机半价活动 支持Windows系统 包含香港、日本机房

RAKSmart 商家最近动作还是比较大的,比如他们也在增加云服务器产品,目前已经包含美国圣何塞和洛杉矶机房,以及这个月有新增的中国香港机房,根据大趋势云服务器算是比较技术流的趋势。传统的VPS主机架构方案在技术层面上稍微落后一些,当然也是可以用的。不清楚是商家出于对于传统VPS主机清理库存,还是多渠道的产品化营销,看到RAKSmart VPS主机提供美国、香港和日本机房的半价促销,当然也包括其他...

BuyVM老牌商家新增迈阿密机房 不限流量 月付2美元

我们很多老用户对于BuyVM商家还是相当熟悉的,也有翻看BuyVM相关的文章可以追溯到2014年的时候有介绍过,不过那时候介绍这个商家并不是很多,主要是因为这个商家很是刁钻。比如我们注册账户的信息是否完整,以及我们使用是否规范,甚至有其他各种问题导致我们是不能购买他们家机器的。以前你嚣张是很多人没有办法购买到其他商家的机器,那时候其他商家的机器不多。而如今,我们可选的商家比较多,你再也嚣张不起来。...

linuxwindows为你推荐
多家五星酒店回应网传名媛拼单求一电影名字 讲的是一个女孩在酒店打工穿了客人的衣服吸引了住在酒店一个高富帅 最后在一起了 女孩自小度商城小度分期靠谱吗?特朗普取消访问丹麦特朗普出国访问什么飞机护送?甲骨文不满赔偿工作不满半年被辞退,请问赔偿金是怎么算的?百度关键词价格查询百度推广关键词怎么扣费?lunwenjiancepaperfree论文检测怎样算合格rawtoolsRAW是什么衣服牌子月神谭适合12岁男孩的网名,要非主流的,帮吗找找,谢啦同一服务器网站服务器建设:一个服务器有多个网站该如何设置?porntimesexy time 本兮 MP3地址
域名查询系统 cn域名价格 免费二级域名申请 isatap 香港托管 win8.1企业版升级win10 web服务器架设 qq对话框 中国电信宽带测速器 游戏服务器出租 中国电信测速网站 万网空间 supercache 酷锐 .htaccess 百度新闻源申请 ftp是什么东西 最好的空间留言 qq空间技术网 网络存储服务器 更多