Presentation is loading. Please wait.

Presentation is loading. Please wait.

Nachos Introduction CS342301 Operating System 2005.

Similar presentations


Presentation on theme: "Nachos Introduction CS342301 Operating System 2005."— Presentation transcript:

1 Nachos Introduction CS342301 Operating System 2005

2 What is Nachos? Nachos  Not Another Completely Heuristic Operating System  Developed by Tom Anderson and his students at UC Berkley http://www.cs.washington.edu/homes/tom/nachos/  An educational system used to teach kernel design and implementation

3 Why Nachos? Real hardware is difficult to handle Real kernel is too complicated to maintain Nachos  Use a MIPS virtual machine  Provide some basic OS elements

4 Nachos structure The Nachos kernel runs inside a process The simulator runs alongside the kernel inside a process The user program runs inside the simulator Machine (hardware) OS kernel User programs Simulated Nachos hardware Nachos kernel Nachos user program System calls Nachos system call

5 How to install Nachos? Copy files to your home directory  cp /tmp/nachos/nachos_4.0.tar.gz./ Extract files  tar -zxvf nachos_4.0.tar.gz Change directory  cd nachos-4.0/code Make files  make  You can ignore the warning messages  This step takes some time…please be patient

6 How to execute Nachos? There are several different directories in Nachos. You need to execute in different directories for different homework  cd threads/./nachos  cd userprog/./nachos

7 How to write your program Coding directly on the course machine  ssh 140.114.78.183 Free ssh tool on Windows: putty (or pputty)  Use vi to read and modify files  Use grep to search in files Coding in Windows environment  Your familiar editors AEdiX suite (free) / UltraEdit / VC++  Use ftp to download / upload files

8 How to debug your program Use the debug options of Nachos ./nachos –d +  Print all debug messages In case the output is too many to fit the screen ./nachos -d + 2>&1 > FileName

9 How to recompile your program completely If you want to recompile the whole programs completely  cd ~/nachos-4.0/code/ make clean make

10 Project 1: Multiprogramming Please execute the nachos under ~/nachos- 4.0/code/userprog directory  Nachos executes two programs: ~/nachos- 4.0/code/test/test1.c and test2.c  For some reasons, execute the two programs concurrently will cause some errors  Please modify the kernel code such that Nachos can execute the two programs concurrently  In this project, you don’t really need to make files under code directory, make file in userprog directory is okay cd ~/nachos-4.0/code/userprog make

11 Project 1: Multiprogramming (cont ’ ) Please trace the following code to figure out how Nachos decide which programs to execute  userprog/userkernel.cc  void UserProgKernel::Run() In this project, you can only modify the following code segments (you may not need to modify all of them):  Constructor of AddrSpace in userprog/addrspace.*  Destructor of AddrSpace in userprog/addrspace.*  AddrSpace::Load(char*) in userprog/addrspace.*  Destructor of UserProgKernel in userprog/userkernel.*  UserProgKernel::Initialize() in userprog/userkernel.* You may need to use “semaphore”, please refer:  thread/synch.*

12 How to submit your program Please make a new directory “hw1” in your home directory Please copy your addrspace.*, userkernel.* in this directory TA will run “build.sh” to compile your program You can copy build.sh from /tmp/nachos/build.sh to test if your program can compile and execute correctly

13 Some matters needing attention The source code has been modified by TA. Please don’t mix them with other versions Mail the school IDs and names of your group members (2~3 people) to TA  hhchen@vc.cs.nthu.edu.tw hhchen@vc.cs.nthu.edu.tw Please leave a copy of your codes in your own PC. Course machine is for coding and testing only. We do NOT guarantee the safety of your codes TA will provide you something you should know, but TA will NOT debug for you

14 Grading Correctness: 70% README file: 20% Programming style: 10%

15 Reference links Nachos official site  http://www.cs.washington.edu/homes/tom/nachos/ http://www.cs.washington.edu/homes/tom/nachos/ A road map through Nachos  http://www.cs.duke.edu/~narten/110/nachos/main/ main.html http://www.cs.duke.edu/~narten/110/nachos/main/ main.html A quick introduction to C++ written by Tom Anderson  http://www.cs.washington.edu/homes/tom/c++exa mple/c++.ps http://www.cs.washington.edu/homes/tom/c++exa mple/c++.ps


Download ppt "Nachos Introduction CS342301 Operating System 2005."

Similar presentations


Ads by Google