0% found this document useful (0 votes)
146 views

Java Concurrency

This document outlines a 3-day course on Java concurrency that covers advanced concepts like synchronization, thread safety, inter-thread communication, explicit locking, concurrent collections, high-level concurrency utilities, task execution frameworks, thread pools, and fork/join. The course is intended for experienced Java developers and provides both conceptual understanding and hands-on exercises to apply the new concepts.

Uploaded by

Siva
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
146 views

Java Concurrency

This document outlines a 3-day course on Java concurrency that covers advanced concepts like synchronization, thread safety, inter-thread communication, explicit locking, concurrent collections, high-level concurrency utilities, task execution frameworks, thread pools, and fork/join. The course is intended for experienced Java developers and provides both conceptual understanding and hands-on exercises to apply the new concepts.

Uploaded by

Siva
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Anika Technologies

Phone number : 7719882295


Email: [email protected]
Course Outline – Java Concurrency

Java Concurrency
DELIVERY METHODS
COURSE OVERVIEW
Public (classroom and virtual) This course provides thorough coverage of the
Private, onsite concurrency related aspects of Java platform. This is an
advanced course targeted at experienced Java
COURSE DURATION programmers. Starting off with intermediated level, this
course covers some of the most powerful and cutting
Three days, instructor-led training edge Java concurrency concepts. Driven through a
series of pedagogically designed hands-on exercises, all
TARGET AUDIENCE the new concepts learnt would be applied immediately
Experienced Java developers who want to understand
Java Concurrency and Threads with hands-on
experience and a focus on understanding the
underlying concepts.

PREREQUISITES

Basic understanding of application development using


Java
Java Collections
COURSE OBJECTIVES
Basics of Threads
IDE (Eclipse preferred) Upon completion of this course, participants will
understand how implement the following:
 Java Threads
SOFTWARE & HARDWARE REQUIREMENTS  Synchronization and Thread Safety
 Volatile and Atomics
 Latest JDK (OpenJDK preferred)  Designing for Thread safety
 Latest Eclipse for JEE  Inter-Thread Communication & Dead Locks
 Acrobat Reader  Explicit Locking and Conditions
 Thread Safe and Concurrent Collections
 Using Parallel Streams (Java 8)
 High Level Concurrency Utilities (Synchronizers)
 Task Execution Framework
 Thread Pools
 Fork/Join
Java Concurrency

1. Thread Basics
Thread class and Runnable interface
Thread States 5. Inter-Thread Communication & Dead Locks
Liveliness concept
Starting Threads
Concept of DeadLock
Thread API for Thread management
Causes of DeadLocks
Sleep, Join etc
Lock-ordering deadlocks
Strategies for stopping threads
Dynamic lock order deadlocks
Interrupt Flag
Deadlock between cooperating objects
Interrupted(),interrupt(),isInterrupted()
Lock Contention
Using Object's wait() & notify() mechanism
A Producer/Consumer problem
2. Synchronization and Thread Safety
Problems with Sharing Data Live Locks - Causes and Example
Race Conditions
'synchronized' keyword
Synchronization for creating Mutexes 6. Explicit Locking and Conditions
Why?
Monitor concept and synchronized blocks
Lock and ReentrantLock
Common misconceptions about 'synchronized'
Memory visibility semantics
ReentrantLock implementation
Using the explicit lock
Using try-finally
3. Synchronization Internals
Reordering and Visibility tryLock and timed locks
Volatile keyword Using try-lock to avoid deadlocks
Idea of 'Happens Before' Interruptible locking
Atomicity Concept Synchronized vs ReentrantLock
Atomic Types in java.util.atomic Memory semantics
Synchronization vs. Volatile vs. Atomic comparison Ease of use
Prefer synchronized
Condition Interface and Creating multiple conditions
4. Designing for Thread Safety Read-write locks
Encapsulation in the light of Thread Safety
ReadWriteLock interface
Primitive vs object fields
Understanding system to avoid starvation
Object Immutability
StampedLock (Java 8)
Idea of Leak / Escape
Difference between StampedLock and
Safe Publication
ReentrantReadWriteLock
ThreadLocal class and its uses
Pessimistic reading and writing
Optimistic reading
Conditional changes by upgrading read to write lock
Performance differences between StampedLock and
ReentrantReadWriteLock
Java Concurrency

7. Thread Safe and Concurrent Collections 9. High Level Concurrency Utilities (Synchronizers)
Synchronized collections Use Cases and Examples of using :
Old Java 1.0 thread-safe containers CountDownLatch
Synchronized wrapper classes Semaphore
Locking with compound actions CyclicBarrier
Concurrent collections Phaser (Java 7)
Scalability
ConcurrentHashMap
New Java 8 methods 10. Task Execution Framework
Executor interface
Additional atomic operations
Motivation for using Executor
Java 8 ConcurrentHashMap
Decoupling task submission from execution
CopyOnWriteCollections
Execution policies
Blocking queues and the producer-consumer pattern
Who will execute it?
How BlockingQueues work
In which order? (FIFO, LIFO, by priority)
Java implementations of BlockingQueue
Various sizing options for number of threads and queue
ArrayBlockingQueue
length
Circular array lists
Executor lifecycle, state machine
LinkedBlockingQueue
Shutdown() vs ShutdownNow()
PriorityBlockingQueue
Callable and Future
DelayQueue
Future details
SynchronousQueue
CompletionService
TransferQueue
Intro to CompletableFuture (Java 8)
Deques
Time limited tasks
ArrayDeque
Cancellation
LinkedBlockingDeque
Cooperative vs preemptive cancellation
ConcurrentLinkedDeque (Java 7)
Using flags to signal cancellation
Cancellation policies
Interruption
8. Using Parallel Streams (Java 8)
Transforming collections into streams Responding to interruption
Limitations of using parallel streams for IO
Finding prime numbers in parallel
Filtering and mapping streams
Configuring underlying Fork/Join framework
Java Concurrency

11. Thread Pools 12. Fork/Join


Sizing thread pools Basics
Danger of hardcoding worker number Breaking up work into chunks
Problems when pool is too large or small ForkJoinPool and ForkJoinTask
Formula for calculating how many threads to use Work-stealing in ForkJoinPool
CPU-intensive vs IO-intensive task sizing ForkJoinTask state machine
Mixing different types of tasks RecursiveTask vs RecursiveAction
Determining the maximum allowed threads on your Managing tasks
operating system Canceling a task
Configuring ThreadPoolExecutor Visibility guarantees with fork/join
-corePoolSize Use cases of fork/join
-maximumPoolSize
-keepAliveTime
Using default Executors.new* methods 6a.
Troubleshooting
Managing queued tasks
Basics
PriorityBlockingQueue Thread States Revisited Thread Dumps
Saturation policies Tools - jstack, visualvm
Analysing Thread dumps and dead lock detection
-Abort
-Caller runs
-Discard
-Discard oldest
Thread factories

You might also like