Nachos Project Assignment 1 Multiprogramming TA mamafun Outline

  • Slides: 16
Download presentation
Nachos Project Assignment 1 Multiprogramming TA: mamafun

Nachos Project Assignment 1 Multiprogramming TA: mamafun

Outline ►Introduction to Nachos ►Install Nachos on Linux ►Assignment 1

Outline ►Introduction to Nachos ►Install Nachos on Linux ►Assignment 1

Introduction ► Nachos: § Not Another Completely Heuristic Operating System ► Written by Tom

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/

Trace Nachos ► Get Nachos 4. 0 § http: //cc. ee. ntu. edu. tw/~farn/courses/OS

Trace Nachos ► Get Nachos 4. 0 § http: //cc. ee. ntu. edu. tw/~farn/courses/OS 2004/index. html ► C++ tutorial § http: //www. cs. washington. edu/homes/tom/c++example/c++. ps ► 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. html

Install Nachos ► Platform: Cygwin Linux , Linux over VMware or § Install steps

Install Nachos ► Platform: Cygwin Linux , Linux over VMware or § 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 ►Untar Nachos-4. 0 § tar zxvf. /nachos-4. 0. tar. gz

Install Nachos (cont. ) ►Make Nachos-4. 0 § cd. /nachos-4. 0/code § make ►Test

Install Nachos (cont. ) ►Make Nachos-4. 0 § cd. /nachos-4. 0/code § make ►Test if installation is succeeded § cd. /userprog §. /nachos –e. . /test 1 ►You should see the following…

You should see Total threads number is 1 Thread. . /test 1 is executing.

You should see Total threads number is 1 Thread. . /test 1 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

Operate Nachos ► Nachos command help §. /nachos -h ► Debugging mode §. /nachos

Operate Nachos ► Nachos command help §. /nachos -h ► Debugging mode §. /nachos -s ► Execute files on Nachos §. /nachos –e. . /test 1

Recompile Modified Nachos Code ► cd nachos-4. 0/code ► make clean (optional) ► make

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 recompile the modified and related files. (save time)

Assignment 1 ► Go to nachos-4. 0/code/userprog and type “. /nachos –e. . /test

Assignment 1 ► Go to nachos-4. 0/code/userprog and type “. /nachos –e. . /test 1 –e. . /test 2” Total threads number is 2 Thread. . /test 1 is executing. Thread. . /test 2 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

Print integer: 8 Print integer: 9 Print integer: 10 Print integer: 12 Print integer:

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: 17 Print integer: 18 Print integer: 19 Print integer: 20 Print integer: 21 Print integer: 23 Print integer: 24 Print integer: 25

return value: 0 Print integer: 26 return value: 0 No threads ready or runnable,

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 1. c” and “. . /test 2. c”

Assignment 1 ► Please trace the following files to see why the output results

Assignment 1 ► 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 ► Please modified the Nachos code to run the correct results. §

Assignment 1 ► 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 § init. Register § Load

Deadline ► 4/9 Friday 6: 00 ► Please tar your code and e-mail to

Deadline ► 4/9 Friday 6: 00 ► Please tar your code and e-mail to r 92921076@ntu. edu. tw entitled as your_student_ID. tar. gz ► make clean ► tar zcvf r 92921076. 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: parts your handout files must contain two § 1. modified

Grading policy ► Note: parts your handout files must contain two § 1. modified nachos source code (ID. tar. gz) § 2. report ► Correct result 30% ► Report 70% ► Contact me if you have any problems § r 92921076@ntu. edu. tw 電二 219