📄 readme
字号:
Nachos for Java READMEWelcome to Nachos for Java. We believe that working in Java rather thanC++ will greatly simplify the development process by preventing bugsarising from memory management errors, and improving debugging support.Getting Nachos:Download nachos-java.tar.gz from the Projects section of the classhomepage at: http://www-inst.EECS.Berkeley.EDU/~cs162/Unpack it with these commands: zcat nachos-java.tar.gz | tar xf -Additional software:Nachos requires the Java Devlopment Kit, version 1.2 or later. This isinstalled on all instructional machines in: /usr/sww/lang/jdk-1.2.2To use this version of the JDK, be sure that /usr/sww/lang/jdk-1.2.2/binis on your PATH. (This should be the case for all class accountsalready.)If you are working at home, you will need to download the JDK. It is available from: http://java.sun.com/j2se/1.3/Please DO NOT DOWNLOAD the JDK into your class account! Use thepreinstalled version instead.The build process for Nachos relies on GNU make. If you are running onone of the instructional machines, be sure you run 'gmake', as 'make'does not support all the features used. If you are running Linux, thetwo are equivalent. If you are running Windows, you will need to download and install a port. The most popular is the Cygnus toolkit, available at: http://sources.redhat.com/cygwin/mirrors.htmlThe Cygnus package includes ports of most common GNU utilities toWindows. For project 2, you will need a MIPS cross compiler, which is aspecially compiled GCC which will run on one architecture (e.g.Sparc) and produce files for the MIPS processor. These compilersare already installed on the instructional machines, and areavailable in the directory specified by the $ARCHDIR environmentvariable.If you are working at home, you will need to get a cross-compilerfor yourself. Cross-compilers for Linux and Win32 will be available from the CS162 Projects web page. Download the cross compilerdistribution and unpack it with the following command: zcat mips-x86-linux-xgcc.tar.gz | tar xf -(Substitute the appropriate file name for mips-x86.linux-xgcc in theabove command.) You need to add the mips-x86.linux-xgcc directory to your PATH, and set an environment variable ARCHDIR to point to this directory. (Again, this has already been done for you on theinstructional machines.) Compiling Nachos:You should now have a directory called nachos, containing a Makefile,this README, and a number of subdirectories. First, put the 'nachos/bin' directory on your PATH. This directorycontains the script 'nachos', which simply runs the Nachos code.To compile Nachos, go to the subdirectory for the project you wish to compile (I will assume 'proj1/' for Project 1 in my examples), and run: gmakeThis will compile those portions of Nachos which are relevant to theproject, and place the compiled .class files in the proj1/nachosdirectory. You can now test Nachos from the proj1/ directory with: nachosYou should see output resembling the following: nachos 5.0j initializing... config interrupt timer elevators user-check grader *** thread 0 looped 0 times *** thread 1 looped 0 times *** thread 0 looped 1 times *** thread 1 looped 1 times *** thread 0 looped 2 times *** thread 1 looped 2 times *** thread 0 looped 3 times *** thread 1 looped 3 times *** thread 0 looped 4 times *** thread 1 looped 4 times Machine halting! Ticks: total 24750, kernel 24750, user 0 Disk I/O: reads 0, writes 0 Console I/O: reads 0, writes 0 Paging: page faults 0, TLB misses 0 Network I/O: received 0, sent 0This is the correct output for the "bare bones" Nachos, without any ofthe features you will add during the projects.If you are working on a project which runs user programs (projects 2-4), you will also need to compile the MIPS test programs with: gmake testCommand Line Arguments:For a summary of the command line arguments, run: nachos -hThe commands are: -d <debug flags> Enable some debug flags, e.g. -d ti -h Print this help message. -s <seed> Specify the seed for the random number generator -x <program> Specify a program that UserKernel.run() should execute, instead of the value of the configuration variable Kernel.shellProgram -z print the copyright message -- <grader class> Specify an autograder class to use, instead of nachos.ag.AutoGrader -# <grader arguments> Specify the argument string to pass to the autograder. -[] <config file> Specifiy a config file to use, instead of nachos.confNachos offers the following debug flags: c: COFF loader info i: HW interrupt controller info p: processor info m: disassembly M: more disassembly t: thread info a: process info (formerly "address space", hence a) To use multiple debug flags, clump them all together. For example, tomonitor coff info and process info, run: nachos -d acnachos.conf:When Nachos starts, it reads in nachos.conf from the currentdirectory. It contains a bunch of keys and values, in the simpleformat "key = value" with one key/value pair per line. To change thedefault schedular, default shell program, to change the amount ofmemory the simulator provides, or to reduce network reliability, modifythis file.Machine.stubFileSystem: Specifies whether the machine should provide a stub file system. A stub file system just provides direct access to the test directory. Since we're not doing the file system project, this should always be true.Machine.processor: Specifies whether the machine should provide a MIPS processor. In the first project, we only run kernel code, so this is false. In the other projects it should be true.Machine.console: Specifies whether the machine should provide a console. Again, the first project doesn't need it, but the rest of them do.Machine.disk: Specifies whether the machine should provide a simulated disk. No file system project, so this should always be false.ElevatorBank.allowElevatorGUI: Normally true. When we grade, this will be false, to prevent malicious students from running a GUI during grading.NachosSecurityManager.fullySecure: Normally false. When we grade, this will be true, to enable additional security checks.Kernel.kernel: Specifies what kernel class to dynmically load. For proj1, this is nachos.threads.ThreadedKernel. For proj2, this should be nachos.userprog.UserKernel. For proj3, nachos.vm.VMKernel. For proj4, nachos.network.NetKernel.Processor.usingTLB: Specifies whether the MIPS processor provides a page table interface or a TLB interface. In page table mode (proj2), the processor accesses an arbitrarily large kernel data structure to do address translation. In TLB mode (proj3 and proj4), the processor maintains a small TLB (4 entries).Processor.numPhysPages: The number of pages of physical memory. Each page is 1K. This is normally 64, but we can lower it in proj3 to see whether projects thrash or crash.Documentation:The JDK provides a command to create a set of HTML pages showing allclasses and methods in program. We will make these pages available onthe webpage, but you can create your own for your home machine by doingthe following (from the nachos/ directory): mkdir ../doc gmake docTroubleshooting:If you receive an error about "class not found exception", it may bebecause you have not set the CLASSPATH environment variable. Add thefollowing to your .cshrc: setenv CLASSPATH .Credits:Nachos was originally written by Wayne A. Christopher, Steven J.Procter, and Thomas E. Anderson. It incorporates the SPIM simulatorwritten by John Ousterhout. Nachos was rewritten in Java by DanielHettena.Copyright:Copyright (c) 1992-2001 The Regents of the University of California.All rights reserved.Permission to use, copy, modify, and distribute this software and itsdocumentation for any purpose, without fee, and without writtenagreement is hereby granted, provided that the above copyright noticeand the following two paragraphs appear in all copies of thissoftware.IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTYFOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGESARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IFTHE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OFSUCH DAMAGE.THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OFMERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWAREPROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OFCALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,ENHANCEMENTS, OR MODIFICATIONS.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -