Cloudletscheduler. Java

Source: Internet
Author: User

 

/** Title: cloudsim toolkit * Description: cloudsim (cloud simulation) Toolkit for modeling and simulation of clouds * Licence: GPL-http://www.gnu.org/copyleft/gpl.html ** copyright (c) 2009-2010, the University of Melbourne, Australia */package Org. cloudid. cloudsim; import Java. util. list;/*** micro cloud (cloud task) Scheduling Program Indicates a VM's scheduling policies for some cloudlet * This simulation provides two types (space sharing cloudschedulerspaceshared and time sharing cloudschedulertimeshared) policy * others can be added ** cloudletscheduler is an abstract class that represents the policy of * scheduling stored med by a virtual machine. so, Classes * extending this must execute cloudlets. also, the interface for cloudlet * Management is also implemented in this class. ** @ authorrodrigo n. calheiros * @ authora NTON beloglazov * @ sincecloudsim toolkit 1.0 */public abstract class cloudletscheduler {/** the previous time. */private double previoustime;/** the current MIPS share. */private list <double> currentmipsshare;/*** before simulation, you must determine the scheduling type of cloudlet * creates a new cloudletscheduler object. this method must be invoked * before starting the actual simulation. ** @ pre $ none * @ post $ none */Public cloudletschedul Er () {setprevioustime (0.0);}/*** updates the processing of cloudlets running under management of this schedme. ** @ Param currenttime current simulation time * @ Param mipsshare array with MIPS share of each Processor Available to the scheduler ** @ return time predicted completion time of the earliest finishing cloudlet, or 0 * if there is no next events ** @ pre currenttime> = 0 * @ post $ none */Public abstract double updatevmprocessing (double currenttime, list <double> mipsshare);/*** names es an cloudlet to be executed in the VM managed by this schedshare. ** @ Param GL the submited cloudlet * @ Param filetransfertime required to move the required files from the San to the VM ** @ return expected finish time of this cloudlet, or 0 if it is in a waiting queue ** @ pre Gl! = NULL * @ post $ none */public abstract double cloudletsubmit (cloudlet GL, double filetransfertime);/*** names es an cloudlet to be executed in the VM managed by this schedmit. ** @ Param GL the submited cloudlet ** @ return expected finish time of this cloudlet, or 0 if it is in a waiting queue ** @ pre Gl! = NULL * @ post $ none */public abstract double cloudletsubmit (cloudlet GL);/*** cancels execution of a cloudlet. ** @ Param clid of the cloudlet being cancealed ** @ return the canceled cloudlet, $ null if not found ** @ pre $ none * @ post $ none */public abstract cloudlet cloudletcancel (INT clid);/*** pauses execution of a cloudlet. ** @ Param clid of the cloudlet being paused ** @ return $ tru E if cloudlet paused, $ false otherwise ** @ pre $ none * @ post $ none */Public Abstract Boolean cloudletpause (INT clid ); /*** resumes execution of a paused cloudlet. ** @ Param clid 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);/*** processes a finished cloudlet. ** @ Pa Ram RCL finished cloudlet ** @ pre RGL! = $ Null * @ post $ none */public abstract void cloudletfinish (rescloudlet RCL);/*** gets the status of a cloudlet. ** @ Param clid of the cloudlet ** @ return status of the cloudlet, -1 If cloudlet not found ** @ pre $ none * @ post $ none */public abstract int getcloudletstatus (INT clid ); /*** informs about completion of some cloudlet In the VM managed * by this scheduler. ** @ return $ true if there is at least one finished cloudlet; $ false otherwise ** @ pre $ none * @ post $ none */Public Abstract Boolean isfinishedcloudlets (); /*** returns the next cloudlet in the finished list, $ null if this list is empty. ** @ return a finished cloudlet ** @ pre $ none * @ post $ none */public abstract cloudlet getnextfinishedcloudlet (); /*** returns the number of cloudlets runnning in the virtual machine. ** @ return number of cloudlets runnning ** @ pre $ none * @ post $ none */public abstract int runningcloudlets (); /*** returns one cloudlet to migrate to another VM. ** @ return one running cloudlet ** @ pre $ none * @ post $ none */public abstract cloudlet migratecloudlet ();/*** get utilization created by all cloudlets. ** @ Param time the time ** @ return total utilization */public abstract double gettotalutilizationofcpu (double time);/*** gets the current requested MIPS. ** @ return the current MIPS */public abstract list <double> getcurrentrequestedmips ();/*** gets the total current MIPS for the cloudlet. ** @ Param RCL the RCL * @ Param mipsshare the MIPs share ** @ return the total current MIPS */public abstract double gettotalcurrentavailablemipsforcloudlet (rescloudlet RCL, list <double> mipsshare ); /*** gets the total current requested MIPS for cloudlet. ** @ Param RCL the RCL * @ Param time the time ** @ return the total current requested MIPS for cloudlet */public abstract double gettotalcurrentrequestedmipsforcloudlet (rescloudlet RCL, double time ); /*** gets the total current allocated MIPS for cloudlet. ** @ Param RCL the RCL * @ Param time the time ** @ return the total current allocated MIPS for cloudlet */public abstract double gettotalcurrentallocatedmipsforcloudlet (rescloudlet RCL, double time ); /*** get the update time * gets the previous time. ** @ return the previous time */Public double getprevioustime () {return previoustime;}/*** sets the previous time. ** @ Param previoustime the new previous time */protected void setprevioustime (double previoustime) {This. previoustime = previoustime;}/*** sets the current MIPS share. ** @ Param currentmipsshare the new current MIPS share */protected void setcurrentmipsshare (list <double> currentmipsshare) {This. currentmipsshare = currentmipsshare;}/*** gets the current MIPS share. ** @ return the current MIPS share */public list <double> getcurrentmipsshare () {return currentmipsshare ;}}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.