0% found this document useful (0 votes)
6 views3 pages

Parallel and Distributed Programming Exam

The document outlines an examination paper for various postgraduate programs at Griffith College Dublin, focusing on Parallel and Distributed Programming. It includes five questions covering MPI programming, synchronization in Java, Callable Threads, and an automated booking system using ReentrantLock. Students are required to attempt four out of the five questions, with each question carrying equal marks.

Uploaded by

waghray101177
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)
6 views3 pages

Parallel and Distributed Programming Exam

The document outlines an examination paper for various postgraduate programs at Griffith College Dublin, focusing on Parallel and Distributed Programming. It includes five questions covering MPI programming, synchronization in Java, Callable Threads, and an automated booking system using ReentrantLock. Students are required to attempt four out of the five questions, with each question carrying equal marks.

Uploaded by

waghray101177
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

GRIFFITH COLLEGE DUBLIN

QUALITY AND QUALIFICATIONS IRELAND


EXAMINATION

POSTGRADUATE DIPLOMA IN SCIENCE IN COMPUTING


PARALLEL AND DISTRIBUTED PROGRAMMING
Module Code: PGDC-PDP

POSTGRADUATE DIPLOMA IN SCIENCE IN BIG DATA MANAGEMENT


AND ANALYTICS
PARALLEL AND DISTRIBUTED PROGRAMMING
Module code: PGDBD-PDP

MASTER OF SCIENCE IN COMPUTING


PARALLEL AND DISTRIBUTED PROGRAMMING
Module Code: MSCC-PDP

MASTER OF SCIENCE IN BIG DATA MANAGEMENT AND ANALYTICS


PARALLEL AND DISTRIBUTED PROGRAMMING
Module code: MSCBD-PDP

Lecturer(s): Osama Abushama


External Examiner(s): Dr Joseph Rafferty

Date: 14th August 2023 Time: 2.15-5.15

THIS PAPER CONSISTS OF FIVE QUESTIONS


FOUR QUESTIONS TO BE ATTEMPTED
ALL QUESTIONS CARRY EQUAL MARKS

Page 1 of 3
QUESTION 1
Write an C MPI program for a system that consist of is made of 3 MPI processes: MPI process 0
holds a 2D array that contains an even number of consecutive integers starting from 0. You must
write a program that scatters this array, with a collective operation, such that MPI process 0 receives
nothing, MPI process 1 receives all odd numbers and MPI process 2 all even ones.

Expected output
0 1 2
3 4 5
6 7 8
9 10 11
Received on MPI process 1: 1 3 5 7 9 11
Received on MPI process 2: 0 2 4 6 8 10

(a) Write the C MPI code.


(15 marks)
(b) Write a C OpenMP version of the solution.
(10 marks)
Total (25 marks)

QUESTION 2
(a) What is the purpose of the Synchronized block?
(5 marks)
(b) What is the Similarity between yield() and sleep()?
(5 marks)
(c) Can a constructor be synchronized? Explain why.
(5 marks)
(d) What happens to the object references included in the object?
(5 marks)
(e) What is the difference between starting thread with run() and start() method?
(5 marks)
Total (25 marks)

QUESTION 3
(a) How Callable Threads implemented in java?
(5 marks)
(b) What are the limitations of intrinsic lock and advantages of ReentrantLock?
(10 marks)
(c) What are the differences between CountDownLatch and Barrier? List five.
(10 marks)
Total (25 marks)

Page 2 of 3
QUESTION 4 MPI
For the questions below, assume the following data for the integer a and the distributed integer array
b on different processors. For the entire array b, b[i] == i. The array c is initially empty on each
processor.
P0: a=0, b = [0, 1, 2, 3]
P1: a=1, b = [4, 5, 6, 7]
P2: a=2, b=[8, 9, 10, 11]
P3: a=3, b=[12, 13, 14, 15]

(a) If the command


MPI_Gather(b, 4, MPI_INT, c, X, MPI_INT, 3, MPI_COMM_WORLD);
is executed, what should the recvcnt (denoted X) above be?
(5 marks)
(b) Which process will receive the data? 0, 1, 2, 3, or all?
(5 marks)
(c) If the command
MPI_Reduce(b, c, 4, MPI_INT, MPI_SUM, 2, MPI_COMM_WORLD);
is executed, what variable receives the result of the reduction?
(5 marks)
(d) How many results will be produced?
(5 marks)
(e) Which process will receive the data? 0, 1, 2, 3, or all?
(5 marks)
Total (25 marks)

QUESTION 5
Write a Java class for an automated booking system for a theatre. The system must support multiple
users that are allowed to book a single seat at a time from a list of available seats. The system must
ensure that double booking is not permitted whilst allowing clients free choice of available seats. This
means that a seat may appear to be free although it may be booked or in the process of being booked
by another client. Implement a class that allows users to book seats whilst not permitting double
booking. You should write to methods getSeats and bookSeat. Use ReentrantLock in your code.
(25 marks)

Page 3 of 3

You might also like