hu.mta.sztaki.lpds.cloud.simulator.iaas.resourcemodel
Class ResourceSpreader.FreqSyncer

java.lang.Object
  extended by hu.mta.sztaki.lpds.cloud.simulator.Timed
      extended by hu.mta.sztaki.lpds.cloud.simulator.iaas.resourcemodel.ResourceSpreader.FreqSyncer
All Implemented Interfaces:
Comparable<Timed>
Enclosing class:
ResourceSpreader

public static class ResourceSpreader.FreqSyncer
extends Timed

This class is the core part of the unified resource consumption model of DISSECT-CF. The main purpose of this class is to create and manage influence groups from resource spreaders that are connected with resource consumptions. Also the class is also expected to coordinate the processing of the resource consumptions within the entire influence group. Finally, the class is responsible to deliver the completion or failure events for the resource consumptions deregistered from the influence group's resource spreaders. The name FreqSyncer comes from the class's primary goal, identify the earliest time there is a change in the scheduling (e.g., because a new resource consumption is added to the group or because one of the consumptions complete), and then make sure that all spreaders in the influence group receive timing events at the same time instance.

Author:
"Gabor Kecskemeti, Distributed and Parallel Systems Group, University of Innsbruck (c) 2013" "Gabor Kecskemeti, Laboratory of Parallel and Distributed Systems, MTA SZTAKI (c) 2015"

Field Summary
private  ArrayList<ResourceSpreader> depGroupExtension
          those resource spreaders that need to be added to the influence group at the particular time instance
private  int depgrouplen
          The current length of the myDepGroup array.
private  int firstConsumerId
          The index of the first consumer in the myDepGroup array.
private  ResourceSpreader[] myDepGroup
          The influence group managed by this freqsyncer object.
private  boolean nudged
          if there are some external activities that could lead to influence group changes this field will be turned to true the tick function then ensures it to return to false once it has completed its management operations on the influence groups
private  boolean regularFreqMode
          if the freqsyncer identifies the need to fire events with 0 frequency then it turns this mode off.
 
Constructor Summary
private ResourceSpreader.FreqSyncer(ResourceSpreader[] myDepGroup, int provcount, int dglen)
          The constructor to be used when a new influence group needs to be created because the original group got fragmented.
private ResourceSpreader.FreqSyncer(ResourceSpreader provider, ResourceSpreader consumer)
          Constructor of a freqsyncer to be used when neither the provider nor the consumer of a resource consumption belongs to an already existing influence group.
 
Method Summary
private  void addSingleToDG(ResourceSpreader rs)
          Allows a single spreader object to be added to the influence group.
private  void addToGroup()
          This function copies the contents of the depGroupExtension list to the array representing the influence group and ensures that all newly added members of the influence group know their group membership.
private  void buildDepGroup(ResourceSpreader startingItem)
          Marks all resource spreaders in the currently decomposing influence group that the starting spreader has connections with.
 ResourceSpreader[] getClonedDepGroup()
          This will always give a fresh copy of the depgroup which can be changed as the user desires.
(package private)  ResourceSpreader[] getDepGroup()
          Only those should get the depgroup with this function who are not planning to change it's contents.
 int getDGLen()
          queries the number of resource spreaders that are part of the influence group managed by this freqsyncer.
 int getFirstConsumerId()
          query the index of the first consumer in the influence group's internal array representation
private  boolean isInDepGroup(ResourceSpreader lookfor)
          Determines if the spreader in question is part of the current influence group or not
 boolean isRegularFreqMode()
          Determines if the influence group is processing 0 ticks long consumptions.
(package private)  void nudge()
          To be used to initiate out of order frequency updates.
protected  void outOfOrderProcessing(long currentTime)
          Goes through the entire influence group and for each member it initiates its doProcessing function.
 void tick(long fires)
          Implementation of Algorithm 1 from "DISSECT-CF: a simulator to foster energy-aware scheduling in infrastructure clouds" Manages the influence group's growth and decomposition.
 String toString()
          provides a textual overview of the influence group with all its members.
private  void updateMyFreqNow()
          Calls out to the low level scheduler of the group to assign processing limits for each consumption in the group and to identify the completion time of the earliest terminating consumption.
 
Methods inherited from class hu.mta.sztaki.lpds.cloud.simulator.Timed
calcTimeJump, compareTo, fire, getFireCount, getFrequency, getNextEvent, getNextFire, isSubscribed, jumpTime, nextEventDistance, resetTimed, setBackPreference, simulateUntil, simulateUntilLastEvent, skipEventsTill, subscribe, unsubscribe, updateFrequency
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

myDepGroup

private ResourceSpreader[] myDepGroup
The influence group managed by this freqsyncer object. myDepGroup is always kept in order: first all the providers are listed, then all the consumers, when dealing with this data member please keep in mind this expected behavior. At the end of the array we have a padding with null items. Contents:


depgrouplen

private int depgrouplen
The current length of the myDepGroup array. This is the actual length without counting the padding at the end of the java array.


firstConsumerId

private int firstConsumerId
The index of the first consumer in the myDepGroup array.


depGroupExtension

private final ArrayList<ResourceSpreader> depGroupExtension
those resource spreaders that need to be added to the influence group at the particular time instance


nudged

private boolean nudged
if there are some external activities that could lead to influence group changes this field will be turned to true the tick function then ensures it to return to false once it has completed its management operations on the influence groups


regularFreqMode

private boolean regularFreqMode
if the freqsyncer identifies the need to fire events with 0 frequency then it turns this mode off. This allows ResourceSpreader.doProcessing to happen multiple times in a single time instance.

Constructor Detail

ResourceSpreader.FreqSyncer

private ResourceSpreader.FreqSyncer(ResourceSpreader provider,
                                    ResourceSpreader consumer)
Constructor of a freqsyncer to be used when neither the provider nor the consumer of a resource consumption belongs to an already existing influence group.

Parameters:
provider - the provider to be added to the initial influence group
consumer - the consumer to be added to the initial influence group

ResourceSpreader.FreqSyncer

private ResourceSpreader.FreqSyncer(ResourceSpreader[] myDepGroup,
                                    int provcount,
                                    int dglen)
The constructor to be used when a new influence group needs to be created because the original group got fragmented.

Parameters:
myDepGroup - the group members to take part in the new influence group
provcount - the number of providers in the group
dglen - the length of the influence group
Method Detail

addSingleToDG

private void addSingleToDG(ResourceSpreader rs)
Allows a single spreader object to be added to the influence group. WARNING: Should only be used from addToGroup, as there are some management operations that only occure there for performance reasons

Parameters:
rs - the spreader to be added to the influence group

addToGroup

private void addToGroup()
This function copies the contents of the depGroupExtension list to the array representing the influence group and ensures that all newly added members of the influence group know their group membership.


isInDepGroup

private boolean isInDepGroup(ResourceSpreader lookfor)
Determines if the spreader in question is part of the current influence group or not

Parameters:
lookfor - the spreader in question
Returns:
true if the group is part of the current influence group

nudge

void nudge()
To be used to initiate out of order frequency updates. This is useful when one or more resource spreaders in the influence group have gone through frequency altering changes (i.e., dropping or receiving a new resource consumption) and the rest of the group needs to be rescheduled.


getDepGroup

ResourceSpreader[] getDepGroup()
Only those should get the depgroup with this function who are not planning to change it's contents. This function directly offers the array handled by the freqsyncer to allow external read operations on the array to perform faster. WARNING: If, for some reason, the contents of the returned array are changed then the proper operation of FreqSyncer cannot be guaranteed anymore.

Returns:
the reference to the influence group's internal array

getDGLen

public int getDGLen()
queries the number of resource spreaders that are part of the influence group managed by this freqsyncer.

Returns:
the number of spreaders in the group

getClonedDepGroup

public ResourceSpreader[] getClonedDepGroup()
This will always give a fresh copy of the depgroup which can be changed as the user desires. Because of the always copying behavior it will reduce the performance a little. Of course it results in significant performance penalties for those who only would like to read from the array.

Returns:
a new copy of the influence group's internal array this array can be modified at the user's will

toString

public String toString()
provides a textual overview of the influence group with all its members. useful for debugging and tracing.

Overrides:
toString in class Timed

getFirstConsumerId

public int getFirstConsumerId()
query the index of the first consumer in the influence group's internal array representation

Returns:
the index of the first consumer

outOfOrderProcessing

protected final void outOfOrderProcessing(long currentTime)
Goes through the entire influence group and for each member it initiates its doProcessing function. This is the actual function that does influence group wise resource consumption processing.

Parameters:
currentTime - the time instance for which the processing should be done

tick

public void tick(long fires)
Implementation of Algorithm 1 from "DISSECT-CF: a simulator to foster energy-aware scheduling in infrastructure clouds" Manages the influence group's growth and decomposition. Sends out the notifications for completed or failed resource consumptions. This is executed with the frequency identified by the low level scheduler. The execution of this tick function is run at the very end of the event loop in Timed (with the help of backpreference that is set up in the constructors of this class). The backpreference ensures that frequency setup is only done after all other events are handled by Timed (i.e., it is not expected that new resource consumption objects and similar will occur because of other activities). This actually ensures that the nudging of the freqsyncer will not cause too frequent repetitions of this heavyweight algorithm.

Specified by:
tick in class Timed
Parameters:
fires - The particular time instance when the function was called. The time instance is passed so the tick functions will not need to call getFireCount() if they need to operate on the actual time.

updateMyFreqNow

private void updateMyFreqNow()
Calls out to the low level scheduler of the group to assign processing limits for each consumption in the group and to identify the completion time of the earliest terminating consumption. Then propagates this time to be the next time Timed fires up our tick function. This technique reduces the number of times influence group management has to be executed. Unless someone asks for it explicitly, this process also reduces the frequency with which the ResourceSpreader.doProcessing is called.


isRegularFreqMode

public boolean isRegularFreqMode()
Determines if the influence group is processing 0 ticks long consumptions.

Returns:
true if the influence group is not processing 0 tick long consumptions - this is expected to be the usual case.

buildDepGroup

private void buildDepGroup(ResourceSpreader startingItem)
Marks all resource spreaders in the currently decomposing influence group that the starting spreader has connections with. Before calling this function it is expected that all past members of the influence group are marked not in the group anymore. This function will then change these flags back only on the relevant members from the point of view of the starting item.

Parameters:
startingItem - the starting item from which point the influence group should be constructured.


Copyright © 2012–2015 University of Innsbruck & MTA SZTAKI. All rights reserved.