NachOS-MP1
Lecturer: Jerry Chou
TA: Cake, Vincent
National Tsing Hua University
Grading
Program correctness Demo (on Server)
console I/O 20%, file I/O 40%
Work item 1: tracing system call 25%
save it as a PDF
explain how system calls go through NachOS in detail
Work item 2: report 15%
explain your work (modifications of the code, team member contribution, )
Deadline: 2015/10/18(Sunday) 23:59, penalty for late submission
You can discuss, but do not copy. 0 will be given to cheaters.
Assignment Part II
You should NOT use standard library IO functions in any part of Nachos
e.g. open(), close(), read(), write(), fread(), fwrite(),
A successful run of fileIO_test1 will generate an file file1.test
content in file1.test
Assignment Part II
A successful run of fileIO_test2 should look like this
You will get a ^_^ mark if you pass the test
Disk I/O remains 0 , since we are now using LINUX backed file system
We will implement it in MP4, coming sooooooon~
Assignment Part II
For second part, you have to implement four file I/O system call
OpenFileId Open(char *name);
open a file with the name and return its fileId
int Write(char *buffer, int size, OpenFileId id);
write size characters from buffer into the file
return number of characters actually written to the file
int Read(char *buffer, int size, OpenFileId id);
read size characters from the file and copy them into buffer
return number of characters actually read from the file
int Close(OpenFileId id);
return 1 if successfully close the file, 0 otherwise
Hint part II
Trace how Create() system call works, this will help you a lot.
Return value is important!!!
Files to modify
userprog/syscall.h, exception.cc, ksyscall.h
machine/console, interrupt
filesys/filesys, openfile
threads/kernel
You can not directly use the pointer of a user program, remember to
translate it before using them in kernel!!!
FAQ
Q1: cannot login or cannot connect to server
A1: Please contact TA, do not try to guess your password by brute force.
(We may ban your IP for safety issues)
Q2: xxx: permission denied
A2: change the target program permission via command chmod
e.g. >chmod 775 ./my_program
FAQ
Q3: I modified code in nachos, but nothing seems changed?
A3: Be sure you do not get any errors during make. (You can ignore
warning messages) And always remember to make after you
modify anything in Nachos.
Q4. How do I create my testing program?
A4. Please modify the provided testing files and make, or you can learn
how to write/modify a makefile. Do not compile your testing code with
gcc, this will make the binary unrunnable on Nachos!!!
FAQ
Q5: My process got stuck, how do I escape?
A5: press [ctrl] + C to kill the process.
Q6: Do TAs help debug my Nachos?
A6: No, we only discuss concept with you. You can still ask questions
about weird error messages.
If you have other questions, feel free to ask on iLMS.
Reference
Linux command
http://linux.vbird.org/linux_basic/0220filemanager.php
vim command
http://linux.vbird.org/linux_basic/0310vi.php
NachOS
http://homes.cs.washington.edu/~tom/nachos/