Operating System - NachOS Project Introduction

Slides:



Advertisements
Similar presentations
2010/12/12
Advertisements

FCU, Department of ECE, IC Design Research Lab. TEL: # 4945 Pre-SIm , Post-Sim.
1 生物計算期末作業 暨南大學資訊工程系 2003/05/13. 2 compare f1 f2  只比較兩個檔案 f1 與 f2 ,比完後將結果輸出。 compare directory  以兩兩比對的方式,比對一個目錄下所有檔案的相 似程度。  將相似度很高的檔案做成報表輸出,報表中至少要.
Divide-and-Conquer. 什麼是 divide-and-conquer ? Divide 就是把問題分割 Conquer 則是把答案結合起來.
6-1 指標簡介 6-2 指標與陣列 6-3 動態配置記憶體 6-4 本章綜合練習
Chapter 10 馬可夫鏈 緒言 如果讀者仔細觀察日常生活中所發生的 諸多事件,必然會發現有些事件的未來 發展或演變與該事件現階段的狀況全然 無關,這種事件稱為獨立試行過程 (process of independent trials) ;而另一些 事件則會受到該事件現階段的狀況影響。
學習C++的基本語法 認識關鍵字與識別字的不同 學習程式碼偵錯的流程 學習如何提高程式的可讀性
Teacher : Ing-Jer Huang TA : Chien-Hung Chen 2015/6/3 Course Embedded Systems : Principles and Implementations Weekly Preview Question CH3.5 ~ CH /10/31.
3Com Switch 4500 切VLAN教學.
期末專題 - 吊人頭遊戲 第 35 組 組員 : 電機系 49841XXXX XXX 電機系 49841OOOO OOO.
What is static?. Static? 靜態 ? class Test { static int staticX; int instanceX; public Test(int var1, int var2) { this.staticX = var1; this.instanceX =
矩陣乘法 實作矩陣乘法 利用 threads 來加速運算速度 – Matrix1 row x Matrix2 column = Ans (x,y) Matrix 1Matrix 2Answer.
1 第一章 Word 的基本觀念 內容概要: Word 的特色 啟動與離開 Word 的方法 滑鼠游標與外型的介紹 基本操作 Word 視窗法則 使用 Word 遭遇問題時, 應如何利用軟體特 性而獲得輔助解說.
CNA 2008 Project 1 TA: 徐志偉 Office: EA Grading policy: Total (100%) Report (20%) Socket Programming: (80%) –Basic (60%) –Advanced (20%)
STAT0_sampling Random Sampling  母體: Finite population & Infinity population  由一大小為 N 的有限母體中抽出一樣本數為 n 的樣 本,若每一樣本被抽出的機率是一樣的,這樣本稱 為隨機樣本 (random sample)
1 網路同步學習 如何使用中山大學管理學院知識管理平台 愷中 製作. 2 如何登入中山大學網路學習平台 1. 首先, 請輸入 2. 點選申請帳號, 依照螢幕所示, 輸入個人資訊.
1 單元三 查詢結果的引用分析 Web of Science 利用指引 查看出版及被引用情況 在查詢結果的清單中,可以瀏覽近 20 年來查詢主題出版和被引用的情況。
長訊科技 EVRCOM Voice Mail System 使用者操作說明及流程. 自動總機 -- 來電語音轉接服務流程 ( 範例流程 )
資料處理 汪群超 2 這一年將學習到什麼? 網際網路:你在哪裡?瞭解你的角色、駕馭網路 。 Web 、 FTP 、 、 Proxy 、 Database Servers 記錄你的學習歷程、展現學習成果: Homepage 、 PowerPoint.
Network Connections ★★★☆☆ 題組: Contest Archive with Online Judge 題號: Network Connections 解題者:蔡宗翰 解題日期: 2008 年 10 月 20 日 題意:給你電腦之間互相連線的狀況後,題.
Introduction to Java Programming Lecture 17 Abstract Classes & Interfaces.
第 5 章 深入 Response 物件 製作. 網頁的轉向與強制輸出 - 讓網頁轉彎的 Redirect 敘述 運用 Response 物件的 Redirect 方法,將瀏覽器顯 示的網頁,導向至其他網頁,語法如下: Response.Redirect 網頁路徑與名稱 此網頁路徑與名稱  若是導向到同一台.
最新計算機概論 第 5 章 系統程式. 5-1 系統程式的類型 作業系統 (OS) : 介於電腦硬體與 應用軟體之間的 程式,除了提供 執行應用軟體的 環境,還負責分 配系統資源。
Chapter 20 塑模動態觀點:狀態圖 Statechart Diagram. 學習目標  說明狀態圖的目的  定義狀態圖的基本記號  展示狀態圖的建構  定義活動、內部事件及遞延事件的狀態 圖記號.
: Happy Number ★ ? 題組: Problem Set Archive with Online Judge 題號: 10591: Happy Number 解題者:陳瀅文 解題日期: 2006 年 6 月 6 日 題意:判斷一個正整數 N 是否為 Happy Number.
: Fast and Easy Data Compressor ★★☆☆☆ 題組: Problem Set Archive with Online Judge 題號: 10043: Fast and Easy Data Compressor 解題者:葉貫中 解題日期: 2007 年 3.
各種線上電子資源的特異功能 SwetsWise 的 alert, TOC alert 與 Favorites 2003/4/28 修改.
行政院國家科學委員會工程技術發展處自動化學門 * 試以國立成功大學製造工程研究所 鄭芳田教授 產學合作計畫 : 智慧預測保養系統之設計與實作 成果報告盤點為範例 國科會工程處專題計畫成果典藏 自動化學門成果報告盤點範例.
各種線上電子資源的特異功能 SpringerLINK 的 Alert, Serials Update, News 2003/4/28 修改.
: Ahoy, Pirates! ★★★★☆ 題組: Contest Archive with Online Judge 題號: 11402: Ahoy, Pirates! 解題者:李重儀 解題日期: 2008 年 8 月 26 日 題意:有一個海盜島有 N 個海盜,他們的編號 (id)
: Count DePrimes ★★★★☆ 題組: Contest Archive with Online Judge 題號: 11408: Count DePrimes 解題者:李育賢 解題日期: 2008 年 9 月 2 日 題意: 題目會給你二個數字 a,b( 2 ≦ a ≦ 5,000,000,a.
: Multisets and Sequences ★★★★☆ 題組: Problem Set Archive with Online Judge 題號: 11023: Multisets and Sequences 解題者:葉貫中 解題日期: 2007 年 4 月 24 日 題意:在這個題目中,我們要定義.
公司加入市場的決定. 定義  平均成本 = 總成本 ÷ 生產數量 = 每一單位產量所耗的成本  平均固定成本 = 總固定成本 ÷ 生產數量  平均變動成本 = 總變動成本 ÷ 生產數量.
:Nuts for nuts..Nuts for nuts.. ★★★★☆ 題組: Problem Set Archive with Online Judge 題號: 10944:Nuts for nuts.. 解題者:楊家豪 解題日期: 2006 年 2 月 題意: 給定兩個正整數 x,y.
資料結構實習-一 參數傳遞.
6-2 認識元件庫與內建元件庫 Flash 的元件庫分兩種, 一種是每個動畫專 屬的元件庫 (Library) ;另一種則是內建元 件庫 (Common Libraries), 兩者皆可透過 『視窗』功能表來開啟, 以下即為您說明。
1 Introduction to Java Programming Lecture 2: Basics of Java Programming Spring 2008.
公用品.  該物品的數量不會因一人的消費而受到 影響,它可以同時地被多人享用。 角色分配  兩位同學當我的助手,負責:  其餘各人是投資者,每人擁有 $100 , 可以投資在兩種資產上。  記錄  計算  協助同學討論.
: Problem G e-Coins ★★★☆☆ 題組: Problem Set Archive with Online Judge 題號: 10306: Problem G e-Coins 解題者:陳瀅文 解題日期: 2006 年 5 月 2 日 題意:給定一個正整數 S (0
: Beautiful Numbers ★★★★☆ 題組: Problem Set Archive with Online Judge 題號: 11472: Beautiful Numbers 解題者:邱經達 解題日期: 2011 年 5 月 5 日 題意: 若一個 N 進位的數用到該.
Section 4.2 Probability Models 機率模式. 由實驗看機率 實驗前先列出所有可能的實驗結果。 – 擲銅板:正面或反面。 – 擲骰子: 1~6 點。 – 擲骰子兩顆: (1,1),(1,2),(1,3),… 等 36 種。 決定每一個可能的實驗結果發生機率。 – 實驗後所有的實驗結果整理得到。
Teacher : Ing-Jer Huang TA : Chien-Hung Chen 2015/6/25 Course Embedded Systems : Principles and Implementations Weekly Preview Question CH 2.4~CH 2.6 &
函式 Function Part.2 東海大學物理系‧資訊教育 施奇廷. 遞迴( Recursion ) 函式可以「呼叫自己」,這種動作稱為 「遞迴」 此程式的執行結果相當於陷入無窮迴圈, 無法停止(只能按 Ctrl-C ) 這給我們一個暗示:函式的遞迴呼叫可以 達到部分迴圈的效果.
Image Interpolation Use SSE 指導教授 : 楊士萱 學 生 : 楊宗峰 日 期 :
2010 MCML introduction 製作日期: 2010/9/10 製作人 : 胡名霞.
: Expect the Expected ★★★★☆ 題組: Contest Archive with Online Judge 題號: 11427: Expect the Expected 解題者:李重儀 解題日期: 2008 年 9 月 21 日 題意:玩一種遊戲 (a game.
-Antidifferentiation- Chapter 6 朝陽科技大學 資訊管理系 李麗華 教授.
845: Gas Station Numbers ★★★ 題組: Problem Set Archive with Online Judge 題號: 845: Gas Station Numbers. 解題者:張維珊 解題日期: 2006 年 2 月 題意: 將輸入的數字,經過重新排列組合或旋轉數字,得到比原先的數字大,
網路介紹及其運用 講師陳炯勳. 5-2 IP 協定 ( 一 ) IP 協定運作 (1) – 網路成員:主機 (Host) 與路由器 (Router) – 路由表 – 電報傳輸運作.
概念性產品企劃書 呂學儒 李政翰.
組合語言與系統程式 軟體使用教學. 軟體下載及安裝 下載 到課程網頁下載 tw/~jiun/ 安裝 解壓縮後將 System Software 資料夾放在 D 槽 (C 槽版本放在 C 之下 )
1 Introduction to Java Programming Lecture 2: Basics of Java Programming Spring 2009.
SQL 進階查詢.
INTRODUCTION TO MATLAB SHAWNNTOU. What Is MATLAB? MATLAB® is a high-performance language for technical computing. MATLAB® is a high-performance language.
: Problem E Antimatter Ray Clearcutting ★★★★☆ 題組: Problem Set Archive with Online Judge 題號: 11008: Problem E Antimatter Ray Clearcutting 解題者:林王智瑞.
第 6 章 迴圈結構 6-1 計數迴圈 6-1 計數迴圈 6-2 條件迴圈 6-2 條件迴圈 6-3 巢狀迴圈 6-3 巢狀迴圈 6-4 While/End While 迴圈 6-4 While/End While 迴圈 6-5 跳出迴圈 6-5 跳出迴圈 6-6 VB.NET 的錯誤處理 6-6 VB.NET.
Teacher : Ing-Jer Huang TA : Chien-Hung Chen 2015/6/30 Course Embedded Systems : Principles and Implementations Weekly Preview Question CH7.1~CH /12/26.
函式 Function 東海大學物理系‧資訊教育 施奇廷. 函式簡介 當程式越來越大、越複雜時,程式的維護、 除錯會變得更困難,此時必須引入函式來 簡化程式或將程式分段,將程式重複的部 分改寫為函式,將程式「模組化」 這種作法有下列優點:節省程式發展的時 間、邏輯容易瞭解、程式容易除錯、可分 工合作完成程式.
-Artificial Neural Network- Matlab操作介紹 -以類神經網路BPN Model為例
1 Introduction to Java Programming Lecture 2: Basics of Java Programming Spring 2010.
Introduction to Java Programming Lecture 16 Super and Sub Classes.
: Finding Paths in Grid ★★★★☆ 題組: Contest Archive with Online Judge 題號: 11486: Finding Paths in Grid 解題者:李重儀 解題日期: 2008 年 10 月 14 日 題意:給一個 7 個 column.
著作權所有 © 旗標出版股份有限公司 第 14 章 製作信封、標籤. 本章提要 製作單一信封 製作單一郵寄標籤.
1 Introduction to Java Programming Lecture 3 Mathematical Operators Spring 2009.
1 Nachos Introduction Lecturer: Tei-Wei Kuo TA: Ya-Su Chen, Yuan-Hao chang Date: 2005/10/19.
Nachos Projects Overview and Project 1 TA : 吳哲榮 2010/10/21.
Nachos Projects Overview and Project 1 TA : 王映智 2007/10/24.
Nachos Project Assignment 1 MultiprogrammingTA:mamafun.
Nachos Project Assignment 1 Multi-programming TA: Hung-Leng Chen.
營繕組 _ 工作項目 _ 工程修繕. 出納支付查詢系統 財產管理系統 財產管理系統.
Presentation transcript:

Operating System - NachOS Project Introduction 教授:周立德 助教:楊宏昌 分散式系統實驗室 工五館 A312 分機:35231 Email: cyht@dslab.csie.ncu.edu.tw

NachOS Not Another Completely Heuristic Operating System Written by Tom Anderson and his students at UC Berkeley in 1992 http://www.cs.washington.edu/homes/tom/nachos/

What is NachOS An educational OS used to Fact Teach monolithic kernel design and implementation Do experiments, you can (and will) modify and extend it Fact Real hardware is difficult to handle May break if handled wrong

What is NachOS Approach Includes many facets of a real OS: Use a virtual MIPS machine Provide some basic OS elements Includes many facets of a real OS: Threads Interrupts Virtual Memory I/O driven by interrupts

What is NachOS NachOS also contains some hardware simulation MIPS processor Can handle MIPS code in standard COFF, except for floating point instructions You can (and will) write code in C/C++, compile it to MIPS and run it on NachOS Console, Network interface, Timer

How does it work Run as a single UNIX process Provide a skeletal OS that supports Threads User-level processes Virtual memory Interrupt-driven I/O devices

How does it work Two modes of execution NachOS kernel MIPS simulator Executes when NachOS starts up A user-program causes a hardware trap (page fault, syustem call, etc.) MIPS simulator Initialized and started by NachOS kernel

How does it work

How does it work Simulates MIPS architecture on host system (UNIX / Linux / Windows / MacOS X) User programs need a cross-compiler (target MIPS) NachOS appears as a single threaded process to the host operating system

How does it work

How does it work

How does it work

Source Tree Root directory C++ introduction to teach how to write C++ Root directory of Nachos’s source code The tool to convert user programs from MIPS’s COFF into NachOS’s NOFF (NachOS Object File Format ) format File system Nachos’s library Source code of NachOS kernel and MIPS simulator MIPS machine In/Out message queues NachOS’s sample user programs threads User programs’ interfaces: system calls, address space, noff format

code/threads/main.cc main System Start UP > ./nachos start code/threads/main.cc main Start up interrupt handling initialize the ready queue and scheduler initialize MIPS machine Run some system testing create kernel object initialize the system Invoke user program No user program Load user program System halt and terminate Run user program

Install NachOS Platform: Linux or Linux over VMware Install steps RedHat Linux 9.0 (ftp.tku.edu.tw) Install steps Get NachOS-4.0 wget http://dslab.csie.ncu.edu.tw/OS2006/nachos-4.0.tar.gz Get Cross Compiler wget http://dslab.csie.ncu.edu.tw/OS2006/mips-decstation.linux-xgcc.tgz Move Cross Compiler to / mv ./mips-decstation.linux-xgcc.tgz / Untar Cross Compiler tar zxvf /mips-decstation.linux-xgcc.tgz

Install NachOS Untar NachOS-4.0 Make NachOS-4.0 tar zxvf ./nachos-4.0.tar.gz Make NachOS-4.0 cd ./nachos-4.0/code make Test if installation is succeeded cd ./userprog ./nachos -e ../test/test1 ./nachos -e ../test/test2 You should see the following…

The test1 result Total threads number is 1 Thread ../test/test1 is executing. Print integer:9 Print integer:8 Print integer:7 Print integer:6 return value:0 No threads ready or runnable, and no pending interrupts. Assuming the program completed. Machine halting! Ticks: total 200, idle 66, system 40, user 94 Disk I/O: reads 0, writes 0 Console I/O: reads 0, writes 0 Paging: faults 0 Network I/O: packets received 0, sent 0

The test2 result Total threads number is 1 Thread ../test/test2 is executing. Print integer:20 Print integer:21 Print integer:22 Print integer:23 Print integer:24 Print integer:25 return value:0 No threads ready or runnable, and no pending interrupts. Assuming the program completed. Machine halting! Ticks: total 200, idle 32, system 40, user 128 Disk I/O: reads 0, writes 0

Operate NachOS NachOS command help Debugging mode ./nachos -h Debugging mode ./nachos -s Execute files on NachOS ./nachos -e ../test/test1

Recompile Modified NachOS Code cd nachos-4.0/code make clean (optional) make If you want to fully re-compile the source code, “make clean” is required. Or make will only re-compile the modified and related files. (save time)

Trace NachOS Read *.h and *.cc to have an overview about the whole system and see how it is implemented Documentation (A Road Map Through NachOS) http://www.cs.duke.edu/~narten/110/nachos/main/main.html

Assignment 1 NachOS 介紹 安裝 NachOS,環境,過程 把安裝過程抓圖作成說明文件 (word 檔) 把所有在 linux 下用到的指令解釋清楚其用法,並舉例說明

Assignment 2 到 nachos-4.0/code/userprog 目錄下執行 ./nachos –e ../test/test1 –e ../test/test2 Total threads number is 2 Thread ../test/test1 is executing. Thread ../test/test2 is executing. Print integer:9 Print integer:8 Print integer:7 Print integer:20 Print integer:21 Print integer:22

Assignment 2 (cont.) 從上述的輸出,可知結果有誤 Please trace the following files to see why the output results are wrong nachos-4.0/code/userprog/addrspace.h nachos-4.0/code/userprog/addrspace.cc nachos-4.0/code/userprog/userkernel.cc nachos-4.0/code/machine/translate.h Nachos-4.0/code/machine/translate.cc

Assignment 2 (cont.) Please modified the Nachos code to run the correct results You may need to modify the following functions nachos-4.0/code/userprog/addrspace.cc constructor destructor initRegister Load

Assignment 3 Implement system call “Sleep” Implement Shortest-Job-First scheduling

System call “Sleep” 請實作 Sleep(int x) 這個 system call, 把呼叫這個 system call 的 thread block住, 並且在 x 次的 timer interrupts 以後才又回到 READY 的狀態。

System call “Sleep” (cont.) 修改 exception.cc, syscall.h, start.s 呼叫 alarm.cc 的 WaitUntil(int x) 來處理 Sleep(int x) 這個 system call

SJF Scheduling NachOS 內定的 scheduling algorithm 是 Round-Robin,請設計 non-preemptive SJF Scheduling 請自行設計一組或多組 test case 來證明你的 project 是對的,針對 RR 或是 SJF 都要能運作,放到 NachOS 下面去執行的 thread,個數至少 3 個

SJF Scheduling (cont.) 由於是 non-preemptive,所以當 timer interrupts 時不用將 thread yield 什麼時候有可能換 thread 執行? 需要記錄每個 thread 實際 CPU burst 長度 (timer interrupts 數目), 與預測將來 CPU burst 長度 在哪裡可以得到這個資訊? 何時該進行預測?

SJF Scheduling (cont.) Begin Running Per timer interrupt: Invoke Sleep(x) Per timer interrupt: 1.Record actual CPU burst 2.叫醒應該起床的 threads 1.Set next predicted CPU burst 2.Insert this thread to Sleeping thread lists 3.Invoke thread->Sleep

Demo Accompany with your report about what did you done to the NachOS source code (why and how), and what did you get when tracing the NachOS source code. 把寫好的source code與報告(word檔)壓縮成 ”學號.tar.gz”,email to: cyht@dslab.csie.ncu.edu.tw

Demo (cont.) 郵件主旨請定為 助教收到 email 後會回信表示收到 NachOS project report NUM,學號:姓名 助教收到 email 後會回信表示收到 如果一週內沒收到回信,請再寄一次