nachos projects overview and project 1 ta : 吳哲榮 2010/10/21

24
Nachos Projects Overview and Project 1 TA : 吳吳吳 2010/10/21

Upload: joseph-wheeler

Post on 12-Jan-2016

221 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Nachos Projects Overview and Project 1 TA : 吳哲榮 2010/10/21

Nachos Projects Overview and Project 1

TA : 吳哲榮2010/10/21

Page 2: Nachos Projects Overview and Project 1 TA : 吳哲榮 2010/10/21

Outline

What’s Nachos? Why do we use Nachos? Nachos Project Overview Nachos installation Nachos Assignment 1 Reference

Page 3: Nachos Projects Overview and Project 1 TA : 吳哲榮 2010/10/21

What’s Nachos?

Nachos Not Another Completely Heuristic Operating System

Developed by Tom Anderson and his students at UC, Berkeley. http://www.cs.washington.edu/homes/tom/nachos/

Page 4: Nachos Projects Overview and Project 1 TA : 吳哲榮 2010/10/21

What’s Nachos?

Nachos is an instrumental software that allows students to study and modify a “real” operating system.

The only difference between Nachos and a real operating system is that Nachos runs a Unix process, whereas a real operating system runs on a real machine.

Page 5: Nachos Projects Overview and Project 1 TA : 吳哲榮 2010/10/21

What’s Nachos?

Nachos simulates a MIPS machine (MIPS R2/3000) on the host system (Unix, Linux, etc.)

Conceptually, Nachos has two modes of execution, namely, MIPS simulator and Nachos “kernel”

Reference : http://course.cs.ust.hk/comp252/web07fall/Lab1/Nachos%20architecture/nachos.ps

Page 6: Nachos Projects Overview and Project 1 TA : 吳哲榮 2010/10/21

Why do we use Nachos?

For understanding operating system concepts, nothing is better than building an operating system.

Nachos is simpler than UNIX. Simulator makes debugging easier.

Deterministic

Page 7: Nachos Projects Overview and Project 1 TA : 吳哲榮 2010/10/21

Nachos Project Overview

The project for this course is to build an operating system for scratch. The project contains four phases, corresponding to each of the major pieces of a modern OS. Multiprogramming Thread management File Systems and Virtual Memory Networking

Page 8: Nachos Projects Overview and Project 1 TA : 吳哲榮 2010/10/21

Nachos Installation

Platforms you may use Unix, Linux, Linux over VMware, or Cygwin.

Environment Checking g++ version

g++ -v Both g++ 3.3.3 or g++ 3.2.2 are ok. If your current gcc version is 4.x.x version, you

should install the gcc 3.4.6 version. The gcc 3.4.6 version is the watershed.

Page 9: Nachos Projects Overview and Project 1 TA : 吳哲榮 2010/10/21

Nachos Installation

Download the gcc source code.http://ftp.twaren.net/Unix/GNU/gnu/gcc/

The following command is the installing flow. # wget http://ftp.twaren.net/Unix/GNU/gnu/gcc/gcc-3.3.3/ gcc-3.3.3.tar.gz# tar zxvf gcc-3.3.3.tar.gz# mkdir gcc-build# cd gcc-build/# ../gcc-3.3.3/configure --prefix=/usr/local/gcc-3.3.3 --enable-threads=posix --disable-checking --enable--long-long --host=i386-redhat-linux --with-system-zlib --enable-languages=c,c++,java# make# make install# export PATH=/usr/local/gcc-3.3.3/bin/:$PATHAdd the new gcc path to the current command searching path.# export LD_LIBRARY_PATH=/usr/local/gcc-3.3.3/lib/:$LD_LIBRARY_PATHAdd the related library to the current library searching path.

Page 10: Nachos Projects Overview and Project 1 TA : 吳哲榮 2010/10/21

Nachos Installation

Get Nachos-4.0 http://cc.ee.ntu.edu.tw/~farn/courses/OS2010/nachos/nachos-4.0

.tar.gz

Get Cross Compiler http://cc.ee.ntu.edu.tw/~farn/courses/OS2010/nachos/mips-

decstation.linux-xgcc.tgz

Move Cross Compiler to / mv ./mips-decstation.linux-xgcc.tgz /

Untar Cross Compiler cd / tar zxvf mips-decstation.linux-xgcc.tgz

Page 11: Nachos Projects Overview and Project 1 TA : 吳哲榮 2010/10/21

Nachos Installation

Untar Nachos tar zxvf nachos-4.0.tar.gz

Make Nachos-4.0 cd ./nachos-4.0/code make

Test cd ./userprog ./nachos –e ../test/test1 ./nachos –e ../test/test2

Page 12: Nachos Projects Overview and Project 1 TA : 吳哲榮 2010/10/21

Nachos Installation

You should see the result of test1

Page 13: Nachos Projects Overview and Project 1 TA : 吳哲榮 2010/10/21

Nachos Installation

You should see the result of test2

Page 14: Nachos Projects Overview and Project 1 TA : 吳哲榮 2010/10/21

Some Important Things

Nachos arguments Help

./nachos –h Debugging Mode

./nachos –s Execute files

./nachos –e [file_name]

Recompilation of modified nachos code cd nachos-4.0/code make clean (optional) make

Page 15: Nachos Projects Overview and Project 1 TA : 吳哲榮 2010/10/21

Nachos Assignment 1

Abstract The assignment is to support multiprogramming. We give

some of the code you need, and you have to complete the system.

Try execute two programs at the same time on Nachos

cd ./userprog ./nachos –e ../test/test1 –e ../test/test2 you should see the following result.

Page 16: Nachos Projects Overview and Project 1 TA : 吳哲榮 2010/10/21

Result of simultaneously execution 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 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

Page 17: Nachos Projects Overview and Project 1 TA : 吳哲榮 2010/10/21

Result of simultaneously execution 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 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

Why the output result of executing two program simultaneously differsfrom the result of executing two programs separately?

Page 18: Nachos Projects Overview and Project 1 TA : 吳哲榮 2010/10/21

Why should you do?

Trace Nachos Read *.h and *.cc to understand the whole system

and see how it is implemented. You might use some documentations to help

yourself understand the system. A Road Map Through Nachos

http://cc.ee.ntu.edu.tw/~farn/courses/OS2010/ref/Nachos%20Road%20Map.pdf

Trace for NachoOS-4.0 with GLOBAL http://cc.ee.ntu.edu.tw/~farn/courses/OS2010/nachos/HTML/index.html

Page 19: Nachos Projects Overview and Project 1 TA : 吳哲榮 2010/10/21

Hints

To know why the result is wrong, you may trace the following files. 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

Page 20: Nachos Projects Overview and Project 1 TA : 吳哲榮 2010/10/21

Hints

You have to modify the Nachos code to achieve the correct result.

You may try to modify the following functions nachos-4.0/code/userprog/addrspace.cc

constructor destructor initRegister Load

Page 21: Nachos Projects Overview and Project 1 TA : 吳哲榮 2010/10/21

Assignment Requirements

2 person per team Assignment Report (11/18 on the class)

Prepare a presentation about the following topics: Why the result is not congruent with expected How you modified Nachos to make it support

multiprogramming – important code segments Everything you consider important

Page 22: Nachos Projects Overview and Project 1 TA : 吳哲榮 2010/10/21

Hand in your reports.

Please compress the following in a .zip. modified source code(s) with path presentation power-point final report

E-mail your .zip (project1_b99901000_b99901001.zip) to TA.

Deadline: 2010/11/18 23:59

Page 23: Nachos Projects Overview and Project 1 TA : 吳哲榮 2010/10/21

Grading Policy

Progress Report 20% Correct Result 30% Report 50%

Page 24: Nachos Projects Overview and Project 1 TA : 吳哲榮 2010/10/21

Reference

Author’s Web Page http://www.cs.washington.edu/homes/tom/nachos/

Thomas Narten's Nachos Roadmap http://www.cs.duke.edu/~narten/110/nachos/main/main.html