Nachos Project Assignment 1 Multi-programming TA: Hung-Leng Chen.
-
Upload
louisa-bryant -
Category
Documents
-
view
216 -
download
0
Transcript of Nachos Project Assignment 1 Multi-programming TA: Hung-Leng Chen.
Nachos Project Assignment 1
Multi-programming
TA: Hung-Leng Chen
Outline
Introduction to NachosInstall Nachos on LinuxAssignment 1
Introduction
Nachos:• Not Another Completely Heuristic Operatin
g SystemWritten by Tom Anderson and his students at UC Berkeley• http://www.cs.washington.edu/homes/tom/nachos/
Introduction (cont.)
An educational OS used to• teaching monolithic kernel design and impl
ementation• doing experiments
A virtual MIPS machine• User programs need a cross-compiler (targe
t MIPS)
Install Nachos
Platform: Linux , Linux over VMware or Cygwin• Check gcc version
− gcc -v• gcc 3.3.3 and gcc 3.2.2 are ok.
Install steps on Linux or Linux over VMware• Get Nachos-4.0 << 作業公告 >>• Get Cross Compiler << 作業公告 >>• Move Cross Compiler to /
− mv ./mips-decstation.linux-xgcc.tgz /• Untar Cross Compiler
− tar zxvf /mips-decstation.linux-xgcc.tgz
Install Nachos (cont.)
• Untar 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
• You should see the following…
You should see test1 resultTotal threads number is 1Thread ../test/test1 is executing.Print integer:9Print integer:8Print integer:7Print integer:6return value:0No threads ready or runnable, and no pending interrupts.Assuming the program completed.Machine halting! Ticks: total 200, idle 66, system 40, user 94Disk I/O: reads 0, writes 0Console I/O: reads 0, writes 0Paging: faults 0Network I/O: packets received 0, sent 0
You should see test2 resultTotal threads number is 1Thread ../test/test2 is executing.Print integer:20Print integer:21Print integer:22Print integer:23Print integer:24Print integer:25return value:0No threads ready or runnable, and no pending interrupts.Assuming the program completed.Machine halting!
Ticks: total 200, idle 32, system 40, user 128Disk I/O: reads 0, writes 0
Operate Nachos
Nachos command help• ./nachos -h
Debugging mode• ./nachos -s
Execute files on Nachos• ./nachos –e ../test/test1
Recompile Modified Nachos Code
cd nachos-4.0/codemake clean (optional)make• If you want to fully re-compile the source co
de, “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
Trace for NachOS-4.0 with GLOBAL• http://cc.ee.ntu.edu.tw/~farn/courses/OS2006/nachos/
HTML/
Assignment 1
Go to nachos-4.0/code/userprog and type “./nachos –e ../test/test1 –e ../test/test2”Total threads number is 2Thread ../test/test1 is executing.Thread ../test/test2 is executing.Print integer:9Print integer:8Print integer:7Print integer:20Print integer:21Print integer:22Print integer:23Print integer:24Print integer:6Print integer:7
Print integer:8Print integer:9Print integer:10Print integer:12Print integer:13Print integer:14Print integer:15Print integer:16Print integer:16Print integer:17Print integer:18Print integer:19Print integer:20Print integer:17Print integer:18Print integer:19Print integer:20Print integer:21Print integer:21Print integer:23Print integer:24Print integer:25
In some reasons, the output results didn’t match the behavior of “../test/test1.c” and “../test/test2.c”
return value:0return value:0Print integer:26Print integer:26return value:0return value:0No threads ready or runnable, and no pending interrupts.No threads ready or runnable, and no pending interrupts.Assuming the program completed.Assuming the program completed.Machine halting!Machine halting! Ticks: total 800, idle 67, system 120, user 613Ticks: total 800, idle 67, system 120, user 613Disk I/O: reads 0, writes 0Disk I/O: reads 0, writes 0Console I/O: reads 0, writes 0Console I/O: reads 0, writes 0Paging: faults 0Paging: faults 0Network I/O: packets received 0, sent 0Network I/O: packets received 0, sent 0
Assignment 1(Hint)
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 1(Hint)
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
Deadline
4/18 Tue 14:00Please tar your code and e-mail to [email protected] entitled as your_student_ID.tar.gz• make clean (submit source code only)• tar zcvf r92921100.tar.gz nachos-4.0
Accompany with your report about what did you done to the Nachos source code (why and how) , or what did you get when tracing the Nachos source code.
Grading policy
Note: your handout files must contain two parts• 1.modified nachos source code (ID.tar.gz)• 2.report
Correct result 30%Report 70%Contact me if you have any problems• [email protected]