nachos.userprog
Class UserKernel

java.lang.Object
  extended by nachos.machine.Kernel
      extended by nachos.threads.ThreadedKernel
          extended by nachos.userprog.UserKernel
Direct Known Subclasses:
VMKernel

public class UserKernel
extends ThreadedKernel

A kernel that can support multiple user processes.


Field Summary
static SynchConsole console
          Globally accessible reference to the synchronized console.
 
Fields inherited from class nachos.threads.ThreadedKernel
alarm, fileSystem, scheduler
 
Fields inherited from class nachos.machine.Kernel
kernel
 
Constructor Summary
UserKernel()
          Allocate a new user kernel.
 
Method Summary
static UserProcess currentProcess()
          Returns the current process.
 void exceptionHandler()
          The exception handler.
 void initialize(String[] args)
          Initialize this kernel.
 void run()
          Start running user programs, by creating a process and running a shell program in it.
 void selfTest()
          Test the console device.
 void terminate()
          Terminate this kernel.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

console

public static SynchConsole console
Globally accessible reference to the synchronized console.

Constructor Detail

UserKernel

public UserKernel()
Allocate a new user kernel.

Method Detail

initialize

public void initialize(String[] args)
Initialize this kernel. Creates a synchronized console and sets the processor's exception handler.

Overrides:
initialize in class ThreadedKernel

selfTest

public void selfTest()
Test the console device.

Overrides:
selfTest in class ThreadedKernel

currentProcess

public static UserProcess currentProcess()
Returns the current process.

Returns:
the current process, or null if no process is current.

exceptionHandler

public void exceptionHandler()
The exception handler. This handler is called by the processor whenever a user instruction causes a processor exception.

When the exception handler is invoked, interrupts are enabled, and the processor's cause register contains an integer identifying the cause of the exception (see the exceptionZZZ constants in the Processor class). If the exception involves a bad virtual address (e.g. page fault, TLB miss, read-only, bus error, or address error), the processor's BadVAddr register identifies the virtual address that caused the exception.


run

public void run()
Start running user programs, by creating a process and running a shell program in it. The name of the shell program it must run is returned by Machine.getShellProgramName().

Overrides:
run in class ThreadedKernel
See Also:
Machine.getShellProgramName()

terminate

public void terminate()
Terminate this kernel. Never returns.

Overrides:
terminate in class ThreadedKernel