簡易檢索 / 詳目顯示

研究生: 張景焜
Chang, Jing Kun
論文名稱: 使用非原子指令實現非阻斷式的鎖定機制用於移植無作業系統Pthread
A non-blocking locking mechanism using non-atomic instructions for bare-metal Pthread porting
指導教授: 劉靖家
Liou, Jing Jia
口試委員: 金仲達
黃稚存
學位類別: 碩士
Master
系所名稱: 電機資訊學院 - 電機工程學系
Department of Electrical Engineering
論文出版年: 2014
畢業學年度: 102
語文別: 英文
論文頁數: 44
中文關鍵詞: 使用非原子指令實現非阻斷式的鎖定機制用於移植無作業系統Pthread
相關次數: 點閱:1下載:0
分享至:
查詢本校圖書館目錄 查詢臺灣博碩士論文知識加值系統 勘誤回報
  • 具有支援晶片上網路NOC 多核心平台已經由之前的學長提出並且實作完成, 這個支援晶片上網路多核心平台用來撰寫平行程式的平行程式模型是訊息傳遞 ( massage passing )。
    另一個大多數程式設計者經常使用於撰寫的平行程式的模型是共享記憶體 ( shared memory ) 架構的平行程式模型,由於我們支援晶片上網路多核心平台尚未支援共享記憶體架構的平行程式模型,並且考慮到支援晶片上網路多核心平台程式碼的大小,由作業系統提供的Pthread 並不適合我們使用,因此我們才移植無作業系統( bare-metal ) Pthread, 無作業系統Pthread需自行實作處理環境切換 ( context switch ) 以及執行緒 ( threads ) 的排程。
    令人非常意外的是,我們支援晶片上網路多核心平台使用的 OR1K 中央處理單元 CPU 並沒有支援原子 ( atomic ) 指令,所以我們才提出解決此問題的鎖定機制, 這個鎖定機制做的假設是在特定的記憶體空間上執行讀取與寫入的動作,當作是鏈接加載 ( Load-linked ) / 條件存儲 ( Store-conditional ) 記憶體的操作,為了達成鏈接加載 / 條件存儲記憶體的操作, 我們主要實作了三個部分去達到原子指令的效果, 分別是特定記憶體空間映射 ( mapping ) 機制、配合上 Load-linked 互連 ( interconnect ) 的硬體元件,最後使用鎖定機制的應用程式介面 ( API ) 來達到原子指令的效果,最後我們測試 splash-2 的應用程式來驗證我們移植的無作業系統 Pthread 和鎖定機制的正確性是否正確。


    Contents 1 Introduction 8 1.1 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1.2 Thesis Organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2 Background 9 2.1 SystemC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.2 OSCI TLM-2.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 2.3 Open Core Protocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 2.4 OpenRISC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 2.5 Open Virtual Platform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 2.6 Bare-metal p-thread library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 2.6.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 2.6.2 Main programming flow . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 2.6.3 Scheduler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 2.6.4 Context Switch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 2.6.4.1 Mygetcontext . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 2.6.4.2 Mysetcontext . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 2.6.4.3 Endofcontext . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 2 3 Proposed Locking mechanism 18 3.1 Overview of Locking mechanism . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 3.2 Lockable memory address transform . . . . . . . . . . . . . . . . . . . . . . . . . 18 3.3 Load-linked interconnect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 3.4 Locking mechanism API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 3.4.1 Shared memory platform Locking API . . . . . . . . . . . . . . . . . . . . 19 3.4.1.1 HW protect lock init . . . . . . . . . . . . . . . . . . . . . . . 20 3.4.1.2 HW protect lock . . . . . . . . . . . . . . . . . . . . . . . . . . 21 3.4.1.3 HW protect unlock . . . . . . . . . . . . . . . . . . . . . . . . 22 3.4.2 NOC-based shared memory with Comm. Unit platform Locking API . . . 23 3.4.2.1 ilib mutex API . . . . . . . . . . . . . . . . . . . . . . . . . . 24 3.4.2.2 start lock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 3.4.2.3 apilib Locking API . . . . . . . . . . . . . . . . . . . . . . . . 24 4 Experimental Results 26 4.1 Test Locking mechanism on shared memory platform . . . . . . . . . . . . . . . . 26 4.1.1 Shared memory platform architecture . . . . . . . . . . . . . . . . . . . . 26 4.1.2 Test Splash-2 Application . . . . . . . . . . . . . . . . . . . . . . . . . . 29 4.2 Test Locking mechanism on NOC-based shared memory platform . . . . . . . . . 31 4.2.1 NOC-based shared memory platform architecture . . . . . . . . . . . . . . 31 4.2.2 Testing Splash-2 Application . . . . . . . . . . . . . . . . . . . . . . . . . 32 4.3 Test Locking mechanism on NOC-based shared memory with Comm. Unit platform 35 4.3.1 NOC-based shared memory with Comm. Unit platform architecture . . . . 35 3 4.3.2 Test Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 4.3.2.1 Shared counter application . . . . . . . . . . . . . . . . . . . . 38 4.3.2.2 Shared account application . . . . . . . . . . . . . . . . . . . . 39 4.3.2.3 Odd-even sorting . . . . . . . . . . . . . . . . . . . . . . . . . 40 5 Conclusions and Future Work 42 5.1 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 5.2 Future Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

    [1] S. Borkar, “Thousand Core Chips—A Technology Perspective”, in Proc. IEEE/ACM Design
    Automation Conf. (DAC), 2007, pp. 746–749.
    [2] Wen. Sheng. Chen, “Design of Non-blocking Communication Engine for NoC-based Platforms”,
    Master’s thesis, National Tsing-Hua University, Electrical Engineering Department,
    2014.
    [3] Ting. Shuo. Hsu, “A DVFS Many-core ESL Simulation Platform with Software Communication
    API”, Master’s thesis, National Tsing-Hua University, Electrical Engineering Department,
    2011.
    [4] Open SystemC Initiative, “IEEE Standard SystemC Language Reference Manual”, IEEE Std
    1666-2005, pp. 1–423, Mar. 2006.
    [5] D. C. Black, J. Donovan, B. Bunton, and A. Keist, SystemC: From the ground up, Springer
    Verlag, 2009.
    [6] Open SystemC Initiative, OSCI TLM 2.0 Language Reference Manual, July 2009.
    [7] Open Core Protocol International Partnership, Open Core Protocol Specification Release 2.2,
    Jan. 2007.
    [8] D. Lampret, C.-M. Chen, M. Mlinar, J. Rydberg, M. Ziv-Av, C. Ziomkowski, G. McGary,
    B. Gardner, R. Mathur, and M. Bolado, OpenRISC 1000 Architecture Manual rev 1.3, May
    2006, http://opencores.org/or1k/Main Page.
    [9] North American SystemC Users Group, “Bus Locking and Snooping”, dac, 2009.
    43
    [10] Imperas Software Limited, OVP Guide To Using Processor Modeles, 2013,
    http://www.ovpworld.org/using-ovp-fast-processor-models-with-ovpsim-and-othersimulators.
    [11] Yu. Hsun. Chen, “Design and Analysis of Inter-PE Communication on Many-Core Platform”,
    Master’s thesis, National Tsing-Hua University, Computer Science Department, 2012.
    [12] Tilera Corporation, ILIB API REFERENCE MANUAL, May 2008.

    無法下載圖示 全文公開日期 本全文未授權公開 (校內網路)
    全文公開日期 本全文未授權公開 (校外網路)

    QR CODE