Concurrent and Distributed Systems (COS6012-B)
Supplementary Coursework 2
Weighting: 60% of the final mark
Date Issued: Friday, 16th April 2021
Date Due: Friday, 7th May, 2021 at 17:00 (BST)
Note: As part of the 2-week extension granted to all students by the University due to the latest
Covid-19 lockdown; you can submit until Friday, 21 May, 17:00.
The marks for each part / each question are given in brackets.
• Submit your coursework to Canvas
• Upload a single ZIP archive containing ALL your code for the four questions, and clearly
name each file in the archive with ‘question1.java’, ‘question2.java’, etc.
Note: Part B of Question 4 can be submitted as a separate file within the same ZIP archive.
Plagiarism is an offence against the University, and it will not be tolerated. No plagiarised
work will receive a mark or credit. All cases in which plagiarism is suspected will be
investigated further according to the University’s policies on plagiarism. For the details see
A Turnitin submission link will be set up in Canvas, so you will be allowed to see a report
on your draft before your final submission.
Answering the coursework questions, you are required to provide references to any
sources used. For the referencing style please use Harvard, more details are available
This coursework consists of four questions, each including tasks and questions.
You are required to complete both parts and attempt to answer all the questions.
The coursework addresses the following Learning Outcomes:
LO1: Demonstrate a sound knowledge and understanding of the construction of
concurrent and distributed systems.
LO2: Model, construct and analyse concurrent and distributed systems.
LO3: Demonstrate an analytical approach to the construction of software.
FACULTY OF ENGINEERING AND INFORMATICS
DEPARTMENT OF COMPUTER SCIENCE
Answer the following questions about Distributed Systems:
Question 1. Write an MPI program that reads an integer value from user input and
distributes the value to all the MPI processes in the communicator. Each process should
then print its own rank and the value it has received [Hint: you may use send/receive
operations or for simplicity, you can use MPI.COMM_WORLD.bcast()].
Question 2. Write a simple program to determine the value of pi. The method
evaluates the integral of 4/(1+x*x) between 0 and 1. The method performs the
following steps: the integral is approximated by a sum of n intervals; the
approximation to the integral in each interval is (1/n)*4/(1+x*x). The number of
intervals can be initialized to 100. Each process then adds up every nth interval (x =
rank/n, rank/n+size/n,...). Finally, the sums computed by each process are added
together using a reduction.
Question 3. Write an MPI Program with two processes to implement a two-dimensional
array A where each process will hold two rows from the array. Each process will
initialize the elements in its rows with its own rank. Each process will then perform the
following calculation for each element of its own rows:
Implement the necessary communication to allow processes to communicate values in their
rows to neighboring processes, then have each process calculate its elements.
Question 4. Using CloudSim, Answer the following questions:
Part A: Write a Java program that performs the following steps: [20 points]
1. Initialise the CloudSim package.
2. Create a datacenter with four virtual machines and bind them to four cloudlets.
3. Run the simulation and print simulation results.
Part B: Write a brief description of the role of the Broker in your code and describe the
settings you used for the virtual machines. [5 points] 学霸联盟