vCPUCore
The class "vCPUCore" serves as the implementation of CPU cores within the simulation. It includes two mandatory attributes: frequency and instructions-per-cycle, which determine the computational capacity of the core. The computational capacity is represented as a "Resource" object from the "Akatosh" library, enabling withdrawal or return of the available amount during the simulation. The "vCPUCore" is responsible for allocating the computational power to the assigned processes and reclaiming the distributed amount once the execution of the assigned process is complete. In the event that the "vCPUCore" is arbitrarily powered off during the simulation, all processes currently in execution will be considered as failed.
Bases: PhysicalComponent
Source code in PyCloudSim\entity\v_cpu_core.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
|
availablity: Union[int, float]
property
returns the availablity of the cpu core in number of instructions.
capacity: Union[int, float]
property
returns the capacity of the cpu core, aka how many instructions can be executed per second.
computational_power: Resource
property
returns the computational power ( as Resource ) of the cpu core.
cpu: vCPU
property
returns the cpu that this cpu core belongs to.
frequency: Union[int, float]
property
returns the frequency of the cpu core.
ipc: Union[int, float]
property
returns the instructions per cycle of the cpu core.
processes: List[vProcess]
property
returns the processes that are currently executing on the cpu core.
utilization: Union[int, float]
property
returns the utilization of the cpu core in percentage.
__init__(ipc, frequency, cpu, at=simulation.now, after=None, label=None)
Creates a new vCPUCore.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ipc |
Union[int, float]
|
instructions per cycle. |
required |
frequency |
Union[int, float]
|
the frequency of cpu core. |
required |
cpu |
vCPU
|
the cpu that this core belongs to. |
required |
at |
Union[int, float, Callable]
|
when the cpu core should be created. Defaults to simulation.now. |
now
|
after |
Optional[Entity | List[Entity]]
|
the entity that must be terminated before the cpu core is created. Defaults to None. |
None
|
label |
Optional[str]
|
the short description of the cpu core. Defaults to None. |
None
|
Source code in PyCloudSim\entity\v_cpu_core.py
creation()
execute_process(process, length)
Executes a process for a given length.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
process |
vProcess
|
the process to be executed. |
required |
length |
int
|
the length of instructions to be executed. |
required |