Mastering Concurrency Programming with Java 8


Javier Fernández. González
Bok Engelsk 2016 · Electronic books.
Annen tittel
Utgitt
Birmingham : : Packt Publishing, , 2016.
Omfang
1 online resource (430 p.)
Opplysninger
Description based upon print version of record.. - Cover ; Copyright; Credits; About the Author; About the Reviewers; www.PacktPub.com; Table of Contents; Preface; Chapter 1: The First Step - Concurrency Design Principles ; Basic concurrency concepts; Concurrency versus parallelism; Synchronization; Immutable object; Atomic operations and variables; Shared memory versus message passing; Possible problems in concurrent applications; Data race; Deadlock; Livelock; Resource starvation; Priority inversion; A methodology to design concurrent algorithms; The starting point - a sequential version of the algorithm; Step 1 - analysis; Step 2 - design. - Basic components of the executor frameworkFirst example - the k-nearest neighbors algorithm; K-nearest neighbors - serial version; K-nearest neighbors - a fine-grained concurrent version; K-nearest neighbors - a coarse-grained concurrent version; Comparing the solutions; The second example - concurrency in a client/server environment; Client/server - serial version; The DAO part; The command part; The server part; Client/server - parallel version; The server part; The command part; Extra components of the concurrent server; Comparing the two solutions; Other methods of interest; Summary. - Chapter 3: Getting the Maximum from Executors Advanced characteristics of executors; Cancellation of tasks; Scheduling the execution of tasks; Overriding the executor methods; Changing some initialization parameters; The first example - an advanced server application; The ServerExecutor class; The statistics object; The rejected task controller; The executor tasks; The executor; The command classes; The ConcurrentCommand class; Concrete commands; The server part; The ConcurrentServer class; The RequestTask class; The client part; The second example - executing periodic tasks. - Step 3 - implementationStep 4 - testing; Step 5 - tuning; Conclusion; Java concurrency API; Basic concurrency classes; Synchronization mechanisms; Executors; The Fork/Join framework; Parallel streams; Concurrent data structures; Concurrency design patterns; Signaling; Rendezvous; Mutex; Multiplex; Barrier; Double-checked locking; Read-write lock; Thread pool; Thread local storage; The Java memory model; Tips and tricks to design concurrent algorithms; Identify the correct independent tasks; Implement concurrency at the highest possible level; Take scalability into account. - The common parts. - Use thread-safe APIsNever assume an execution order; Prefer local thread variables over static and shared when possible; Find the more easily parallelizable version of the algorithm; Using immutable objects when possible; Avoiding deadlocks by ordering the locks; Using atomic variables instead of synchronization; Holding locks for as short a time as possible; Taking precautions using lazy initialization; Avoiding the use of blocking operations inside a critical section; Summary; Chapter 2: Managing Lots of Threads - Executors ; An introduction to executors; Basic characteristics of executors
Sjanger
ISBN
978-1-78588-612-6

Bibliotek som har denne