1 / 12

Instructions to Project 2

Instructions to Project 2. Tingxin Yan 3/9/2011. Goal of the project. Previous project Implemented some kernel functions of an OS. This project provide Nachos with support for multi-programming at the user level.

armen
Download Presentation

Instructions to Project 2

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Instructions to Project 2 Tingxin Yan 3/9/2011

  2. Goal of the project • Previous project • Implemented some kernel functions of an OS. • This project • provide Nachos with support for multi-programming at the user level. • allow user-level programs to access some of kernel routines via system calls. • Example: A Terminal.

  3. Steps • Install MIPS Cross-compiler for Nachos. • Read and understand the part of the system that has been written for you. • Write your own implementations and test cases.

  4. Install MIPS Cross-compiler • Supported OS: • Windows+Cygwin • Linux • MacOS(PPC) (Sorry new Macbook Pros…) • You can build your own…

  5. Install MIPS Cross-compiler • Download mips cross-compiler tar ball. • Unzip to your destination directory • Say, /home/XYZ/mips-xgcc • Setup environment export ARCHDIR=/home/XYZ/mips-xgcc export PATH=$ARCHDIR:$PATH • Edit .bashrc (or .bash_profile) to make effect.

  6. Test if MIPS Cross-compiler is working • Under nachos/test • Type make • Undernachos/proj2 • Type make • Type ../bin/nachos

  7. Understand the System • nachos.userprog package • UserKernel.java - a multiprogramming kernel. • Similar to ThreadedKernel.javain threads. • UserProcess.java - a user process; manages the address space, and loads a program into virtual memory. • UThread.java - a thread capable of executing user MIPS code. • SynchConsole.java - a synchronized console; makes it possible to share the machine's serial console among multiple threads.

  8. Understand the System • a few additional machine simulation classes that get used • machine.Processor.java: simulate a MIPS processor. • machine.SerialConsole.java: simulate a serial console for keyboard input and text output. • machine.FileSystem.java: a file system interface. This file system accesses files in the test directory.

  9. User Programs • Under nachos/test • C programs. • You need to write your test cases in C. • Compiled to .coff binaries, which are real Nachos user programs.

  10. Running Process of a User Program • Source files (*.c) are compiled into object files (*.o) by mips-gcc. • Some of the object files are linked into libnachos.a, the Nachos standard library. • start.s is preprocessed and assembled into start.o. This file contains the assembly-language code to initialize a process. It also provides the system call "stub code" which allows system calls to be invoked. This makes use of the special MIPS instruction syscall which traps to the Nachos kernel to invoke a system call. • An object file is linked with libnachos.a to produce a Nachos-compatible MIPS binary, which has the extension *.coff. (COFF stands for Common Object File Format and is an industry-standard binary format which the Nachos kernel understands.)

  11. What you need to do • Implement file system calls • create, open, read, write, close, and unlink • Implement support for multiprogramming • Now one user program at a time. • Implement some other system calls • exec, join, and exit

  12. What you need to do • Modify nachos.userprog package. • UserProcess.java+ UserKernel.java • Add test cases in nachos.test • The easiest way to compile your own test cases is to add it to the Makefile in the test directory in the line: TARGETS = halt shmatmalt sort echo cat cp mvrm #chat chatserver • Run user programs • Under proj2, type nachos –x [PROGNAME].coff

More Related