CloudletSchedulerSpaceShared
介绍
-
方法继承自 CloudletScheduler CloudletSchedulerSpaceShared 实现了一个虚拟机用来运行其调度策略。
-
这个策略确保在任何给定时间,每个虚拟机上只有一个Cloudlet在执行。其他的Cloudlets将被放在等待列表中。
-
我们假设等待中的Cloudlets的文件传输发生在Cloudlet执行之前。也就是说,
即使Cloudlets必须等待CPU资源,数据传输在Cloudlets提交后就会立即发生。 -
这种调度策略适用于那些不需要同时运行多个任务的场景,或者当任务之间不需要共享CPU资源时。它通过确保一次只有一个Cloudlet运行来简化资源管理,同时允许其他Cloudlets在等待执行时进行数据传输,这样可以提高整体的效率和响应速度。这种策略在处理长时间运行的单个任务或者当任务之间有明确的执行顺序时特别有用。
类属性
使用的核心数量
/** The number of used PEs. */
protected int usedPes;
类方法
完成一个任务以后,从等待列表中拿出一个新任务运行
protected void updateWaitingCloudlets(double currentTime, Object info)
从暂停的任务列表中拿一个执行
/**
* Resumes execution of a paused cloudlet.
*
* @param clId ID of the cloudlet being resumed
* @return expected finish time of the cloudlet, 0.0 if queued
* @pre $none
* @post $none
*/
public abstract double cloudletResume(int clId)
将收到的任务加到控制调度中
/**
* Receives a cloudlet to be executed in the VM managed by this scheduler.
*
* @param cl the submitted cloudlet
* @return expected finish time of this cloudlet, or 0 if it is in a waiting queue
* @pre gl != null
* @post $none
*/
public double cloudletSubmit(Cloudlet cl)
任务完成
/**
* Processes a finished cloudlet.
*
* @param cl finished cloudlet
* @pre rgl != $null
* @post $none
*/
public void cloudletFinish(Cloudlet cl)
返回第一个任务(可用作任务迁移)
/**
* Returns the first cloudlet to migrate to another VM.
*
* @return the first running cloudlet
* @pre $none
* @post $none
*
* //TODO it doesn't check if the list is empty
*/
@Override
public Cloudlet migrateCloudlet()
返回当前任务下可以用的CPU计算能力
// Simple policy, there is no real scheduling involved
@Override
public double getTotalCurrentAvailableMipsForCloudlet(Cloudlet cl, List<Double> mipsShare) {
return getCurrentCapacity() * cl.getNumberOfPes();
}
返回当前任务下已经使用的的CPU计算能力
@Override
public double getTotalCurrentAllocatedMipsForCloudlet(Cloudlet cl, double time) {
return getTotalCurrentAvailableMipsForCloudlet(cl, getCurrentMipsShare());
}
返回当前任务下CPU计算能力的需求量
@Override
public double getTotalCurrentRequestedMipsForCloudlet(Cloudlet cl, double time) {
return getTotalCurrentAvailableMipsForCloudlet(cl, getCurrentMipsShare());
}