⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 resourcecharacteristics.java

📁 一个非常著名的网格模拟器,能够运行网格调度算法!
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/* * Title:        GridSim Toolkit * Description:  GridSim (Grid Simulation) Toolkit for Modeling and Simulation *               of Parallel and Distributed Systems such as Clusters and Grids * Licence:      GPL - http://www.gnu.org/copyleft/gpl.html * * $Id: ResourceCharacteristics.java,v 1.22 2004/11/01 02:52:37 anthony Exp $ */package gridsim;/** * GridSim ResourceCharacteristics class represents static properties of a * resource such as resource architecture, Operating System (OS), management * policy (time- or space-shared), cost and time zone at which the resource * is located along resource configuration. * * @author       Manzur Murshed and Rajkumar Buyya * @since        GridSim Toolkit 1.0 * @invariant $none */public class ResourceCharacteristics{    private int id_;     // resource id--setup when Resource is created    private String architecture_;    private String OS_;    private MachineList machineList_;    private double timeZone_;    // difference from GMT    // Price/CPU-unit if unit = sec., then G$/CPU-sec.    private double costPerSec_;    // Resource Types -- allocation policy    private int allocationPolicy_;    /** Time-shared system using Round-Robin algorithm */    public static final int TIME_SHARED = 0;    /** Spaced-shared system using First Come First Serve (FCFS) algorithm */    public static final int SPACE_SHARED = 1;    /** Assuming all PEs in all Machines have the same rating. */    public static final int OTHER_POLICY_SAME_RATING = 2;    /** Assuming all PEs in a Machine have the same rating.     * However, each Machine has different rating to each other.     */    public static final int OTHER_POLICY_DIFFERENT_RATING = 3;    /** A resource that supports Advanced Reservation mechanisms. */    public static final int ADVANCE_RESERVATION = 4;    /**     * Allocates a new ResourceCharacteristics object.     * If the time zone is invalid, then by default, it will be GMT+0.     * @param architecture  the architecture of a resource     * @param OS            the operating system used     * @param machineList   list of machines in a resource     * @param allocationPolicy     the resource allocation policy     * @param timeZone   local time zone of a user that owns this reservation.     *                   Time zone should be of range [GMT-12 ... GMT+13]     * @param costPerSec    the cost per sec to use this resource     * @pre architecture != null     * @pre OS != null     * @pre machineList != null     * @pre allocationPolicy >= 0 && allocationPolicy <= 3     * @pre timeZone >= -12 && timeZone <= 13     * @pre costPerSec >= 0.0     * @post $none     */    public ResourceCharacteristics(String architecture, String OS,                MachineList machineList, int allocationPolicy,                double timeZone, double costPerSec)    {        this.id_ = -1;        this.architecture_ = architecture;        this.OS_ = OS;        this.machineList_ = machineList;        this.allocationPolicy_ = allocationPolicy;        this.costPerSec_ = costPerSec;        if (AdvanceReservation.validateTimeZone(timeZone) == false) {            this.timeZone_ = 0.0;        }        else {            this.timeZone_ = timeZone;        }    }    /**     * Sets the resource ID     * @param id    the resource ID     * @deprecated As of GridSim 2.1, replaced by {@link #setResourceID(int)}     * @pre id >= 0     * @post $none     */    public void SetID(int id) {        this.setResourceID(id);    }    /**     * Sets the resource ID     * @param id    the resource ID     * @pre id >= 0     * @post $none     */    public void setResourceID(int id) {        this.id_ = id;    }    /**     * Gets the resource ID     * @return the resource ID     * @deprecated As of GridSim 2.1, replaced by {@link #getResourceID()}     * @pre $none     * @post $result >= 0     */    public int GetID() {        return this.getResourceID();    }    /**     * Gets the resource ID     * @return the resource ID     * @pre $none     * @post $result >= 0     */    public int getResourceID() {        return id_;    }    /**     * Gets the name of a resource     * @return the resource name     * @deprecated As of GridSim 2.1, replaced by     *             {@link #getResourceName()}     * @pre $none     * @post $result != null     */    public String GetName() {        return this.getResourceName();    }    /**     * Gets the name of a resource     * @return the resource name     * @pre $none     * @post $result != null     */    public String getResourceName() {        return GridSim.getEntityName(id_);    }    /**     * Gets the resource architecture name     * @return the architecture name     * @deprecated As of GridSim 2.1, replaced by     *             {@link #getResourceArch()}     * @pre $none     * @post $result != null     */    public String GetArch() {        return this.getResourceArch();    }    /**     * Gets the resource architecture name     * @return the architecture name     * @pre $none     * @post $result != null     */    public String getResourceArch() {        return architecture_;    }    /**     * Gets the Operating System (OS) this resource is used     * @return the name of OS     * @deprecated As of GridSim 2.1, replaced by {@link #getResourceOS()}     * @pre $none     * @post $result != null     */    public String GetOS() {        return this.getResourceOS();    }    /**     * Gets the Operating System (OS) this resource is used     * @return the name of OS     * @pre $none     * @post $result != null     */    public String getResourceOS() {        return OS_;    }    /**     * Gets the list of machines in a resouce     * @return a MachineList object     * @see gridsim.MachineList     * @deprecated As of GridSim 2.1, replaced by {@link #getMachineList()}     * @pre $none     * @post $result != null     */    public MachineList GetMachines() {        return this.getMachineList();    }    /**     * Gets the list of machines in a resouce     * @return a MachineList object     * @see gridsim.MachineList     * @pre $none     * @post $result != null     */    public MachineList getMachineList() {        return machineList_;    }    /**     * Gets a Machine with at least one empty PE     * @return a Machine object or <tt>null</tt> if not found     * @pre $none     * @post $none     */    public Machine getMachineWithFreePE() {        return machineList_.getMachineWithFreePE();    }    /**     * Gets a Machine with at least a given number of free PE     * @param numPE  number of PE     * @return a Machine object or <tt>null</tt> if not found     * @pre $none     * @post $none     */    public Machine getMachineWithFreePE(int numPE) {        return machineList_.getMachineWithFreePE(numPE);    }    /**     * Gets the resource allocation policy     * @return the allocation policy     * @deprecated As of GridSim 2.1, replaced by     *             {@link #getResourceAllocationPolicy()}     * @pre $none     * @post $result >= 0 && $result <= 2     */    public int GetAllocationPolicy() {        return this.getResourceAllocationPolicy();    }    /**     * Gets the resource allocation policy     * @return the allocation policy     * @pre $none     * @post $result >= 0 && $result <= 2     */    public int getResourceAllocationPolicy() {        return allocationPolicy_;    }    /**     * Gets the resource time zone     * @return the time zone     * @deprecated As of GridSim 2.1, replaced by     *             {@link #getResourceTimeZone()}     * @pre $none     * @post $none     */    public double GetTimeZone() {        return this.getResourceTimeZone();    }    /**     * Gets the resource time zone     * @return the time zone     * @pre $none     * @post $none     */    public double getResourceTimeZone() {        return timeZone_;    }    /**     * Gets Millions Instructions Per Second (MIPS) Rating of a Processing     * Element (PE). It is assumed all PEs' rating is same in a given machine.     * @return the MIPS Rating or <tt>-1</tt> if no PEs are exists.     * @deprecated As of GridSim 2.1, replaced by     *             {@link #getMIPSRatingOfOnePE()}     * @pre $none     * @post $result >= -1     */    public int GetMIPSRatingOfOnePE() {        return this.getMIPSRatingOfOnePE();    }    /**     * Gets Millions Instructions Per Second (MIPS) Rating of a Processing     * Element (PE). It is assumed all PEs' rating is same in a given machine.     * @return the MIPS Rating or <tt>-1</tt> if no PEs are exists.     * @pre $none

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -