<style>
.reveal .slides {
text-align: left;
}
</style>
### 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
* <span style="color:red;">Process management</span>
* <span style="color:red;">CPU scheduling</span>
* <span style="color:red;">Memory management</span>
* 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 <span style="color: red;">32-bit</span> instead of 64-bit
* Nachos4.0 said to support 64-bits but not been completely tested
* Recommended choice:
* 32-bit Ubuntu 14.04
---
### Environment
![](https://i.imgur.com/Uy1BJ0C.png)
---
### NachOS Software Structure
![](https://i.imgur.com/bslYvc7.png)
---
### Download & Install VirtualBox
* Oracle VM VirtualBox
* https://www.virtualbox.org/
* Download 32-bit Ubuntu 14.04
* http://releases.ubuntu.com/14.04/
---
### Setup
Install g++ and csh
```shell=
sudo apt-get install g++
sudo apt-get install csh
sudo apt-get install make
```
Download NachOS & Cross Compiler
```shell=
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**
```shell=
tar -xvf nachos-4.0.tar.gz
```
move **mips-x86.linux-xgcc.tar.gz** to root and untar
```shell=
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
```shell=
cd ~/nachos-4.0/code
make
```
---
### Test
```shell=
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...
```shell=
./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
```shell=
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%)
* <span style="color: red;">No plagiarism</span>
---
### 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
* [General Nachos Documentation](https://homes.cs.washington.edu/~tom/nachos/)
* [Wiki - Not Another Completely Heuristic Operating System](https://en.wikipedia.org/wiki/Not_Another_Completely_Heuristic_Operating_System)
* [A Road Map Through Nachos](https://users.cs.duke.edu/~narten/110/nachos/main/main.html)
* [University of Pittsburgh - NachOS](https://people.cs.pitt.edu/~manas/courses/CS1550/nachos.htm)
---
### 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`
{"metaMigratedAt":"2023-06-15T13:42:50.998Z","metaMigratedFrom":"YAML","title":"Nachos Overview & Project 1 - Thread Management","breaks":true,"slideOptions":"{\"theme\":\"sky\",\"transition\":\"fade\",\"spotlight\":{\"enabled\":false}}","contributors":"[{\"id\":\"afcdd5ec-1606-418a-8aeb-f4458cbd2f6c\",\"add\":6328,\"del\":719}]"}