系統(tǒng)生物 第三章 建模與仿真學(xué)習(xí)資料_第1頁(yè)
系統(tǒng)生物 第三章 建模與仿真學(xué)習(xí)資料_第2頁(yè)
系統(tǒng)生物 第三章 建模與仿真學(xué)習(xí)資料_第3頁(yè)
系統(tǒng)生物 第三章 建模與仿真學(xué)習(xí)資料_第4頁(yè)
全文預(yù)覽已結(jié)束

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

第三章建模與仿真3-9Thecomponentsmaybesimulationcodes,仿真analysistools,userinterfaces,databaseinterfaces,scriptlanguageinterpreters,orinfactanypieceofsoftwarethatconformstoacertainwell-definedinterface3-12TheSystemsBiologyWorkbenchisprimarilyasystemforintegratingresources.Itprovidesinfrastructurethatcanbeusedbysoftwaredeveloperstointerfacesoftwarecomponentstogetherandenablethemtocommunicatewitheachother.3-16模塊是可以提供共享計(jì)算機(jī)資源的應(yīng)用軟件,broker是提供各個(gè)模塊可以相互通信的平臺(tái)模塊可以用任何語(yǔ)言編寫,只要它們能夠運(yùn)用一致的協(xié)議傳送,接收和處理適當(dāng)結(jié)構(gòu)的信息,就可以與sbw平臺(tái)相聯(lián)結(jié)SBW的模塊可以在用戶或程序控制下方便的交換,添加或移出,甚至在運(yùn)行的時(shí)候也可以實(shí)現(xiàn),有動(dòng)態(tài)可擴(kuò)展性每個(gè)模塊都有特定數(shù)值標(biāo)識(shí)的handle(numericidentificationhandle)當(dāng)一個(gè)模塊要與另一個(gè)模塊實(shí)現(xiàn)通信時(shí),它向Broker發(fā)送信息請(qǐng)求,請(qǐng)求中包含終點(diǎn)模塊的handle標(biāo)識(shí)遠(yuǎn)程的服務(wù)可以通過(guò)信息傳送(messagepassing)與其它軟件實(shí)體實(shí)現(xiàn)信息交流3-17通過(guò)sbw交互庫(kù),編程人員將他們的模塊與sbw系統(tǒng)實(shí)現(xiàn)交互,庫(kù)執(zhí)行必要的應(yīng)用編程接口,使不同模塊通過(guò)sbw框架相互通訊對(duì)模塊本身來(lái)說(shuō),通信是直接的(模塊到模塊),在底層的。信息通過(guò)sbw的傳輸是不可見(jiàn)的3-18下面介紹一下信息傳輸?shù)募s定格式1.代表對(duì)其他模塊中方法或函數(shù)或?qū)roker本身的封閉的應(yīng)答ReplyMessage0SendMessage1CallMessage2ErrorMessage32.代表非封閉的對(duì)其他模塊中方法或函數(shù)或?qū)roker本身的應(yīng)答3.對(duì)之前信息的回應(yīng)4.當(dāng)傳遞信息格式錯(cuò)誤或執(zhí)行模塊事發(fā)生異常時(shí)的error信息3-21模塊與SBW初始連接當(dāng)模塊連接時(shí),sbw會(huì)創(chuàng)建一個(gè)moduleobjectModulename是唯一的,但是可以為空,當(dāng)值提供服務(wù)時(shí)。Id唯一,不變模塊嘗試將請(qǐng)求傳遞到sbw中,如果成功就將name以string提交到sbwbroker中的監(jiān)聽(tīng)線程獲得請(qǐng)求,并讀出模塊名監(jiān)聽(tīng)線程為模塊創(chuàng)建一個(gè)線程來(lái)處理模塊與sbw間的通信這時(shí)候就創(chuàng)建了一個(gè)muduleobject,直到服務(wù)結(jié)束模塊對(duì)象會(huì)添加到broker的索引中保存3-22模塊線程只有兩個(gè)功能,首先是決定信息是傳遞到下一個(gè)模塊還是到達(dá)broker(即broker服務(wù)信息)如果是傳遞到另外的模塊,就會(huì)根據(jù)信息中的終點(diǎn)模塊標(biāo)示,直接準(zhǔn)確地傳遞到目的地。如何判斷是傳向broker的呢?Broker也有一個(gè)brokerid.作為信息接口,它的id是-1,因?yàn)榫€程的索引中是以0開(kāi)始的,為了避免沖突就用-1來(lái)作為id。3-23模塊為什么可以與broker向來(lái)連接起來(lái)呢?下面介紹一下模塊的體系結(jié)構(gòu)。它主要由四個(gè)類組成:ModuleComponent是應(yīng)用程序與sbw連接的主要接口ThisisthemainentrypointforapplicationswishingtouseSBWfacilities.和javabean比較相似。AsimilarapproachcouldbeadoptedunderJavaintheformofaJavaBean.RecvThread負(fù)責(zé)接聽(tīng)來(lái)自broker的所有信息。它在一個(gè)監(jiān)聽(tīng)線程中運(yùn)行,當(dāng)接收到一個(gè)信息以后,就創(chuàng)建了一個(gè)線程MessageThreadobject來(lái)處理信息的細(xì)節(jié)。RecvThreadrunscontinuouslyinathreadsothatlisteningforbrokermessagesdoesnotinterferewiththenormalprocessingoftheapplication.WhentheRecvThreadreceivesamessagefromthebrokeritspawnsaspecialMessageThreadobjectwhichhastheresponsibilityfordealingwiththeparticularsofthemessage.OncetheRecvThreadhasspawnedamessagethread,itreturnstoitsnormalmodeoflisteningforSBWmessages.Thus,eachtimeamessageisreceivedbyRecvThread,amessagethreadiscreated.However,toeliminatetheperformancehitwhichissufferedeachtimeathreadisspawned,intheactualimplementation,athreadpoolismaintainedandspawningamessagethreadinsteadinvolvesrequestingaexistingsuspendedthreadfromathreadpool.Whenmessagethreadsarenolongerrequiredtheyarereturnedtothethreadpoolforfutureuse.Testshaveshownthatthissimpleuseofathreadpoolimprovesmessagetransportroughlysix-foldcomparedtonothreadpooling.MessageThread對(duì)RecvThread接收到的信息進(jìn)行解析,判斷是什么信息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. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論