Difference between revisions of "Threads and Executors"
Jump to navigation
Jump to search
implement
implement
implement
implement
implement
implement
implement
Line 3: | Line 3: | ||
[http://winterbe.com/posts/2015/04/07/java8-concurrency-tutorial-thread-executor-examples/ Java 8 Concurrency Tutorial: Threads and Executors] | [http://winterbe.com/posts/2015/04/07/java8-concurrency-tutorial-thread-executor-examples/ Java 8 Concurrency Tutorial: Threads and Executors] | ||
===<code>ThreadsAndExcutorsTestSuite</code>=== | ===<code>ThreadsAndExcutorsTestSuite</code>=== | ||
+ | |||
+ | =Join All Warm Up= | ||
+ | |||
+ | JoinAllTestSuite | ||
+ | |||
+ | ThreadsEventually joinAllInQueueViaPoll | ||
=Threads= | =Threads= |
Revision as of 09:42, 25 September 2017
Contents
- 1 Where To Start
- 2 Join All Warm Up
- 3 Threads
- 4 Executors
- 4.1 Videos
- 4.2 XNucleobaseCount
- 4.2.1 note countSequential
- 4.2.2 implement int countRangeSequential(byte[] chromosome, Nucleobase nucleobase, int min, int max)
- 4.2.3 implement int count2WaySplit(ExecutorService executor, byte[] chromosome, Nucleobase nucleobase)
- 4.2.4 implement int countNWaySplit(ExecutorService executor, byte[] chromosome, Nucleobase nucleobase, int numTasks)
- 4.2.5 implement int countDivideAndConquer(ExecutorService executor, byte[] chromosome, Nucleobase nucleobase, int threshold)
- 4.2.6 implement int countDivideAndConquerKernel(ExecutorService executor, byte[] chromosome, Nucleobase nucleobase, int min, int max, int threshold)
- 4.3 XQuicksort
- 5 Pledge, Acknowledgments, Citations
Where To Start
Tutorial
Java 8 Concurrency Tutorial: Threads and Executors
ThreadsAndExcutorsTestSuite
Join All Warm Up
JoinAllTestSuite
ThreadsEventually joinAllInQueueViaPoll
Threads
class SimpleThreadFactory
Video
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
Videos
Executor submit and Future get
XNucleobaseCount
note countSequential
public static int countSequential(byte[] chromosome, Nucleobase nucleobase) { return countRangeSequential(chromosome, nucleobase, 0, chromosome.length); }
implement int countRangeSequential(byte[] chromosome, Nucleobase nucleobase, int min, int max)
implement int count2WaySplit(ExecutorService executor, byte[] chromosome, Nucleobase nucleobase)
implement int countNWaySplit(ExecutorService executor, byte[] chromosome, Nucleobase nucleobase, int numTasks)
implement int countDivideAndConquer(ExecutorService executor, byte[] chromosome, Nucleobase nucleobase, int threshold)
implement int countDivideAndConquerKernel(ExecutorService executor, byte[] chromosome, Nucleobase nucleobase, int min, int max, int threshold)
XQuicksort
Pledge, Acknowledgments, Citations
hw3-pledge-acknowledgments-citations.txt