Programming Assignment 3
CS 51590
Parallel Programming
Spring, 2025

This assignment makes use of the files contained in this zip file. This assignment is due Monday, April 7.

This assignment is based on the dataflow-puzzles.zip examples that we used in class.

This assignment has three parts.

In the zip file there are three files that you need to complete, Dataflow_v1.java, Dataflow_v2.java, and Dataflow_v3.java. Each file asks you to solve a dataflow (task graph) synchronization problem.

In the first file, Dataflow_v1.java, implement the given dataflow graph using the "message passing" technique. See the file DataFlow_v4e.java from dataflow-puzzles.zip. In the assignment zip file there is a text file, dataflow_v1.txt, that contains a sample trace of the output from running Dataflow_v1.java.

The second file, Dataflow_v2.java, asks you to implement the same dataflow graph as the graph in the first file. In the message passing implementation you use one thread per task, for a total of ten threads. But you can achieve maximal parallelism for this graph with just four threads. The second file asks you to implement this graph with just four threads but in a maximally parallel way. You need to decide how you will schedule the ten tasks onto the four threads. And you need to decide how to synchronize the threads so that the tasks obey the dependency graph.

For the second part, in addition to your code that solves the problem, at the beginning of your Dataflow_v2.java file add a comment that explains why you must have at least four threads to implement the given task graph in a maximally parallel way.

The third part, Dataflow_v3.java, asks you to implement a slightly more complex dataflow graph using three threads in a maximally parallel solution. As in the second part you need to decide how to schedule the nine tasks onto the three threads and how to synchronize the threads. In the assignment zip file there is a text file, dataflow_v3.txt, that contains a sample trace of the output from running Dataflow_v3.java.

Turn in a zip file called CS51590Hw3Surname.zip (where Surname is your last name) containing your versions of Dataflow_v1.java, Dataflow_v2.java, and Dataflow_v3.java.

This assignment is due Monday, April 7.