LMU ☀️ CMSI 6998
CONCURRENT AND DISTRIBUTED COMPUTING
HOMEWORK #1

Learning Objectives

In this assignment you will demonstrate:

Readings, Videos, and Self-Study

Although your team will be turning in only one submission, every team member is individually responsible for each of the following:

Submission Instructions

Submit to BrightSpace a PDF or text file with:

Exercises

  1. What is the difference between concurrency and parallelism?
  2. What is the difference between a thread and a task in Java? Give an example.
  3. In Java, what happens if you invoke a method on a thread that has terminated?
  4. Give an example of livelock in the programming language of your choice.
  5. Give an example of deadlock in the programming language of your choice.
  6. Craft a table that provides information on each of the following Java entities: countdown latches, semaphores, cyclic barriers, exchangers, and phasers. The left column should contain the class names for the five entities. The second column should contain a description, and the third an example of where it would be used (without any code).
  7. Consider an implementation of the dining philosophers problem in which the first four philosophers always pick up their right chopstick first, but the fifth philosopher always picks up their left chopstick first. Can deadlock occur? Why or why not?
  8. Write, in Ada, a prime number printing program that constructs, on the fly, a chain of threads, each representing a prime number, which filters out all candidates passed through them. Start with a single thread whose job it is to test inputs for divisibility by 2. If a number is divisible by 2, go back and listen for more inputs. If a number is not divisible by 2, pass it along to the “next” thread. If there is no next thread, create a new thread for that number and assign this new thread as the next thread.
  9. Repeat the previous exercise in Java.
  10. Repeat the previous exercise in Go.