0% found this document useful (0 votes)
14 views6 pages

Practical Assignment 3cloud Computing

The document outlines a practical assignment to simulate a cloud scenario using CloudSim and implement a new scheduling algorithm. It provides details on the objectives, hardware and software requirements, installation steps, and an overview of CloudSim components and scheduling algorithms. The conclusion emphasizes the benefits of using CloudSim for testing and evaluating cloud performance with various scheduling approaches.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views6 pages

Practical Assignment 3cloud Computing

The document outlines a practical assignment to simulate a cloud scenario using CloudSim and implement a new scheduling algorithm. It provides details on the objectives, hardware and software requirements, installation steps, and an overview of CloudSim components and scheduling algorithms. The conclusion emphasizes the benefits of using CloudSim for testing and evaluating cloud performance with various scheduling approaches.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Practical Assignment 3 Cloud Computing

Title: Simulate a cloud scenario using CloudSim and run a scheduling algorithm that is not present
in CloudSim
Objectives:
●​ To learn CloudSim
●​ To apply and develop applications of cloudsim
Hardware Requirements :
●​ Pentium IV with latest configuration
Software Requirements :
●​ Ubuntu 20.04, Java JDK and JRE , CloudSim archives (CloudSim4)
Theory:
A) CloudSim
1. CloudSim is an open-source framework, which is used to simulate cloud computing
infrastructure and services.
2. It is developed by the CLOUDS Lab organization and is written entirely in Java.
3. It is used for modelling and simulating a cloud computing environment as a means for
evaluating a hypothesis prior to software development in order to reproduce tests and results.
4. If you were to deploy an application or a website on the cloud and wanted to test the services
and load that your product can handle and also tune its performance to overcome bottlenecks
before risking deployment, then such evaluations could be performed by simply coding a
simulation of that environment with the help of various flexible and scalable classes provided by
the CloudSim package, free of cost.
B) Benefits of CloudSim
1. No capital investment involved
2. Easy to use and Scalable
3. Risks can be evaluated at an earlier stage
4. No need for try-and-error approaches
C) Architecture
1. CloudSim has a layered architecture which separates the User Code and the simulation
environment.
2. It can be depicted as follows

D) CloudSim Components
●​ Datacenter: used for modelling the foundational hardware equipment of any cloud
environment, that is the Datacenter. This class provides methods to specify the functional
requirements of the Datacenter as well as methods to set the allocation policies of the VMs etc.
●​ Host: this class executes actions related to management of virtual machines. It also defines
policies for provisioning memory and bandwidth to the virtual machines, as well as allocating
CPU cores to the virtual machines.
●​ VM: this class represents a virtual machine by providing data members defining a VM’s
bandwidth, RAM, mips (million instructions per second), size while also providing setter and
getter methods for these parameters.
●​ Cloudlet: a cloudlet class represents any task that is run on a VM, like a processing task, or a
memory access task, or a file updating task etc. It stores parameters defining the characteristics
of a task such as its length, size, mi (million instructions) and provides methods similarly to VM
class while also providing methods that define a task’s execution time, status, cost and history.
●​ DatacenterBroker: is an entity acting on behalf of the user/customer. It is responsible for
functioning of VMs, including VM creation, management, destruction and submission of
cloudlets to the VM.
●​ CloudSim: this is the class responsible for initializing and starting the simulation environment
after all the necessary cloud entities have been defined and later stopping after all the entities
have been destroyed.
E)STEPS For Installations

Step 1: Setting up the Prerequisites

1.​ First of all we need to download the CloudSim and latest version of the Java Development Toolkit (JDK).
2.​ CloudSim requires a working Java installation. So, open up a terminal and run the following

1 sudo add-apt-repository ppa:webupd8team/java

2 sudo apt-get update && sudo apt-get install oracle-java8-installer

It will take some time to download and install so sit back and wait. Once it’s done then we have to add the
JAVA_HOME to the Ubuntu environment. Run the following in a terminal to open up the /etc/environment
file.

1 sudo gedit /etc/environment

Now, append the following at the end of the file and save it:

JAVA_HOME="/usr/lib/jvm/java-8-oracle"

3. Now its time to install the CloudSim. Unpack the downloaded 'CloudSim-3.0.3.tar.gz' or
'CloudSim-3.0.3.zip' (let the name of the unpacked folder be 'cloudsim-3.0.3'). As you can see there is no
makefile or install file inside the folder so it doesn't need to be compiled. Later if you want to remove the
CloudSim, just remove the whole 'cloudsim-3.0.3' directory.

Step 2: Setting up the Environment

Now comes the critical part, the most important part of the CloudSim setup is the setting up the paths to
different classes and jar files correctly or you won't be able to run your programs efficiently.
We need to set the 'CLASSPATH' variable which will contain the location of the class files and will be used by
the CloudSim while executing an application. So we have to set two consecutive locations first one is the
location of gridsim.jar file provided in the CloudSim and is used exclusively by the CloudSim applications and
second one is the location where we have stored our programs.

We will set the CLASSPATH in the .bashrc file of the current user so open a terminal and run the following

1 sudo gedit /home/dhyan/.bashrc

Provide the password and add the following lines at the end of the opened file and save it.

CLASSPATH=".:/home/dhyan/Desktop/cloudsim-3.0.3/jars/*:
/home/dhyan/Desktop/cloudsim-3.0.3/examples"
export CLASSPATH

Now we need to reload the .bashrc file so close the all opened terminals (if any) and run the following

1 source ~/.bashrc

Step 3: Testing the Setup (Compiling and Executing a CloudSim Application)

Finally now we can test whether our installation is successful or not. CloudSim includes some test example
programs in the 'CloudSim\examples\gridsim\' folder that we can use to test our setup.

1.​ Compiling a CloudSim program: If you have followed this DIY then compiling a CloudSim program is
pretty straightforward; the basic syntax for compilation is just similar to that of Java programs i.e. javac
filename.java or javac file_location/filename.java. Let us compile the Example2java included in
'CloudSim/examples/gridsim/example02/' folder. We will now run the following command in a new
command prompt

1 javac
/home/dhyan/Desktop/cloudsim-3.0.3/examples/org/cloudbus/cloudsim/examples/CloudSimExample
1.java
2.​ Running the compiled program: The syntax for running a compiled CloudSim program is similar to that of
running a program in Java i.e. java filename. In our case we have to type (see image 1)

1 java org.cloudbus.cloudsim.examples.CloudSimExample1

OR if you want to save the output of your program to a file you can use the following

1 java org.cloudbus.cloudsim.examples.CloudSimExample1 > output.txt

Fig: Test Image


Some Important Points

●​ It is important to set the CLASSPATH correctly, if you make any mistake you might get a class not
found error and if you want to supply the classpath externally while compiling or executing using -cp
or -classpath; then for some reason it might not work and you would still get the same errors.
●​ Remember to change the 2nd and 3rd CLASSPATH values if you later decide to move the jar files of
the CLoudSim or location of your own programs to some other location, respectively and accordingly.
●​ You can also use CloudSim with the Eclipse IDE.

Code Overview

Example Output

Detailed Explanation of Scheduling Algorithms


1.​ Round Robin (RR): Allocates tasks to VMs in a cyclical fashion, balancing workload evenly but
without optimizing task completion times.
2.​ First-Come-First-Serve (FCFS): Assigns tasks based on their arrival order, suitable for real-time or
simple scheduling.
3.​ Shortest Job First (SJF): Prioritizes tasks with shorter execution times, reducing overall latency.
4.​ Genetic Algorithm (GA): Uses an evolutionary approach, attempting to find an optimal task-VM
allocation by generating multiple candidate solutions.
5.​ Ant Colony Optimization (ACO): Inspired by the foraging behavior of ants, ACO dynamically finds an
optimized path to assign tasks to VMs.
Each algorithm has strengths suited to specific scenarios, from load balancing to minimizing latency.

Conclusion
By implementing multiple scheduling algorithms, this project offers insights into how various approaches can
impact the performance of cloud environments. The CloudSim simulation framework made it easy to
prototype, test, and evaluate these algorithms under different conditions, and the code structure is flexible
enough for future expansions.

You might also like