欢迎来到天天文库
浏览记录
ID:62075728
大小:301.00 KB
页数:55页
时间:2021-04-14
《最新The Structuring of Systems Using Upcalls教学讲义ppt.ppt》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、TheStructuringofSystemsUsingUpcallsAQuickReviewofLayersManydesignsareorganizedintermsofmultiplelayersofabstractionByconvention,wetalkaboutlayerslikethey’restackedontopofeachotherThemostbasiclayerisonthebottomExample(Libraries)LayersasModules(1)So,putthemodulesinasingleaddressspace,asdemon
2、stratedin“Swift”,theirresearchO.S.Forsafety,theywroteSwiftinCLU:Strongcompile-timetypingDynamicboundscheckingGarbagecollectionLayersasModules(2)Modulessharethesamespace,socallsbetweenthemarejustprocedurecallsModuleshavetobemultithreaded:Assigningasinglethreadtoeachmoduleandasynchronouslyh
3、andingoffatboundariesisslowSoasinglethreadfollowsajobthroughthelayersSoeachlayerhastohandlemultiplejobsatonceIsthereadisciplineaboutwhocallswhom?DownwardsControlFlowNormally,wethinkofcontrolflowingfromthetopdown(downcalls)TheapplicationcallsalibraryThelibrarycallsthesystemJustanormalproce
4、durecall:thelowerlevelexecutesforawhile,thenreturnstotheupperlevelUpwardsControlFlowSometimes,it’smorenaturalforcontroltoflowupwardsOnejobsendsasignaltoanotherThesystemgetsanetworkpacketJustlikeanormalprocedurecall:theupperlevelexecutesforawhile,thenreturnstothelowerlevelDuality(1)Upcalls
5、aren’trequired:Theupperlevelcanpollthelowerlevel,askingifanyinterestingasynchronouseventshaveoccurredButthisisanasynchronoushandofffromthelow-leveleventtothepollingjobAndthere’sinherentoverheadinpollingformultipleeventsatonceDuality(2)Downcallsaren’trequiredeither!Asystemwithonlyupcallswo
6、uldhandleasynchronouseventsefficientlyButlowerlayerswouldhavetopolltoseeifhigherlayershaveanyrequestsSo,they’redualnotionsWhenshouldweuseupcalls?Whenshouldweusedowncalls?Arethereinherentdangerswithupcalls?Downcall-basedSocketsdowncall:createandbindasocketdowncall:receivedataifpossibledown
7、call:senddataifpossibledowncall:tellmewhenIcansendorreceivemoredataonanyofthesesocketsUpcall-basedSocketsdowncall:createandbindasocketWealsoneedtotellthesocketlayerwhichprocedurestouseasupcallsupcall:somedatajustarrivedupcall:doyouhaveanydatatosend?downcall:callmeba
此文档下载收益归作者所有