资源描述:
《基于多线程的高性能服务器程序的设计》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、Designofhigh-performanceserverprogramwhichbasedonmultithreadsAbstract:Alongwiththenetworkapplication'srapiddevelopment,thehigh-performanceserverprogramhighlightsitsimportantstatusmoreandmore.Inthearticlehasdesignedahigh-performanceserverprogrambasedonmulti-threads,thustoputsforwardgoodsolutio
2、nstoprocessclientconcurrentrequestproblem.FirstlyintroducingtheprincipleofIOCPmodel,then,usingtheSelectmodelandtheIOCPmodelrespectively,putadifferentdesignmethodforthehigh-performanceserverprogramdesign,throughcomparingthetime,CPUutilizationandmemoryutilizationratioandmanyotherparameters,conc
3、ludedthatIOCPprovidesthebestperformanceofthesystemindesignontheserver.Finallyputsforwarddesignschemeofhigh-performanceserverprogram.Keywords:Selectmodel,IOCPmodel,Concurrencycontrol,Event;flowcontrol1IntroductionAtpresenttherearemanyserverprogramsuse“onetoone”disposingmode,namelyoneclienttake
4、sathread,designsonthearchitectureofserverprogramswhichbasedonthiskindofpatternisverysimple,butsinceusesis“aclient/thread”pattern,thereforethiskindofserverprogramappearsverylowintheperformanceregardingoverathousandclient's8requestconnections,andisalsocostlyonsystemresources.Becausetheoperating
5、systemmustcarryonthedispatchforthemassivethreads,itwilllosethemassivesystemresources,andmutexcontrolwillalsobeverydifficult,thedeadlockoccurfrequencywillgreatlyincrease.Nowadaysthehighperformanceserverprogram'sdesignbecomesmoreandmoreimportant,thehighperformanceserverprogram'smainfunctionisth
6、atitcanprocessmassiveconcurrentclient'srequestefficiently,andprocessclient'sdatatimely,simultaneouslygivesthepartoftheresponseinformationbacktotheclientside.Todesignagoodperformanceofserverprogram,mustconsidermanyfactors,likeCPUutilizationratio,Memoryexpensesandsoon.Tobeefficientprocessingcon
7、currentusersrequest,theserverprogramneedstosolvetwomainproblems:first,handlingtheconcurrentclient'sconnectrequests;second,forconcurrentdataprocessing.Tosolvetheseproblems,itcancreateanequalamountofworkthreadaccordingtothequantityofprocessorco