JavaRush
AI Academy
new
Promotion
Learning
Courses
Tasks
Quizzes
Games
Help
Schedule of nudges
Internship
Community
Users
Forum
Chat
Articles
Activities
Reviews
Subscriptions
Light theme

Lectures

  • Reviews
  • About us
  • CS50
Start
Start learning
Start learning
  • My progress
  • Courses
  • Quest map
  • Lectures
  • Deadlock: causes, examples, and fixes

    JAVA 25 SELF
    53 level,0 lecture
    In this lecture, we examine what a thread deadlock is in Java, why it happens, and which four conditions are required for it. With a practical example using synchronized, we show how to reproduce the problem, then study prevention strategies: a single resource acquisition order, using ReentrantLock.tryLock with a timeout, shortening critical sections, and avoiding unnecessary nested locks. We will show diagnosis via Thread dump and jstack, how to recognise the BLOCKED/ WAITING states, and finish with a checklist and common mistakes.
    Open
  • Livelock and Starvation: definition and examples

    JAVA 25 SELF
    53 level,1 lecture
    We examine concurrency anomalies Livelock and Starvation: how they differ from Deadlock, and how they look in code and logs. Java examples are shown: “polite workers” (livelock) and starvation due to priorities and unfair locks. We learn to detect the problem (logging, Thread dump, VisualVM, Java Mission Control) and to prevent it: random delays before retry ( Thread.sleep), non‑blocking algorithms, fair locks via ReentrantLock with the fairness flag ( new ReentrantLock(true)), careful critical sections, and avoiding abuse of setPriority() and synchronized.
    Open
  • Thread-safe collections: ConcurrentHashMap and others

    JAVA 25 SELF
    53 level,2 lecture
    In this lecture, we’ll look at why regular collections ( ArrayList, HashMap) are dangerous in a multithreaded environment, and which thread-safe alternatives the java.util.concurrent package provides: ConcurrentHashMap, CopyOnWriteArrayList, ConcurrentLinkedQueue, skip-list–based structures, and BlockingQueue. We’ll discuss atomic operations like merge, putIfAbsent, computeIfAbsent, compare them with Collections.synchronizedMap, and cover practical examples and common mistakes (weakly consistent iterators, non-atomic sequences of operations, etc.).
    Open
  • AtomicInteger, AtomicReference: atomic operations

    JAVA 25 SELF
    53 level,3 lecture
    Why the increment i ++ doesn’t work in multithreading, what atomic operations are, and how the java.util.concurrent.atomic package provides them. We break down AtomicInteger and AtomicReference, the methods incrementAndGet(), compareAndSet(...), the internal CAS (Compare-And-Swap) mechanism, as well as when it’s better to choose synchronized and when — LongAdder. Finally — typical pitfalls: compound operations, ABA, and thread safety of nested objects.
    Open
  • Diagnosing and debugging multithreaded programs

    JAVA 25 SELF
    53 level,4 lecture
    How to capture and read a Thread Dump using jstack, VisualVM, and an IDE; recognize thread states ( RUNNABLE, BLOCKED, WAITING) and find deadlocks. We will cover thread monitoring in Java Mission Control and Java Flight Recorder, logging practices (thread names, entering/exiting synchronized), minimizing locks, concurrency testing with CountDownLatch, and a real deadlock case study. Finally — common mistakes and how to avoid them.
    Open
Courses
  • Java Course
  • Python Course
  • Development with Claude Code
  • All 16 courses
University
  • Java FullStack
  • Python FullStack
  • AI Native Developer
  • Web FullStack
Community
  • Articles
  • Forum
  • Help with Tasks
Company
  • About us
  • Contacts
  • Reviews
  • Pricing
  • Questions and answers
JavaRush JavaRush: online courses in Java and other programming languages, where you learn by solving tasks. We started in 2012 with a Java course, and today there are 16 courses: Java and Spring, Python, web development, SQL, Go, C#, C++, Kotlin, Swift, Docker and AI development. More than 10,000 tasks with instant checks, and the first level of any course is free. Learn on your own or with a mentor at JavaRush University.
Follow us
Язык интерфейса
Русский
English
Українська
"Programmers are not born" © 2026 JavaRush Terms of Use and Privacy policy
MastercardVisa
"Programmers are not born" © 2026 JavaRush Terms of Use and Privacy policy