autohit.server
Class Kernel

java.lang.Object
  extended byautohit.server.Kernel

public class Kernel
extends java.lang.Object

Process kernel. This is a basic kernel. It does not run in a monitor process. It does not route commands or events.

Version:
1.0 Version History EPG - Initial - 17May03
EPG - Support new VMProcess scheme - 25Jul03
EPG - Switch PCB table to a Vector - 28Jul03
Author:
Erich P. Gatejen

Field Summary
static int nextpid
          The next pid to get.
static int PROCESS_CLEAN_THRESHOLD
           
 
Constructor Summary
Kernel()
          Default constructor
 
Method Summary
protected  void finalize()
          finalizer We will kill all the processors to make sure nothing ghosts.
 VMProcess get()
          Get a usable process.
 VMProcess get(java.lang.String processImpl)
          Get a usable process.
 VMProcess getProcess(int pid)
          Get a process by pid.
 java.util.List getProcessList()
          Get an list of active processes.
 void init(SystemContext c)
          Initialize.
 void scrubTable()
          Force the PCB table to clean
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nextpid

public static int nextpid
The next pid to get. One instance per jvm. Leaving it public in care there needs to be some segmentation voodoo in the server.


PROCESS_CLEAN_THRESHOLD

public static final int PROCESS_CLEAN_THRESHOLD
See Also:
Constant Field Values
Constructor Detail

Kernel

public Kernel()
Default constructor

Method Detail

init

public void init(SystemContext c)
Initialize. It might be a bad idea to call this more than once, since it could ghost a number of processes.

Parameters:
c - is an instance of SystemContext
See Also:
SystemContext

get

public VMProcess get()
Get a usable process. Create it if neccesssary. It will instantiate a default VMProcess implementation.

Returns:
a VMProcess or null if failed

get

public VMProcess get(java.lang.String processImpl)
Get a usable process. Create it if neccesssary.

Parameters:
processImpl - class name for process implementation
Returns:
a VMProcess or null if failed

getProcessList

public java.util.List getProcessList()
Get an list of active processes. This will take a snapshot of the process list as a List of VMProcesses. BEWARE! Processes are very volatile. Their state can change at any time. It is quite possible that the VMProcess can go bad after you get the list. Also, be extra sure not to keep any references to a VMProcess for very long. The Kernel won't like this.

Returns:
A List of VMProcesses (it may be empty)

getProcess

public VMProcess getProcess(int pid)
Get a process by pid. it will return null if it isn't found.

Parameters:
pid - the pid to get.
Returns:
A VMProcess or null if not found.

scrubTable

public void scrubTable()
Force the PCB table to clean


finalize

protected void finalize()
                 throws java.lang.Throwable
finalizer We will kill all the processors to make sure nothing ghosts. Why? It is possible that other objects will hold references to the VMProcess, so will kill them here.

Throws:
java.lang.Throwable


Test.