protected boolean startGridlet(SSGridlet sgl) {
    	int reqPE = sgl.getNumPE();
    	int partId = sgl.getPartitionID();
        boolean success = false; 
    	
    	long runTime = forecastExecutionTime(ratingPE, sgl.getRemainingLength());
    	double now = GridSim.clock() ; 
    	double finishTime = now + runTime;
        
        // checks the availability of PEs in the selected partition
    	ProfileEntry entry = profile.checkPartAvailability(partId, now, runTime);
    	PERangeList ranges = entry.getAvailRanges();
    	
        if(entry.getNumPE() >= reqPE) {
        	// allocate PEs for the job
        	ranges = ranges.selectPEs(reqPE);
            profile.allocatePartPERanges(partId, ranges, now, finishTime);
        	success = true;
        }
        // partition can borrow resources from another
        else if (allowBorrowing) { 
        	// check availability in all partitions
            entry = profile.checkAvailability(reqPE, now, runTime);
            if(entry != null && entry.getNumPE() >= reqPE) {
            	// additional ranges required for the job
                PERangeList addRanges = entry.getAvailRanges();
                addRanges.remove(ranges);
                int addRequired = reqPE - ranges.getNumPE();
            	
            	// borrows the additional PEs from the partitions 
            	addRanges = addRanges.selectPEs(addRequired);
            	ranges.addAll(addRanges);
            	
            	if(ranges.getNumPE() > reqPE) {
            		// should not happen
            		logger.warning("Allocating more PEs than required.");
            	}
            	
            	profile.allocatePERanges(ranges, now, finishTime);
            	success = true;
            }
        }
        
        if(!success) {
        	return false; // it was not possible to schedule the gridlet
        }
        
        dynamics.setPEsBusy(ranges); // sets PEs to busy in resource characteristics
        runningJobs.add(sgl);
        sgl.setStartTime(now);
        sgl.setActualFinishTime(finishTime);
        sgl.setStatus(Gridlet.INEXEC);
        sgl.setPERangeList(ranges);
        
        // send event to itself to update the schedule once the job completes
        super.sendInternalEvent(runTime, UPT_SCHEDULE);
        
        //------------------ FOR DEBUGGING PURPOSES ONLY ----------------
        visualizer.notifyListeners(this.get_id(), ActionType.ITEM_SCHEDULED, true, sgl);
    	//---------------------------------------------------------------
        return true;
    }