Nachos Overview & Project 1 - Thread Management


Outline

  • Introduction of Nachos
  • Installation of Nachos
  • Project 1 – Thread Management
  • Report & Policy
  • Presentation Details

Introduction of Nachos


What Is Nachos?

  • Designed by Thomas Anderson at UC Berkeley in 1992
  • Written in C++, has JAVA version
    • We use the C++ version here
  • Educational OS that some components can be implemented by users
    • Process management
    • CPU scheduling
    • Memory management
    • File system management
    • Networking

What Is Nachos? (Cont.)

  • Nachos is just a UNIX process runs on real OS
  • Nachos uses simple MIPS R2/3000 instructions
  • Turn program to MIPS binary code

Installation of Nachos

Linux only


Linux Machine Only

  • Theoretically, You can use any Linux distribution as your platform

    • Ubuntu, Fedora, Debian
    • Remember to use 32-bit instead of 64-bit
      • Nachos4.0 said to support 64-bits but not been completely tested
  • Recommended choice:

    • 32-bit Ubuntu 14.04

Environment


NachOS Software Structure


Download & Install VirtualBox


Setup

Install g++ and csh

sudo apt-get install g++ sudo apt-get install csh sudo apt-get install make

Download NachOS & Cross Compiler

wget -d http://cc.ee.ntu.edu.tw/~farn/courses/OS/OS2015/projects/project.1/nachos-4.0.tar.gz wget -d http://cc.ee.ntu.edu.tw/~farn/courses/OS/OS2015/projects/project.1/mips-x86.linux-xgcc.tar.gz

Install NachOS

untar nachos-4.0.tar.gz

tar -xvf nachos-4.0.tar.gz

move mips-x86.linux-xgcc.tar.gz to root and untar

sudo mv mips-x86.linux-xgcc.tar.gz / cd / sudo tar -zxvf mips-x86.linux-xgcc.tar.gz

Install NachOS (Cont.)

Change Directory of Cross Compiler

editing file "~/nachos-4.0/code/test/Makefile"
...
GCCDIR = /mips-x86.linux-xgcc/
...
CPP = /mips-x86.linux-xgcc/cpp0
...
CFLAGS = -G 0 -c $(INCDIR) -B/mips-x86.linux-xgcc/
...

Install NachOS (Cont.)

Make NachOS-4.0

cd ~/nachos-4.0/code make

Test

cd ./userprog ./nachos -e ../test/test1
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

Project 1

Thread Management


Issue to be solved

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

Report & Policy

Report contents, grading policy, late policy


Report

  1. Motivation
    • Motivation and the problem analysis
    • What’s your plan to deal with the problem
  2. Implementation
    • How do you implement to solve the problem in Nachos
    • You can including some (not all) important code segments and comments
  3. Result
    • Experiment result and some discussion
    • Extra effort or observation

Submission


Create a folder for the source code and report

{Student ID}_Nachos1/
  |_ nachos-4.0/
  |_ report.pdf

// Name the folder w/o curly braces, e.g. r07943154_Nachos1

Compress

tar -zcvf {Student ID}_Nachos1.tar.gz ./{Student ID}_Nachos1

Your source code and report should be handed out by Ceiba


Grading Policy

  • Nachos source code: (40%)
  • Report: (40%)
  • Correct format: (20%)
  • No plagiarism

Late Policy

  • 10% penalty per day
  • After 7 days, you will get 70% penalty, but no more penalty after that.

Some tips for Nachos

  • Design before coding.
    • Better create your own test program to get the idea.
  • Trace before coding.
    • Some IDE or text editor is useful if you are not a professional vim/emac user.
  • Google is your best friend.

Reference


Presentation Details

  • What’s your contribution to this project.
  • Not necessary to make PPT.
    • You can just use your report and source code to present.
  • The main point is…
    • Problem analysis and what’s you plan to solve it.
    • What you do with this project.
    • Extra observation.

tags: Fall 2020 OS
Select a repo