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

spinservers($89/月),圣何塞10Gbps带宽服务器,达拉斯10Gbps服务器

spinservers是Majestic Hosting Solutions LLC旗下站点,主要提供国外服务器租用和Hybrid Dedicated等产品的商家,数据中心包括美国达拉斯和圣何塞机房,机器一般10Gbps端口带宽,高配置硬件,支持使用PayPal、信用卡、支付宝或者微信等付款方式。目前,商家针对部分服务器提供优惠码,优惠后达拉斯机房服务器最低每月89美元起,圣何塞机房服务器最低每月...

ucloud国内云服务器2元/月起;香港云服务器4元/首月;台湾云服务器3元/首月

ucloud云服务器怎么样?ucloud为了扩大云服务器市场份额,给出了超低价云服务器的促销活动,活动仍然是此前的Ucloud全球大促活动页面。目前,ucloud国内云服务器2元/月起;香港云服务器4元/首月;台湾云服务器3元/首月。相当于2-4元就可以试用国内、中国香港、中国台湾这三个地域的云服务器1个月了。ucloud全球大促仅限新用户,国内云服务器个人用户低至56元/年起,香港云服务器也仅8...

杭州王小玉网-美国CERA 2核8G内存19.9元/月,香港,日本E3/16G/20M CN2带宽150元/月,美国宿主机1500元,国内宿主机1200元

官方网站:点击访问王小玉网络官网活动方案:买美国云服务器就选MF.0220.CN 实力 强 强 强!!!杭州王小玉网络 旗下 魔方资源池 “我亏本你引流活动 ” mf.0220.CNCPU型号内存硬盘美国CERA机房 E5 2696v2 2核心8G30G总硬盘1个独立IP19.9元/月 续费同价mf.0220.CN 购买湖北100G防御 E5 2690v2 4核心4G...

linuxwindows为你推荐
百度爱好者什么是贴吧存储备份备份在sd卡的怎么恢复sonicchat国外军人的左胸上有彩色的阁子是什么意思Baby被问婚变绯闻黄晓明baby一起出来带娃,想要打破离婚传闻?haole018.com为什么www.haole008.com在我这里打不开啊,是不是haole008换新的地址了?www.niuav.com在那能找到免费高清电影网站呢 ?lcoc.topoffsettop和scrolltop的区别5566.com5566网址大全www.qqq147.comhttp://www.qq朴容熙这个女的叫什么?
购买域名 花生壳动态域名 php主机租用 最便宜虚拟主机 西安电信测速 cpanel 表格样式 双11抢红包攻略 密码泄露 世界测速 idc查询 新世界服务器 安徽双线服务器 域名与空间 移动服务器托管 vul 东莞主机托管 主机返佣 江苏徐州移动 阿里云邮箱个人版 更多