edu.jhu.cnds.Frugal
Interface FrugalResource

All Known Subinterfaces:
FrugalResourceRemote

public interface FrugalResource
extends java.io.Serializable

General interface for a Frugal Resource, capable of performing work for the caller. It does not offer leases, as it yields control to the caller's code.

Version:
2.0
Author:
R. Sean Borgstrom

Method Summary
 long currentFreeMemory()
          Provides information used to calculate the cost to use this resource.
 long currentSpeed()
          Provides information used to calculate the cost to use this resource.
 long currentUsedMemory()
          Provides information used to calculate the cost to use this resource.
 void exit()
          Exits the VM.
 double globalMaxLoad()
          Provides information to the CostBean.
 long globalMaxSpeed()
          Provides information to the CostBean.
 void inform(long machines, double globalMax, long globalMaxSpeed)
          Receives information on global state.
 long machineCount()
          Provides information to the CostBean.
 double maxLoad()
          Provides information used to calculate the cost to use this resource.
 long maxSpeed()
          Provides information used to calculate the cost to use this resource.
 long minSpeed()
          Provides information used to calculate the cost to use this resource.
 java.lang.Object[] run(Projectable submittedClass, java.lang.Object[] argv)
          Performs work for a remote class.
 void startTesting()
          Spawns a thread that tests the speed of the system where this Frugal Resource is executing, performing calculations for 1 second in every 30.
 long totalMemory()
          Provides information used to calculate the cost to use this resource.
 

Method Detail

run

public java.lang.Object[] run(Projectable submittedClass,
                              java.lang.Object[] argv)
                       throws java.rmi.RemoteException
Performs work for a remote class.
Parameters:
submittedClass - A class containing the code for the work it should do. The Frugal Resource will invoke its 'main' method with the given arguments.
argv - Arguments to that class.
Returns:
The array of Objects returned by that class' 'main' method.

exit

public void exit()
          throws java.rmi.RemoteException
Exits the VM.

inform

public void inform(long machines,
                   double globalMax,
                   long globalMaxSpeed)
            throws java.rmi.RemoteException
Receives information on global state.
Parameters:
machines - The number of Frugal Resources in the system.
globalMax - The highest load seen, globally, rounded to the next highest integral power of 2.
globalMaxSpeed - The highest speed seen, globally.

globalMaxLoad

public double globalMaxLoad()
                     throws java.rmi.RemoteException
Provides information to the CostBean.
Returns:
A number this Frugal Resource thinks is the highest load seen on the system, rounded to the next highest integral power of 2.

globalMaxSpeed

public long globalMaxSpeed()
                    throws java.rmi.RemoteException
Provides information to the CostBean.
Returns:
The highest computational speed achieved by a Frugal Resource this Frugal Resource believes is currently available on the computing cluster.

machineCount

public long machineCount()
                  throws java.rmi.RemoteException
Provides information to the CostBean.
Returns:
The number of Frugal Resources this Frugal Resource believes are currently available on the computing cluster.

totalMemory

public long totalMemory()
                 throws java.rmi.RemoteException
Provides information used to calculate the cost to use this resource.
Returns:
Total memory assigned to the virtual machine where this Frugal Resource runs.

currentFreeMemory

public long currentFreeMemory()
                       throws java.rmi.RemoteException
Provides information used to calculate the cost to use this resource.
Returns:
Currently free memory on the virtual machine where this Frugal Resource runs.

currentUsedMemory

public long currentUsedMemory()
                       throws java.rmi.RemoteException
Provides information used to calculate the cost to use this resource.
Returns:
Currently used memory on the virtual machine where this Frugal Resource runs.

currentSpeed

public long currentSpeed()
                  throws java.rmi.RemoteException
Provides information used to calculate the cost to use this resource.
Returns:
The speed of the machine where this Frugal Resource runs, under the load conditions where its speed was last tested, using an abstract measure based on the number of calculations of a specific type performed per second.

maxSpeed

public long maxSpeed()
              throws java.rmi.RemoteException
Provides information used to calculate the cost to use this resource.
Returns:
The highest machine speed ever seen by this Frugal Resource, using the abstract measure described above.

minSpeed

public long minSpeed()
              throws java.rmi.RemoteException
Provides information used to calculate the cost to use this resource.
Returns:
The lowest machine speed ever seen by this Frugal Resource, using the abstract measure described above.

maxLoad

public double maxLoad()
               throws java.rmi.RemoteException
Provides information used to calculate the cost to use this resource.
Returns:
The highest load ever seen by this Frugal Resource, defined as the highest speed ever seen divided by the lowest speed ever seen.

startTesting

public void startTesting()
                  throws java.rmi.RemoteException
Spawns a thread that tests the speed of the system where this Frugal Resource is executing, performing calculations for 1 second in every 30.