nachos.userprog
Class UserKernel
java.lang.Object
|
+--nachos.machine.Kernel
|
+--nachos.threads.ThreadedKernel
|
+--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. |
Constructor Summary |
UserKernel()
Allocate a new user kernel. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
console
public static SynchConsole console
- Globally accessible reference to the synchronized console.
UserKernel
public UserKernel()
- Allocate a new user kernel.
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