Thread and Executor Service Assignment
credit for this assignment: Voichick and Cosgrove
Building On Previous Exercises
Be sure to complete the Half & Half and Coarsening exercises first.
Thread
While we strive to make CSE 231 generally applicable across libraries and languages, it would be madness to have a parallel programming class in Java and not have students know how to create a Thread, start it, and join it. In this section of the lab, you will do just that.
Code To Use
MidpointUtils.calculateMidpoint(a,b)
As always, the wiki's reference page can be of help.
Code To Implement
ThreadHalfAndHalfNucleobaseCounter
| class: | ThreadHalfAndHalfNucleobaseCounter.java | |
| methods: | count | |
| package: | count.exercise | |
| source folder: | student/src/main/java |
count
method: public int count(byte[] chromosome, Nucleobase targetNucleobase)
(parallel implementation required)
Executors
Code To Use
As always, the wiki's reference page can be of help.
Code To Implement
ExecutorHalfAndHalfNucleobaseCounter
| class: | ExecutorHalfAndHalfNucleobaseCounter.java | |
| methods: | constructor executorService count |
|
| package: | count.exercise | |
| source folder: | student/src/main/java |
constructor
executorService
count
method: public int count(byte[] chromosome, Nucleobase targetNucleobase)
(parallel implementation required)
ExecutorCoarseningNucleobaseCounter
| class: | ExecutorCoarseningNucleobaseCounter.java | |
| methods: | constructor executorService numRanges count |
|
| package: | count.exercise | |
| source folder: | student/src/main/java |
constructor
executorService
numRanges
count
method: public int count(byte[] chromosome, Nucleobase targetNucleobase)
(parallel implementation required)
Slice the chromosome up and use invokeAll(tasks) to count the targetNucleobase in parallel.
Correctness
| class: | __ThreadAndExecutorTestSuite.java | |
| package: | count.exercise | |
| source folder: | testing/src/test/java |
Pledge, Acknowledgments, Citations
| file: | thread-and-executor-pledge-acknowledgments-citations.txt |
More info about the Honor Pledge