Add an extension point for new ScheduledResources

Description

Proposal to add a new extension point in the SimuComFramework.
The extension point should allow the creation of custom ScheduledResources.
Currently, there are two ScheduledResource types, the generic ScheduledResources and its subclass the more specific HDDProcessingResourceSpecification.
Sometimes additional resources are required that, like the HDDProcessingResourceSpecification, want to overwrite the consumeResource() method of its parent.

Use-Case: In the future additional ProcessingResourceTypes e.g. memory, which may want to define their own consumeResource() logic, can be implemented via this extension point.

How to add a new ProcessingResourceType?

  1. Create a new eclipse plugin project.

  2. Create a new resourcetype model with root ResourceRepository and add a new ProcessingResourceType as a child element.

  3. Add an extension for the extension point and set the id inside the "Extensions Details" to the id of the new ProcessingResourceType (without plugin name like in the picture NewProcessingResourceTypeID.png).

  4. Create a new factory class that implements the IScheduledResourceFactory interface.

  5. The createScheduledResource() method of the factory should return your custom subclass of ScheduledResource.java.

  6. (Currently, the id of the new ProcessingResourceType has to be appended with pluginId and a dot at the beginning(like in the picture ExtensionID.png).
    This is because the extension lookup mechanism in the pull request uses .getUniqueIdentifier() , if .getSimpleIdentifier() is used instead then we do not need "pluginId and dot" at the beginning anymore.

 

I provided a demo plugin for steps 1-6 and an example Palladio model that uses the newly created ProcessingResourceType from the demo plugin.

The path to load the ProcessingRessourceType of the demo plugin inside the resourceenvironment model is:

platform:/plugin/ScheduledResourceExtensionDemoPlugin/src/Custom.resourcetype

 

The extension lookup mechanism is mostly based on the extension mechanism for a new scheduler https://sdqweb.ipd.kit.edu/wiki/Extending_PCM

The required SimuCom changes are in TODO addLink 

Environment

None

Activity

Show:
Kim Truong
August 14, 2020, 3:09 PM

Additional information to understand this extension point further.
The HDDProcessingResourceSpecification was introduced in https://jira.palladio-simulator.com/browse/PALLADIO-413 and the extension had to be hardcoded into SimuCom.
For example, the if branch had to be added to the addActiveResourceWithoutCalculators() method inside the SimulatedResourceContainer class :

if (activeResource instanceof HDDProcessingResourceSpecification) {
   scheduledResource = new HDDResource((HDDProcessingResourceSpecification) activeResource, this.myModel,resourceContainerID, schedulingStrategyID);
} else {
   scheduledResource = new ScheduledResource(activeResource, this.myModel, resourceContainerID,schedulingStrategyID);
}

Now each time a new scheduledResource is introduced this if branch has to be extended.
Furthermore, the "if (activeResource instanceof HDDProcessingResourceSpecification)" check requires changes inside the PCM metamodel (e.g. HDDProcessingResourceSpecification must be known, therefore it must be defined in PCM )
With this extension point, these two tasks can be delegated into a separate plugin.
In short, the proposed extension point is an alternative way of how the HDDProcessingResourceSpecification could have been implemented (e.g. in form of an separated plugin with this extension point).

For my master thesis, it would be nice if I can introduce a new scheduledResource (CPU Memory Hierarchy of Caches L1, L2, L3, Dram), which can distinguish between read and write.
Moreover, I want to avoid this "if(activeResource instanceof MemoryHierarchyProcessingResourceSpecification)" check, and therefore using this extension point instead.

A second review is required to check if this behavior of defining new ScheduledResources from separate plugins via extension points should be allowed.

Markus Frank
August 14, 2020, 2:22 PM
Edited

Background:

During the course of his Master Thesis,  extended the PCM to include memory hierarchies and memory behaviour. Besides a PCM extension, it was necessary to adopt the simulators as well. In our specific case, we want to include a new costume resource that reflects the memory bus (very similar to network links). 

Since there was no extension point available, we would have needed to alter the SimuCom code, if we want to include new custom resources. Therefore, I thought it makes more sense to add an extension point, which we and others in the future can use. 

 pull request includes the extension point: https://github.com/PalladioSimulator/Palladio-Analyzer-SimuCom/pull/14

 

*Open tasks:* 

As far as I know, of there are only a few remaining tasks ( please correct me if I am wrong):

  1. find a second review (besides me) and review the changes

  2. test the code

  3. complete the merge request

 

 

Kim Truong
June 30, 2020, 6:16 PM

Assignee

Unassigned

Reporter

Kim Truong

Labels

None

Requirement Category

None

External issue URL

None

Epic Link

Priority

Major