Skip to content

Update to the CloudSim Plus 9 Processor API (cloudsimplus#595) - #39

Merged
manoelcampos merged 1 commit into
masterfrom
592-core-capacity
Oct 25, 2026
Merged

manoelcampos merged 1 commit into
masterfrom
592-core-capacity

Conversation

@manoelcampos

@manoelcampos manoelcampos commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Updates the project to the CloudSim Plus API changed by cloudsimplus/cloudsimplus#595 (#592), which replaced the List<Pe> of Hosts and VMs with a single Processor instance (containing the number of cores and MIPS capacity).

Changes

Before After
new HostSimple(ram, bw, storage, peList) with a List<Pe> of PeSimple objects new HostSimple(ram, bw, storage, new CoreCapacity(cores, mips))
new VmSimple(mips, pes), new VmSimple(id, mips, pes) new VmSimple(new CoreCapacity(cores, mips)), new VmSimple(id, new CoreCapacity(cores, mips))
host/vm.getPesNumber(), host/vm.getMips() getProcessor().getCores(), getProcessor().getMips()
cloudlet.getPesNumber() cloudlet.getRequiredCores()
*_PES constants *_CORES
host.getTotalAllocatedMips() host.getVmScheduler().getTotalAllocatedMips()
vm.get/setPeVerticalScaling() get/setCpuVerticalScaling()

Helper methods that only built PE lists (such as createPeList()) were removed, and their callers now create the CoreCapacity directly.

Reusing CoreCapacity objects

In 58 examples, all Hosts (or VMs) with the same capacity now use a single private static final CoreCapacity HOST_CAPACITY/VM_CAPACITY. A comment next to each constant explains why.

  • Why it's safe: CoreCapacity is an immutable record, so it never changes after it's created. Each Host/VM copies its values into its own Processor. Changing one machine's capacity (such as by vertical scaling) changes only that machine's Processor, never the shared object or the other machines.
  • Why it matters: it avoids creating one temporary object per Host/VM, which means fewer allocations and less GC work in large simulations.
  • What it doesn't do: since ProcessorSimple copies the values and doesn't keep the record, reusing it doesn't reduce the memory retained by the simulation. Use immutable records for configuration values to reduce memory footprint cloudsimplus#603 lists the classes where immutable, shared records would reduce it.

Capacities built from local variables or method parameters (such as Hosts with different numbers of cores) are still created inline.

Verification

  • mvn clean compile passes.
  • I ran all 87 example classes (before and after reusing the capacities, with the same results) with a 90s timeout:
    • 84 finish without errors.
    • LargeScaleExample and PerformanceExample1 reach the timeout, as expected for their scale.
    • MinTimeBetweenEventsExample fails with IndexOutOfBoundsException in CloudletsTableBuilder.column(9, ...): it accesses columns before build() creates them. That code wasn't changed by #595, so the failure isn't caused by this migration.

CI needs the 9.0.0-SNAPSHOT with #595 published to the Maven Central snapshots repository.

🤖 Generated with Claude Code

- Hosts and VMs are created with a CoreCapacity instead of a List<Pe>
  and (mips, pes) arguments.
- A single immutable CoreCapacity is reused for all Hosts/VMs with the
  same capacity, documenting why that is safe.
- getPesNumber()/getMips() on Hosts and VMs use the machine Processor.
- Cloudlet.getPesNumber() is now getRequiredCores().
- PeVerticalScaling methods are now CpuVerticalScaling ones.
- Rename *_PES constants to *_CORES.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@manoelcampos manoelcampos changed the title Update to the CloudSim Plus single Processor API (cloudsimplus#595) Update to the CloudSim Plus 9 Processor API (cloudsimplus#595) Oct 25, 2026
@manoelcampos
manoelcampos merged commit f8b0766 into master Oct 25, 2026
1 check passed
@manoelcampos
manoelcampos deleted the 592-core-capacity branch October 25, 2026 00:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant