1 / 18

Nachos Project Assignment 1

Nachos Project Assignment 1. Multi-programming TA: Hung-Leng Chen. Outline. Introduction to Nachos Install Nachos on Linux Assignment 1. Introduction. Nachos: Not Another Completely Heuristic Operating System Written by Tom Anderson and his students at UC Berkeley

konala
Télécharger la présentation

Nachos Project Assignment 1

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Nachos Project Assignment 1 Multi-programming TA: Hung-Leng Chen

  2. Outline • Introduction to Nachos • Install Nachos on Linux • Assignment 1

  3. Introduction • Nachos: • Not Another Completely Heuristic Operating System • Written by Tom Anderson and his students at UC Berkeley • http://www.cs.washington.edu/homes/tom/nachos/

  4. Introduction (cont.) • An educational OS used to • teaching monolithic kernel design and implementation • doing experiments • A virtual MIPS machine • User programs need a cross-compiler (target MIPS)

  5. 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

  6. 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…

  7. You should see 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

  8. You should see 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

  9. Operate Nachos • Nachos command help • ./nachos -h • Debugging mode • ./nachos -s • Execute files on Nachos • ./nachos –e ../test/test1

  10. 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)

  11. 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/

  12. Assignment 1 • Go to nachos-4.0/code/userprog and type “./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 Print integer:23 Print integer:24 Print integer:6 Print integer:7

  13. Print integer:8 Print integer:9 Print integer:10 Print integer:12 Print integer:13 Print integer:14 Print integer:15 Print integer:16 Print integer:16 Print integer:17 Print integer:18 Print integer:19 Print integer:20 Print integer:17 Print integer:18 Print integer:19 Print integer:20 Print integer:21 Print integer:21 Print integer:23 Print integer:24 Print integer:25

  14. return value:0 Print integer:26 return value:0 No threads ready or runnable, and no pending interrupts. Assuming the program completed. Machine halting! Ticks: total 800, idle 67, system 120, user 613 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 • In some reasons, the output results didn’t match the behavior of “../test/test1.c” and “../test/test2.c”

  15. 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

  16. 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

  17. Deadline • 4/18 Tue 14:00 • Please tar your code and e-mail to kidd@arbor.ee.ntu.edu.tw 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.

  18. 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 • kidd@arbor.ee.ntu.edu.tw

More Related