From: <mar...@us...> - 2008-02-10 06:19:14
|
Revision: 93 http://gridsim.svn.sourceforge.net/gridsim/?rev=93&view=rev Author: marcos_dias Date: 2008-02-09 22:19:19 -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 Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/ARParallelSpaceShared.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/ARParallelSpaceShared.java 2008-02-10 06:04:30 UTC (rev 92) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/ARParallelSpaceShared.java 2008-02-10 06:19:19 UTC (rev 93) @@ -1569,10 +1569,10 @@ } resource_.setPEsAvailable(releasedRanges); - if(PERangeList.containsOverlappingRanges(resource_.getFreePERanges())) { - System.out.println("Overlap! Ranges = " + resource_.getFreePERanges()); - System.exit(1); - } +// if(PERangeList.containsOverlappingRanges(resource_.getFreePERanges())) { +// System.out.println("Overlap! Ranges = " + resource_.getFreePERanges()); +// System.exit(1); +// } itemsStarted = startReservation(currentTime); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2008-02-11 05:27:39
|
Revision: 96 http://gridsim.svn.sourceforge.net/gridsim/?rev=96&view=rev Author: marcos_dias Date: 2008-02-10 21:27:42 -0800 (Sun, 10 Feb 2008) Log Message: ----------- Policy updated to provide options when a reservation is rejected. Modified Paths: -------------- branches/gridsim4.0-branch3/source/gridsim/turbo/ARParallelSpaceShared.java Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/ARParallelSpaceShared.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/ARParallelSpaceShared.java 2008-02-11 02:35:48 UTC (rev 95) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/ARParallelSpaceShared.java 2008-02-11 05:27:42 UTC (rev 96) @@ -303,7 +303,7 @@ // creates a Server Side Reservation (i.e. SSReservation) SSReservation sRes = new SSReservation(reservation); - double expTime; + double expTime = Double.NaN; // creates a response message to be sent to the requester ARMessage response = message.createResponse(); @@ -330,8 +330,10 @@ return; } + boolean success = true; + // if start time is 0, then it is an immediate reservation - if(startTime == 0) { + if(startTime == 0 || startTime == currentTime) { // sets the start time of the reservation as the current time startTime = currentTime; @@ -353,31 +355,29 @@ userName + " user requires " + reservation.getNumPE() + " PEs from " + startTime + " to " + (startTime + duration)); System.out.println("--> The resource cannot handle the reservation"); - - reservation.setStatus(Reservation.STATUS_FAILED); - response.setErrorCode(ARMessage.EC_OPERATION_FAILURE); - super.sendARMessage(response); - return; + success = false; } - - // gets the index of the entry closest to the termination of the - // reservation but whose time is not larger than the reservation's - // termination time - int tailIndex = (Integer)availObj[0]; - - // gets the list of PEs selected for the reservation - PERangeList selected = (PERangeList)availObj[1]; - - // allocates the list of PEs to the reservation - sRes.setPERangeList(selected); - - // updates the availability profile accordingly - allocateImmediatePERanges(tailIndex, selected, - currentTime, sRes.getFinishTime()); - - // the expiration time for immediate reservation is the - // termination time - expTime = sRes.getFinishTime(); + else { // there resources available + + // gets the index of the entry closest to the termination of the + // reservation but whose time is not larger than the reservation's + // termination time + int tailIndex = (Integer)availObj[0]; + + // gets the list of PEs selected for the reservation + PERangeList selected = (PERangeList)availObj[1]; + + // allocates the list of PEs to the reservation + sRes.setPERangeList(selected); + + // updates the availability profile accordingly + allocateImmediatePERanges(tailIndex, selected, + currentTime, sRes.getFinishTime()); + + // the expiration time for immediate reservation is the + // termination time + expTime = sRes.getFinishTime(); + } } // It is not an immediate reservation else { @@ -396,71 +396,84 @@ userName + " user requires " + reservation.getNumPE() + " PEs from " + startTime + " to " + (startTime + duration) ); System.out.println("--> The resource cannot handle the reservation"); - - reservation.setStatus(Reservation.STATUS_FAILED); - response.setErrorCode(ARMessage.EC_OPERATION_FAILURE); - super.sendARMessage(response); - return; + success = false; } - - // gets the index of the entry closest to the start time - // of the reservation and whose time is smaller or equals - // to the reservation's start time - int anchorIndex = (Integer)availObj[0]; - - // gets the index of the entry closest to the termination of the - // reservation but whose time is not larger than the reservation's - // termination time - int tailIndex = (Integer)availObj[1]; - - // gets the list of PE ranges selected for the reservation - // and sets the reservation to use them - PERangeList selected = (PERangeList)availObj[2]; - sRes.setPERangeList(selected); - - // allocates the ranges and updates the availability profile - allocatePERanges(anchorIndex, tailIndex, selected, - startTime, sRes.getFinishTime()); - - // calculate the expiration time of the reservation - expTime = currentTime + commitPeriod_; - - // if the expiration time is greater than the start time of the - // reservation, then set the expiration time as the start time - if(expTime > startTime) { - expTime = startTime; + else { // there are resource available + + // gets the index of the entry closest to the start time + // of the reservation and whose time is smaller or equals + // to the reservation's start time + int anchorIndex = (Integer)availObj[0]; + + // gets the index of the entry closest to the termination of the + // reservation but whose time is not larger than the reservation's + // termination time + int tailIndex = (Integer)availObj[1]; + + // gets the list of PE ranges selected for the reservation + // and sets the reservation to use them + PERangeList selected = (PERangeList)availObj[2]; + sRes.setPERangeList(selected); + + // allocates the ranges and updates the availability profile + allocatePERanges(anchorIndex, tailIndex, selected, + startTime, sRes.getFinishTime()); + + // calculate the expiration time of the reservation + expTime = currentTime + commitPeriod_; + + // if the expiration time is greater than the start time of the + // reservation, then set the expiration time as the start time + if(expTime > startTime) { + expTime = startTime; + } } } - // if the start time of the reservation is equals to the current - // time, meaning that it is an immediate reservation, then start - // the reservation straight away. Therefore, sets the status to - // committed and sends an internal event to start the reservation - if(currentTime == startTime) { - sRes.setStatus(Reservation.STATUS_COMMITTED); - super.sendInternalEvent(GridSimTags.SCHEDULE_NOW, START_RESERVATION); + // resources are available and have been allocated for the reservation + if(success) { + + // if the start time of the reservation is equals to the current + // time, meaning that it is an immediate reservation, then start + // the reservation straight away. Therefore, sets the status to + // committed and sends an internal event to start the reservation + if(currentTime == startTime) { + sRes.setStatus(Reservation.STATUS_COMMITTED); + super.sendInternalEvent(GridSimTags.SCHEDULE_NOW, START_RESERVATION); + } + else { + sRes.setStatus(Reservation.STATUS_NOT_COMMITTED); + } + + sRes.setExpiryTime(expTime); + + // add the reservation into the reservation table and sends the + // response message to the requester + reservTable_.put(new Integer(sRes.getID()), sRes); + super.sendARMessage(response); + + // then send this into itself to check for expired reservations + super.sendInternalEvent(expTime - currentTime, + EXPIRY_TIME); + + //-------------- FOR DEBUGGING PURPOSES ONLY -------------- + + // Informs the listeners about the reservation that has been created + GridSim.notifyListeners(this.get_id(), AllocationAction.ITEM_SCHEDULED, true, sRes); + + //---------------------------------------------------------- } - else { - sRes.setStatus(Reservation.STATUS_NOT_COMMITTED); + else { // Creates a list of options + + // Gets availability information and provides it as options + AvailabilityInfo availability = + getAvailabilityInfo(startTime, Integer.MAX_VALUE); + + reservation.setStatus(Reservation.STATUS_FAILED); + reservation.setReservationOptions(availability); + response.setErrorCode(ARMessage.EC_OPERATION_FAILURE_BUT_OPTIONS); + super.sendARMessage(response); } - - sRes.setExpiryTime(expTime); - - // add the reservation into the reservation table and sends the - // response message to the requester - reservTable_.put(new Integer(sRes.getID()), sRes); - super.sendARMessage(response); - - // then send this into itself to check for expired reservations - super.sendInternalEvent(expTime - currentTime, - EXPIRY_TIME); - - //-------------- FOR DEBUGGING PURPOSES ONLY -------------- - - // Informs the listeners about the reservation that has been created - GridSim.notifyListeners(this.get_id(), AllocationAction.ITEM_SCHEDULED, true, sRes); - - //---------------------------------------------------------- } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |