Threads and Executors
Revision as of 21:50, 24 September 2017 by Cosgroved (talk | contribs) (→note int countSequential(byte[] chromosome, Nucleobase nucleobase))
Contents
- 1 Threads
- 2 Executors
- 2.1 XNucleobaseCount
- 2.1.1 note int countSequential(byte[] chromosome, Nucleobase nucleobase)
- 2.1.2 implement int countRangeSequential(byte[] chromosome, Nucleobase nucleobase, int min, int max)
- 2.1.3 implement int count2WaySplit(ExecutorService executor, byte[] chromosome, Nucleobase nucleobase)
- 2.1.4 implement int countNWaySplit(ExecutorService executor, byte[] chromosome, Nucleobase nucleobase, int numTasks)
- 2.1.5 implement int countDivideAndConquer(ExecutorService executor, byte[] chromosome, Nucleobase nucleobase, int threshold)
- 2.1.6 implement int countDivideAndConquerKernel(ExecutorService executor, byte[] chromosome, Nucleobase nucleobase, int min, int max, int threshold)
- 2.2 XQuicksort
- 2.1 XNucleobaseCount
Threads
class SimpleThreadFactory
implement Thread newThread(Runnable target)
Create and return a new thread with the target Runnable parameter you are passed.
Do *NOT* start this thread.
Certainly, do *NOT* run this thread.
Do not pass Go. Do not collect $200.
To repeat: just create a new Thread with the target Runnable and return it.
TAgeSum
implement int sumUpperLowerSplit(int[] ages, ThreadFactory threadFactory)
You will need use the passed in ThreadFactory to create a new thread or two (at your preference), start any threads you create, and join them.
Think about where you need to start and join any Threads to ensure both correctness and an appropriate amount of parallelism.
Executors
XNucleobaseCount
note int countSequential(byte[] chromosome, Nucleobase nucleobase)
public static int countSequential(byte[] chromosome, Nucleobase nucleobase) { return countRangeSequential(chromosome, nucleobase, 0, chromosome.length); }