Lesson 12 Concurrency презентация
Содержание
- 2. Objectives After completing this lesson, you should be able to: Use
- 3. The java.util.concurrent Package Java 5 introduced the java.util.concurrent package, which contains
- 4. The java.util.concurrent.atomic Package The java.util.concurrent.atomic package contains classes that support lock-free
- 5. The java.util.concurrent.locks Package The java.util.concurrent.locks package is a framework for locking
- 6. java.util.concurrent.locks public String getSummary() { String s =
- 7. Thread-Safe Collections The java.util collections are not thread-safe. To use collections
- 8. Quiz A CopyOnWriteArrayList ensures the thread-safety of any object added to
- 9. Synchronizers The java.util.concurrent package provides five classes that aid common special-purpose
- 10. java.util.concurrent.CyclicBarrier The CyclicBarrier is an example of the synchronizer category of
- 11. High-Level Threading Alternatives Traditional Thread related APIs can be difficult to
- 12. java.util.concurrent.ExecutorService An ExecutorService is used to execute tasks. It eliminates the
- 13. java.util.concurrent.Callable The Callable interface: Defines a task submitted to an ExecutorService
- 14. java.util.concurrent.Future The Future interface is used to obtain the results from
- 15. Shutting Down an ExecutorService Shutting down an ExecutorService is important because
- 16. Quiz An ExecutorService will always attempt to use all of the
- 17. Concurrent I/O Sequential blocking calls execute over a longer duration of
- 18. A Single-Threaded Network Client public class SingleThreadClientMain { public static
- 19. A Multithreaded Network Client (Part 1) public class MultiThreadedClientMain {
- 20. A Multithreaded Network Client (Part 2) //Stop accepting new
- 21. A Multithreaded Network Client (Part 3) for(RequestResponse lookup :
- 22. A Multithreaded Network Client (Part 4) public class RequestResponse {
- 23. A Multithreaded Network Client (Part 5) public class NetworkClientCallable implements Callable<RequestResponse>
- 24. Parallelism Modern systems contain multiple CPUs. Taking advantage of the processing
- 25. Without Parallelism Modern systems contain multiple CPUs. If you do not
- 26. Naive Parallelism A simple parallel solution breaks the data to be
- 27. The Need for the Fork-Join Framework Splitting datasets into equal sized
- 28. Work-Stealing To keep multiple threads busy: Divide the data to be
- 29. A Single-Threaded Example int[] data = new int[1024 * 1024 *
- 30. java.util.concurrent. ForkJoinTask<V> A ForkJoinTask object represents a task to be executed.
- 31. RecursiveTask Example public class FindMaxTask extends RecursiveTask<Integer> { private final
- 32. compute Structure protected Integer compute() { if DATA_SMALL_ENOUGH {
- 33. compute Example (Below Threshold) protected Integer compute() { if (end
- 34. compute Example (Above Threshold) protected Integer compute() { if (end
- 35. ForkJoinPool Example A ForkJoinPool is used to execute a ForkJoinTask. It
- 36. Fork-Join Framework Recommendations Avoid I/O or blocking operations. Only one thread
- 37. Quiz Applying the Fork-Join framework will always result in a performance
- 38. Summary In this lesson, you should have learned how to: Use
- 39. Скачать презентацию




























![A Single-Threaded Example
int[] data = new int[1024 * 1024 * A Single-Threaded Example
int[] data = new int[1024 * 1024 *](/documents_7/13cb98dcfe545d92a2f43fb862935038/img28.jpg)









Слайды и текст этой презентации
Похожие презентации