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

美国Cera 2核4G 20元/45天 香港CN2 E5 20M物理机服务器 150元 日本CN2 E5 20M物理机服务器 150元 提速啦

提速啦 成立于2012年,作为互联网老兵我们一直为用户提供 稳定 高速 高质量的产品。成立至今一直深受用户的喜爱 荣获 “2021年赣州安全大赛第三名” “2020创新企业入围奖” 等殊荣。目前我司在美国拥有4.6万G总内存云服务器资源,香港拥有2.2万G总内存云服务器资源,阿里云香港机房拥有8000G总内存云服务器资源,国内多地区拥有1.6万G总内存云服务器资源,绝非1 2台宿主机的小商家可比。...

木木云35元/月,美国vps服务器优惠,1核1G/500M带宽/1T硬盘/4T流量

木木云怎么样?木木云品牌成立于18年,此为贵州木木云科技有限公司旗下新运营高端的服务器的平台,目前已上线美国中部大盘鸡,母鸡采用E5-267X系列,硬盘全部组成阵列。目前,木木云美国vps进行了优惠促销,1核1G/500M带宽/1T硬盘/4T流量,仅35元/月。点击进入:木木云官方网站地址木木云优惠码:提供了一个您专用的优惠码: yuntue目前我们有如下产品套餐:DV型 1H 1G 500M带宽...

pacificrack:$12/年-1G内存/1核/20gSSD/500g流量/1Gbps带宽

pacificrack在最新的7月促销里面增加了2个更加便宜的,一个月付1.5美元,一个年付12美元,带宽都是1Gbps。整个系列都是PR-M,也就是魔方的后台管理。2G内存起步的支持Windows 7、10、Server 2003\2008\2012\2016\2019以及常规版本的Linux!官方网站:https://pacificrack.com支持PayPal、支付宝等方式付款7月秒杀VP...

linuxwindows为你推荐
在线教育平台我想在网上教学,哪个网上教学平台好?嘉兴商标注册我在濮院想注册一个羊毛衫商标?该怎么做?bbs.99nets.com怎么把电脑的IP设置和路由器一个网段xyq.163.cbg.com梦幻西游里,CBG是什么?在那里,能帮忙详细说一下吗haole16.com玛丽外宿中16全集在线观看 玛丽外宿中16qvod快播高清下载5xoy.com求个如月群真汉化版下载地址杨丽晓博客杨丽晓是怎么 出道的ww.66bobo.comfq55点com是什么网站haole012.com说在:012qq.com这个网站能免费挂QQ,是真的吗?66smsm.comffff66com手机可以观看视频吗?
域名代理 骨干网 lnmp 好玩的桌面 网盘申请 最好看的qq空间 ca4249 骨干网络 adroit 河南移动m值兑换 linux使用教程 空间购买 免费的域名 卡巴斯基试用版下载 卡巴斯基免费版下载 遨游论坛 qq部落24-5 大硬盘补丁 服务器监测软件 上海服务器托管 更多