



版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
1、中南大學(xué)計算機(jī)體系結(jié)構(gòu)實(shí)驗(yàn)報告學(xué)生姓名惠苗壯指導(dǎo)教師余臘生學(xué)院信息科學(xué)與工程學(xué)院專業(yè)班級計科 0904 班學(xué)號0909091627完成時間2012年 05月 20日字節(jié)多路通道運(yùn)行機(jī)制一、 實(shí)驗(yàn)?zāi)康耐ㄟ^模擬實(shí)現(xiàn)通道處理過程,掌握通道技術(shù)。二、 實(shí)驗(yàn)要求通過上機(jī)用編程語言實(shí)現(xiàn)對計算機(jī)字節(jié)多路通道運(yùn)行機(jī)制的模擬。三、 實(shí)驗(yàn)內(nèi)容結(jié)合數(shù)據(jù)結(jié)構(gòu)的相關(guān)知識 ,編寫通道處理過程模擬程序。1、通道完成一次數(shù)據(jù)輸入輸出的過程需三步(如圖一所示):( 1)在用戶程序中使用訪管指令進(jìn)入管理程序,由CPU 通過管理程序組織一個通道程序,啟動通道;( 2)通道處理機(jī)執(zhí)行通道程序,完成指定的數(shù)據(jù)輸入輸出工作;( 3)通道
2、程序結(jié)束后第二次調(diào)用管理程序?qū)斎胼敵稣埱筮M(jìn)行處理每完成一次輸入輸出工, CPU 只需要兩次調(diào)用管理程序, 大大減少了對用戶程序的打擾。2 通道的主要功能:( 1)接受 CPU 發(fā)來的指令,選擇一臺指定的外圍設(shè)( 2)執(zhí)行 CPU 為通道組織的通道程序( 3)管理外圍設(shè)備的有關(guān)地址( 4)管理主存緩沖區(qū)的地址( 5)控制外圍設(shè)備與主存緩沖區(qū)間數(shù)據(jù)交換的個數(shù)( 6)指定傳送工作結(jié)束時要進(jìn)行的操作( 7)檢查外圍設(shè)備的工作狀態(tài),是正常或故障( 8)在數(shù)據(jù)傳輸過程中完成必要的格式的變換四、 實(shí)驗(yàn)原理字節(jié)通道是一種簡單的共享通道,主要為多臺低速或中速的外圍設(shè)備服務(wù)。它采用分時方式工作,依靠它與 cpu
3、 之間的高速數(shù)據(jù)通路分時為多臺設(shè)備服務(wù)。如果通道上連接了多個外圍設(shè)備,則此時通道上的各個設(shè)備輪流占用一個很短的時間片(通常小于100微秒)傳輸一個字節(jié),或者說,不同的設(shè)備在他所分得的時間片內(nèi)與通道在邏輯上建立傳輸連接,此方式也叫做字節(jié)交叉方式。與此同時,它還允許一個設(shè)備一次占用通道比較長的時間傳輸一組數(shù)據(jù)?;蛘哒f與通道的連接可以根據(jù)需要維持到一組數(shù)據(jù)全部傳送完成,這也稱為成組方式。本次試驗(yàn)主要模擬的是字節(jié)交叉方式。五、 實(shí)驗(yàn)結(jié)果數(shù)據(jù)為(要傳輸?shù)臄?shù)據(jù))即:字符串: love, channal, architecture 運(yùn)行效果截圖為:代碼分為三個類:Device.classpackagearc
4、h;publicclassDevice privateStringdatas; /設(shè)備 / 存儲器中的數(shù)據(jù)privateintdataLength;publicDevice()publicDevice(String datas, ChannalManager cm)this.setDatas(datas);this. dataLength= datas.length();if( this. dataLength> cm.getMaxDevCap()cm.setMaxDevCap(this. dataLength);publicthisvoid setDataLength( int . d
5、ataLength = dataLength;dataLength) publicintreturngetDataLength() dataLength;publicthisvoidsetDatas(String datas) . datas= datas;publicString getDatas() returndatas;ChannelManager.classpackagearch;importimportpublicclass ChannalManagerimplementsRunnable privateStringinterrupt; /提示中斷信號privateint maxD
6、evCap=0;/ 所有設(shè)備的最大傳輸數(shù)據(jù)長度privateList<Device>Devices; /所有外圍設(shè)備privateList<Device>memory; /存儲器publicChannalManager()this. interrupt= "none"this. Devices= new ArrayList<Device>();this. Devices.add(newDevice();this. Devices.add(newDevice();this. Devices.add(newDevice();this. mem
7、ory= new ArrayList<Device>();this. memory.add(newDevice("love" , this );this. memory.add(newDevice("channal", this);this. memory.add(newDevice("architecture", this );publicvoid setInterrupt(String interrupt) this. interrupt= interrupt;publicString getInterrupt() r
8、eturninterrupt;publicthisvoidsetMaxDevCap(int. maxDevCap= maxDevCap;maxDevCap) publicintreturngetMaxDevCap() maxDevCap ;publicvoidDevicessetDevices(List<Device> devices) = devices;publicList<Device> getDevices() returnDevices;publicvoidprintDevice()for(Device d :this. Devices)System.out
9、.println(d.getDatas();Overridepublicvoidrun() /通道處理器進(jìn)行數(shù)據(jù)傳送/ TODO Auto-generated method stubfor( intfence = 0 ;fence <this. maxDevCap ; fence+)for( inti = 0;i <this. Devices.size() ; i+)if(fence <this. memory .get(i).getDataLength()this. Devices.get(i).setDatas(this. memory .get(i).getDatas(
10、).substring(0, fence+1);printDevice();printDevice();this. interrupt= "finish" /傳送完后發(fā)中斷RunningCpu.classpackagearch;publicclassRunningCpu privateChannalManagerchannalMg;publicRunningCpu()this. channalMg=new ChannalManager();publicvoidsetChannalMg(ChannalManager channalMg) this. channalMg= ch
11、annalMg;publicChannalManager getChannalMg() returnchannalMg;publicvoidrunCpu()while( true)if( channalMg.getInterrupt().equals("none")System.out .println("the cpu is running user'sprogram.");System.out .println("the cpu is running user'sprogram.");channalMg.setIn
12、terrupt("noned");if( channalMg.getInterrupt().equals("init")System.out .println("CPU is interrupted");System.out .println("This is a I/0 Init instruction,ThechannalManager is init the device.");channalMg.setInterrupt("none");Thread t =new Thread(this. channalMg);t.start();if( channalMg.getInterrupt().equals("finish")System.out .println(System.out .println(channalManager is finish the device."channalMg.setInterrupt("CPU is interrupte
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 課題申報書審查意見
- 研究課題申報書要素
- 氣象軟課題項(xiàng)目申報書
- 綜合實(shí)踐課題申報書
- 原礦石采購合同范本
- 保潔公司跨省經(jīng)營合同范本
- 分店入股門店合同范例
- 教學(xué)成果培育課題申報書
- 醫(yī)院承包協(xié)議合同范本
- 借哪吒精神燃開學(xué)斗志 開學(xué)主題班會課件
- 2025年初中主題班會課件:好習(xí)慣成就好人生
- 學(xué)校教職工代表大會全套會議會務(wù)資料匯編
- 中華人民共和國監(jiān)察法宣貫培訓(xùn)
- 2025年山東傳媒職業(yè)學(xué)院高職單招高職單招英語2016-2024歷年頻考點(diǎn)試題含答案解析
- 2025年春新教科版物理八年級下冊課件 第10章 流體的力現(xiàn)象 1 在流體中運(yùn)動
- 屋面種植土垂直施工方案
- 2025年新人教PEP版英語三年級下冊全冊課時練習(xí)
- 《愛耳日課件》課件
- 《中醫(yī)基礎(chǔ)理論》課件-中醫(yī)學(xué)理論體系的基本特點(diǎn)-整體觀念
- 全國職業(yè)院校技能大賽高職組(商務(wù)數(shù)據(jù)分析賽項(xiàng))備賽試題及答案
評論
0/150
提交評論