资源描述:
《数据库系统概念第六版课后习题部分答案9s》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、CHAPTER9ApplicationDesignandDevelopmentPracticeExercises9.1Whatisthemainreasonwhyservletsgivebetterperformancethanpro-gramsthatusethecommongatewayinterface(CGI),eventhoughJavaprogramsgenerallyrunslowerthanCorC++programs?Answer:TheCGIinterfacestartsanewprocesstoserviceeac
2、hrequest,whichhasasignificantoperatingsystemoverhead.Ontheotherhand,serveletsarerunasthreadsofanexistingprocess,avoidingthisoverhead.Further,theprocessrunningthreadscouldbetheWebserverprocessit-self,avoidinginterprocesscommunicationwhichcanbeexpensive.Thus,forsmalltomoder
3、atesizedtasks,theoverheadofJavaislessthantheoverheadssavedbyavoidingprocesscreatingandcommunication.FortasksinvolvingalotofCPUactivity,thismaynotbethecase,andusingCGIwithaCorC++programmaygivebetterperformance.9.2Listsomebenefitsanddrawbacksofconnectionlessprotocolsoverpro
4、to-colsthatmaintainconnections.Answer:Mostcomputershavelimitsonthenumberofsimultaneousconnectionstheycanaccept.Withconnectionlessprotocols,connectionsarebrokenassoonastherequestissatisfied,andthereforeotherclientscanopenconnections.Thusmoreclientscanbeservedatthesametime.
5、Arequestcanberoutedtoanyoneofanumberofdifferentserverstobalanceload,andifaservercrashesanothercantakeoverwithouttheclientnoticinganyproblem.Thedrawbackofconnectionlessprotocolsisthataconnectionhastobereestablishedeverytimearequestissent.Also,sessioninformationhastobesent
6、eachtimeinformofcookiesorhiddenfields.Thismakesthemslowerthantheprotocolswhichmaintainconnectionsincasestateinformationisrequired.12Chapter9ApplicationDesignandDevelopment9.3ConsideracarelesslywrittenWebapplicationforanonline-shoppingsite,whichstoresthepriceofeachitemasah
7、iddenformvariableintheWebpagesenttothecustomer;whenthecustomersubmitstheform,thein-formationfromthehiddenformvariableisusedtocomputethebillforthecustomer.Whatistheloopholeinthisscheme?(Therewasarealin-stancewheretheloopholewasexploitedbysomecustomersofanonline-shoppingsi
8、te,beforetheproblemwasdetectedandfixed.)Answer:AhackercanedittheHTMLsourcecodeoftheWebpage,andreplacethe