Skip to content

Multithreading & Concurrency

Core Topics

  • Thread Basics: Creating threads (Thread class, Runnable, Callable)
  • Thread Lifecycle: NEW, RUNNABLE, BLOCKED, WAITING, TIMED_WAITING, TERMINATED
  • Synchronization: synchronized keyword, intrinsic locks
  • volatile Keyword: Visibility guarantees, happens-before relationship
  • wait(), notify(), notifyAll(): Inter-thread communication
  • Locks: ReentrantLock, ReadWriteLock, StampedLock
  • Thread Pools: ExecutorService, ThreadPoolExecutor, ForkJoinPool
  • Concurrent Collections: ConcurrentHashMap, CopyOnWriteArrayList, BlockingQueue
  • Atomic Variables: AtomicInteger, AtomicReference
  • Future & CompletableFuture: Asynchronous programming

Key Internals to Understand

  • Java Memory Model (JMM) - happens-before relationships
  • Thread scheduling by JVM
  • Lock implementation internals
  • Compare-and-Swap (CAS) operations
  • Thread contention and performance implications
  • Lock striping technique
  • Fork-Join framework architecture

Notes