From: <mar...@us...> - 2008-02-10 07:09:47
|
Revision: 94 http://gridsim.svn.sourceforge.net/gridsim/?rev=94&view=rev Author: marcos_dias Date: 2008-02-09 23:09:51 -0800 (Sat, 09 Feb 2008) Log Message: ----------- This update contains small bug fixes and improvements: + The advance reservation policy and the conservative backfilling could present overlapping ranges of available processing elements. Although that did not affect the resource allocation results, that could lead to infinite loops on software that queried the resource availability. + Small changes in the availability information objects and the lists of PEs. Modified Paths: -------------- branches/gridsim4.0-branch3/source/gridsim/turbo/ARParallelSpaceShared.java branches/gridsim4.0-branch3/source/gridsim/turbo/CBParallelSpaceShared.java branches/gridsim4.0-branch3/source/gridsim/turbo/EBParallelSpaceShared.java Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/ARParallelSpaceShared.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/ARParallelSpaceShared.java 2008-02-10 06:19:19 UTC (rev 93) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/ARParallelSpaceShared.java 2008-02-10 07:09:51 UTC (rev 94) @@ -261,7 +261,10 @@ Sim_event ev = new Sim_event(); while ( Sim_system.running() ) { super.sim_get_next(ev); - processEvent(ev); + if (ev.get_src() == super.myId_) + processEvent(ev); + else + processOtherEvent(ev); } // CHECK for ANY INTERNAL EVENTS WAITING TO BE PROCESSED @@ -906,39 +909,32 @@ private void processEvent(Sim_event ev) { // handle an internal event - if(ev.get_src() == super.myId_) { - double currentTime = GridSim.clock(); + double currentTime = GridSim.clock(); - switch(ev.get_tag()) { - // time to update the schedule, finish gridlets, - // finish reservations, start reservations and start gridlets - case GRIDLET_FINISHED: - case START_RESERVATION: - case FINISH_RESERVATION: - if(currentTime > lastScheduleUpdate_) { - updateSchedule(); - } - lastScheduleUpdate_ = currentTime; - break; + switch(ev.get_tag()) { + // time to update the schedule, finish gridlets, + // finish reservations, start reservations and start gridlets + case GRIDLET_FINISHED: + case START_RESERVATION: + case FINISH_RESERVATION: + if(currentTime > lastScheduleUpdate_) { + updateSchedule(); + } + lastScheduleUpdate_ = currentTime; + break; - // checks the expiry time for a given gridlet - case EXPIRY_TIME: - if(currentTime > lastCheckExpiryTime_) { - checkExpiryTime(); - } - lastCheckExpiryTime_ = currentTime; - break; + // checks the expiry time for a given gridlet + case EXPIRY_TIME: + if(currentTime > lastCheckExpiryTime_) { + checkExpiryTime(); + } + lastCheckExpiryTime_ = currentTime; + break; - default: - System.out.println(super.get_name() + ".processEvent():" + - "could not handle the event with tag #" + ev.get_tag()); - break; - } - } - else { - System.out.println(super.get_name() + ".processEvent():" + - "could not handle the event with tag #" + ev.get_tag()); - } + default: + processOtherEvent(ev); + break; + } } /** @@ -2309,20 +2305,7 @@ int length = availProfile_.size(); AvailabilityInfoEntry firstEntry = null; - double entryTime; - - Iterator<AvailabilityProfileEntry> iterProfile = - availProfile_.iterator(); - while(iterProfile.hasNext()) { - AvailabilityProfileEntry entry = iterProfile.next(); - entryTime = entry.getTime(); - if(entryTime > startTime) { - break; - } - else { - anchorEntry = entry; - } - } + anchorEntry = availProfile_.getPrecedingEntry(startTime); // if the entry is null, then it means that the reservation is // before the first entry of the profile, so the intersection list @@ -2346,24 +2329,20 @@ // Iterates the availability profile and adds all the entries // whose times are between start and finish time in the list - // to be returned. It removes duplicated entries - AvailabilityProfileEntry previousEntry = null; + // to be returned. for(int i=anchorIndex+1; i<length; i++) { AvailabilityProfileEntry nextEntry = availProfile_.get(i); if(nextEntry.getTime() > finishTime){ break; } else { - if( !(previousEntry != null && previousEntry.hasSamePERanges(nextEntry)) ) { - PERangeList peList = nextEntry.getPERanges(); - if(peList != null) { - peList = peList.clone(); - } - AvailabilityInfoEntry tsEntry = - new AvailabilityInfoEntry(nextEntry.getTime(), peList); - list.add(tsEntry); - } - previousEntry = nextEntry; + PERangeList peList = nextEntry.getPERanges(); + if(peList != null) { + peList = peList.clone(); + } + AvailabilityInfoEntry tsEntry = + new AvailabilityInfoEntry(nextEntry.getTime(), peList); + list.add(tsEntry); } } Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/CBParallelSpaceShared.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/CBParallelSpaceShared.java 2008-02-10 06:19:19 UTC (rev 93) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/CBParallelSpaceShared.java 2008-02-10 07:09:51 UTC (rev 94) @@ -120,6 +120,9 @@ // the last time when the schedule updated was called private double lastScheduleUpdate_; + + // a tag to indicate that a gridlet has finished + private static final int GRIDLET_FINISHED = 10; /** * Allocates a new <tt>CBParallelSpaceShared</tt> object @@ -178,13 +181,17 @@ } // Internal Event if the event source is this entity - if (ev.get_src() == super.myId_) { + if (ev.get_src() == super.myId_ && + ev.get_tag() == GRIDLET_FINISHED) { double currentTime = GridSim.clock(); if(currentTime > lastScheduleUpdate_) { updateSchedule(); } lastScheduleUpdate_ = currentTime; } + else { + processOtherEvent(ev); + } } // CHECK for ANY INTERNAL EVENTS WAITING TO BE PROCESSED @@ -514,7 +521,7 @@ // then send this event to itself to update the queues after // this gridlet's completion time - super.sendInternalEvent(executionTime); + super.sendInternalEvent(executionTime, GRIDLET_FINISHED); return true; } @@ -933,7 +940,7 @@ // change Gridlet status gridlet.setStatus(Gridlet.INEXEC); - super.sendInternalEvent(gridlet.getFinishTime()-currentTime); + super.sendInternalEvent(gridlet.getFinishTime()-currentTime, GRIDLET_FINISHED); } } resource_.setPEsBusy(allocatedRanges); Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/EBParallelSpaceShared.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/EBParallelSpaceShared.java 2008-02-10 06:19:19 UTC (rev 93) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/EBParallelSpaceShared.java 2008-02-10 07:09:51 UTC (rev 94) @@ -99,6 +99,9 @@ // used only to set the extraPEs_ back to the default value private PERangeList allPEs_; + + // a tag to indicate that a gridlet has finished + private static final int GRIDLET_FINISHED = 10; /** * Allocates a new <tt>EBParallelSpaceShared</tt> object @@ -161,13 +164,17 @@ } // Internal Event if the event source is this entity - if (ev.get_src() == super.myId_) { + if (ev.get_src() == super.myId_ && + ev.get_tag() == GRIDLET_FINISHED) { double currentTime = GridSim.clock(); if(currentTime > lastScheduleUpdate_) { updateSchedule(); } lastScheduleUpdate_ = currentTime; } + else { + processOtherEvent(ev); + } } // CHECK for ANY INTERNAL EVENTS WAITING TO BE PROCESSED @@ -468,7 +475,7 @@ // then send this event to itself to update the queues after // this gridlet's completion time - super.sendInternalEvent(executionTime); + super.sendInternalEvent(executionTime, GRIDLET_FINISHED); return true; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |