系统生物 第三章 建模与仿真学习资料_第1页
系统生物 第三章 建模与仿真学习资料_第2页
系统生物 第三章 建模与仿真学习资料_第3页
系统生物 第三章 建模与仿真学习资料_第4页
全文预览已结束

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

第三章建模与仿真3-9Thecomponentsmaybesimulationcodes,仿真analysistools,userinterfaces,databaseinterfaces,scriptlanguageinterpreters,orinfactanypieceofsoftwarethatconformstoacertainwell-definedinterface3-12TheSystemsBiologyWorkbenchisprimarilyasystemforintegratingresources.Itprovidesinfrastructurethatcanbeusedbysoftwaredeveloperstointerfacesoftwarecomponentstogetherandenablethemtocommunicatewitheachother.3-16模块是可以提供共享计算机资源的应用软件,broker是提供各个模块可以相互通信的平台模块可以用任何语言编写,只要它们能够运用一致的协议传送,接收和处理适当结构的信息,就可以与sbw平台相联结SBW的模块可以在用户或程序控制下方便的交换,添加或移出,甚至在运行的时候也可以实现,有动态可扩展性每个模块都有特定数值标识的handle(numericidentificationhandle)当一个模块要与另一个模块实现通信时,它向Broker发送信息请求,请求中包含终点模块的handle标识远程的服务可以通过信息传送(messagepassing)与其它软件实体实现信息交流3-17通过sbw交互库,编程人员将他们的模块与sbw系统实现交互,库执行必要的应用编程接口,使不同模块通过sbw框架相互通讯对模块本身来说,通信是直接的(模块到模块),在底层的。信息通过sbw的传输是不可见的3-18下面介绍一下信息传输的约定格式1.代表对其他模块中方法或函数或对broker本身的封闭的应答ReplyMessage0SendMessage1CallMessage2ErrorMessage32.代表非封闭的对其他模块中方法或函数或对broker本身的应答3.对之前信息的回应4.当传递信息格式错误或执行模块事发生异常时的error信息3-21模块与SBW初始连接当模块连接时,sbw会创建一个moduleobjectModulename是唯一的,但是可以为空,当值提供服务时。Id唯一,不变模块尝试将请求传递到sbw中,如果成功就将name以string提交到sbwbroker中的监听线程获得请求,并读出模块名监听线程为模块创建一个线程来处理模块与sbw间的通信这时候就创建了一个muduleobject,直到服务结束模块对象会添加到broker的索引中保存3-22模块线程只有两个功能,首先是决定信息是传递到下一个模块还是到达broker(即broker服务信息)如果是传递到另外的模块,就会根据信息中的终点模块标示,直接准确地传递到目的地。如何判断是传向broker的呢?Broker也有一个brokerid.作为信息接口,它的id是-1,因为线程的索引中是以0开始的,为了避免冲突就用-1来作为id。3-23模块为什么可以与broker向来连接起来呢?下面介绍一下模块的体系结构。它主要由四个类组成:ModuleComponent是应用程序与sbw连接的主要接口ThisisthemainentrypointforapplicationswishingtouseSBWfacilities.和javabean比较相似。AsimilarapproachcouldbeadoptedunderJavaintheformofaJavaBean.RecvThread负责接听来自broker的所有信息。它在一个监听线程中运行,当接收到一个信息以后,就创建了一个线程MessageThreadobject来处理信息的细节。RecvThreadrunscontinuouslyinathreadsothatlisteningforbrokermessagesdoesnotinterferewiththenormalprocessingoftheapplication.WhentheRecvThreadreceivesamessagefromthebrokeritspawnsaspecialMessageThreadobjectwhichhastheresponsibilityfordealingwiththeparticularsofthemessage.OncetheRecvThreadhasspawnedamessagethread,itreturnstoitsnormalmodeoflisteningforSBWmessages.Thus,eachtimeamessageisreceivedbyRecvThread,amessagethreadiscreated.However,toeliminatetheperformancehitwhichissufferedeachtimeathreadisspawned,intheactualimplementation,athreadpoolismaintainedandspawningamessagethreadinsteadinvolvesrequestingaexistingsuspendedthreadfromathreadpool.Whenmessagethreadsarenolongerrequiredtheyarereturnedtothethreadpoolforfutureuse.Testshaveshownthatthissimpleuseofathreadpoolimprovesmessagetransportroughlysix-foldcomparedtonothreadpooling.MessageThread对RecvThread接收到的信息进行解析,判断是什么信息call/send,replyorerrorconditionThemessagethreadisresponsiblefordecodingmessageswhichitreceivesfromRecvThread.Themessagethreadwillresponddifferentlydependingonwhetherthemessageisacall/send,replyorerrorcondition.Oncethemessagethreadhascompleteditstaskitisreturnedtothemessagethreadpool.ServiceListAlistofservicesandmethodsprovidedbythismodule3-24•Themodulemakesacallusingthesbw.call()method•Themessageissenttothebrokerandisreceivedbythemainlisteningthreadinthebroker.•ThemodulecreatesaWaitEventandaddsittothelistofwaiteventsstoredintheRecvThreadobject.•ThemodulewaitsusingtheWaitEvent.•Sometimelater,thebrokerreturnsareplytothemodule.•TheRecvThreadreceivesamessageandrecruitsamessagethreadfromthethreadpoolandpassesthecompletemessagetothemessagethread.RecvThreadthenresumesitsnormalmodeoflisteningformessagesfromthebroker.•Themessagethreadinterpretsthemessageasareply,butatthisstagedoesnotknowwhothereplyisfor.ThemessagethreadsearchestheEventListforthecorrespondingcallwhichinitiatedthisreply.Whenitlocatestheevent(anexceptionresultsifitcannotfindtheevent),itsavesthemessageandperformsaSetEventcallontheappropriatewaitingevent.Thiscausesthewaiteventtoresumeexecutionwhereisretrievesthestoredmessageandreturnsittotheoriginalcallerforprocessing.•Oncethereplyhasbeenfinallydispatched,themessagethreadisreturnedtothethreadpool.3-25TheRecvThreadinterceptsthemessagefromthebroker,recruitsamessagethread,passesthemessagetothemessagethreadandreturnstoitsnormalmodeoflisteningformessagesfromthebroker.•Themessagethreadexaminesthemessagetodetermineifthemessageisacall,asend,areplyoranerrorcondition.Ifthemessageisacall,thethreadroutesthemessagetothecallprocedure.Inthecallprocedureoneoftwothingscanhappen:1)thecallmethodwaspreviouslyregistered,inwhichcase,themessagethreadautomaticallycallstheappropriatemethodinthemodule;2)themethodwasnotregistered,inthiscasethemessagethreadfi

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论