gridsim
Class SpaceShared

Object
  extended byThread
      extended byeduni.simjava.Sim_entity
          extended bygridsim.AllocPolicy
              extended bygridsim.SpaceShared
All Implemented Interfaces:
Cloneable, Runnable

class SpaceShared
extends AllocPolicy

SpaceShared class is an allocation policy for GridResource that behaves exactly like First Come First Serve (FCFS).

Version:
2.2, December 2003
Author:
Manzur Murshed and Rajkumar Buyya
See Also:
GridSim, ResourceCharacteristics
Invariant:
$none

Field Summary
 
Fields inherited from class gridsim.AllocPolicy
myId_, outputPort_, resCalendar_, resId_, resName_, resource_, totalPE_
 
Fields inherited from class eduni.simjava.Sim_entity
 
Fields inherited from class Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
(package private) SpaceShared(String resourceName, String entityName)
          Allocates a new SpaceShared object
 
Method Summary
 void body()
          Handles internal events that are coming to this entity.
 void gridletCancel(int gridletId, int userId)
          Cancels a Gridlet running in this entity.
 void gridletMove(int gridletId, int userId, int destId, boolean ack)
          Moves a Gridlet from this GridResource entity to a different one.
 void gridletPause(int gridletId, int userId, boolean ack)
          Pauses a Gridlet only if it is currently executing.
 void gridletResume(int gridletId, int userId, boolean ack)
          Resumes a Gridlet only in the paused list.
 int gridletStatus(int gridletId, int userId)
          Finds the status of a specified Gridlet ID.
 void gridletSubmit(Gridlet gl, boolean ack)
          Schedules a new Gridlet that has been received by the GridResource entity.
 
Methods inherited from class gridsim.AllocPolicy
addTotalLoad, calculateTotalLoad, findGridlet, getTotalLoad, gridletMigrate, init, isEndSimulation, sendAck, sendCancelGridlet, sendFinishGridlet, sendInternalEvent, setEndSimulation
 
Methods inherited from class eduni.simjava.Sim_entity
add_generator, add_param, add_port, clone, get_id, get_name, get_port, get_port, get_stat, run, send_on, set_invisible, set_stat, sim_cancel, sim_completed, sim_current, sim_get_next, sim_get_next, sim_hold_for, sim_hold, sim_pause_for, sim_pause_for, sim_pause_until, sim_pause_until, sim_pause, sim_process_for, sim_process_for, sim_process_until, sim_process_until, sim_process, sim_putback, sim_schedule, sim_schedule, sim_schedule, sim_schedule, sim_schedule, sim_schedule, sim_select, sim_trace, sim_wait_for, sim_wait_for, sim_wait_for, sim_wait, sim_waiting, sim_waiting
 
Methods inherited from class Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SpaceShared

SpaceShared(String resourceName,
            String entityName)
      throws Exception
Allocates a new SpaceShared object

Parameters:
resourceName - the GridResource entity name that will contain this allocation policy
entityName - this object entity name
Throws:
Exception - This happens when one of the following scenarios occur:
See Also:
GridSim.init(int, Calendar, boolean, String[], String[], String)
Pre Condition:
resourceName != null, entityName != null
Post Condition:
$none
Method Detail

body

public void body()
Handles internal events that are coming to this entity.

Overrides:
body in class Sim_entity
Pre Condition:
$none
Post Condition:
$none

gridletSubmit

public void gridletSubmit(Gridlet gl,
                          boolean ack)
Schedules a new Gridlet that has been received by the GridResource entity.

Specified by:
gridletSubmit in class AllocPolicy
Parameters:
gl - a Gridlet object that is going to be executed
ack - an acknowledgement, i.e. true if wanted to know whether this operation is success or not, false otherwise (don't care)
See Also:
ResGridlet, ResGridletList
Pre Condition:
gl != null
Post Condition:
$none

gridletStatus

public int gridletStatus(int gridletId,
                         int userId)
Finds the status of a specified Gridlet ID.

Specified by:
gridletStatus in class AllocPolicy
Parameters:
gridletId - a Gridlet ID
userId - the user or owner's ID of this Gridlet
Returns:
the Gridlet status or -1 if not found
See Also:
Gridlet
Pre Condition:
gridletId > 0, userId > 0
Post Condition:
$none

gridletCancel

public void gridletCancel(int gridletId,
                          int userId)
Cancels a Gridlet running in this entity. This method will search the execution, queued and paused list. The User ID is important as many users might have the same Gridlet ID in the lists. NOTE:

Specified by:
gridletCancel in class AllocPolicy
Parameters:
gridletId - a Gridlet ID
userId - the user or owner's ID of this Gridlet
Pre Condition:
gridletId > 0, userId > 0
Post Condition:
$none

gridletPause

public void gridletPause(int gridletId,
                         int userId,
                         boolean ack)
Pauses a Gridlet only if it is currently executing. This method will search in the execution list. The User ID is important as many users might have the same Gridlet ID in the lists.

Specified by:
gridletPause in class AllocPolicy
Parameters:
gridletId - a Gridlet ID
userId - the user or owner's ID of this Gridlet
ack - an acknowledgement, i.e. true if wanted to know whether this operation is success or not, false otherwise (don't care)
Pre Condition:
gridletId > 0, userId > 0
Post Condition:
$none

gridletMove

public void gridletMove(int gridletId,
                        int userId,
                        int destId,
                        boolean ack)
Moves a Gridlet from this GridResource entity to a different one. This method will search in both the execution and paused list. The User ID is important as many Users might have the same Gridlet ID in the lists.

If a Gridlet has finished beforehand, then this method will send back the Gridlet to sender, i.e. the userId and sets the acknowledgment to false (if required).

Specified by:
gridletMove in class AllocPolicy
Parameters:
gridletId - a Gridlet ID
userId - the user or owner's ID of this Gridlet
destId - a new destination GridResource ID for this Gridlet
ack - an acknowledgement, i.e. true if wanted to know whether this operation is success or not, false otherwise (don't care)
Pre Condition:
gridletId > 0, userId > 0, destId > 0
Post Condition:
$none

gridletResume

public void gridletResume(int gridletId,
                          int userId,
                          boolean ack)
Resumes a Gridlet only in the paused list. The User ID is important as many Users might have the same Gridlet ID in the lists.

Specified by:
gridletResume in class AllocPolicy
Parameters:
gridletId - a Gridlet ID
userId - the user or owner's ID of this Gridlet
ack - an acknowledgement, i.e. true if wanted to know whether this operation is success or not, false otherwise (don't care)
Pre Condition:
gridletId > 0, userId > 0
Post Condition:
$none