Presentation is loading. Please wait.

Presentation is loading. Please wait.

Nachos Project Assignment 2

Similar presentations


Presentation on theme: "Nachos Project Assignment 2"— Presentation transcript:

1 Nachos Project Assignment 2
CPU scheduling TA:mamafun

2 Assignment 1.Implement system call “Sleep”
2.Implement Shortest-Job-First scheduling

3 Sleep System Call 1.請研究 userprog/exception.cc, userprog/syscall.h, test/start.s 這三個檔案以了解system call是如何實作的. 2.請實作Sleep(int x)這個system call,把呼叫這個system call的thread block住,並且在x次的timer interrupts以後才又回到READY的狀態.

4 Hint 1.修改exception.cc, syscall.h, start.s
2.呼叫alarm.cc的WaitUntil(int x)來處理Sleep(int x)這個system call

5 SJF Scheduling 1.Nachos 內定的 scheduling algorithm 是 Round-Robin, 我們接下來將加入 non-preemptive SJF scheduling 2.用n+1 = tn + (1- )n 來預估下一個CPU burst n : 第n個預估的CPU burst長度 tn : 第n個實際的CPU burst長度  : 取0.5 (一次timer interrupt代表CPU burst加1 公式請參考課本159頁)

6 SJF Hint Begin Running Per timer interrupt: 1.Record actual CPU burst
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

7 SJF Hint 你需要修改 schedule.cc, alarm.cc 和其他相關檔案,並可能要增加一個class來管理這些因為呼叫Sleep(x)而處於BLOCK狀態的threads Begin Running 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

8 Deadline 5月7號 Friday am 6:00 penalty 50% 把你寫好的nachos source code 壓縮成
“os組別_p1.tar.gz”,連同報告”os組別_p1.doc”上傳到 port 21 帳號 : os組別 ex: ftp port 21 os1/xxxx upload os1_p2.tar.gz upload os1_p2.doc (請一定要放在各組的home directory下)

9 Grading Policy Results of your project 60% Project 2 report 40%
請自行設計test case來證明你的project是對的,針對RR scheduling和SJF scheduling都要能work (同時放到nachos下面去run的thread,個數至少3個) 助教的test case和result放在ftp上供大家參考,請用os2004的帳號登入 有任何問題都歡迎到課程討論區,大家一起研究 :D


Download ppt "Nachos Project Assignment 2"

Similar presentations


Ads by Google