Thread Lifecycle Visualizer

Interactive visualization of thread states and transitions

Controls

Thread States

New

Thread is created but not yet started

Runnable

Thread is ready to run when given CPU time

Running

Thread is currently executing

Blocked

Thread is waiting for a monitor lock

Waiting

Thread is waiting indefinitely for another thread

Timed Waiting

Thread is waiting for a specified time

Terminated

Thread has completed execution

State Transitions

Thread Contention & Concurrency Problems

This interactive section demonstrates how multiple threads compete for resources and the common problems that arise in concurrent programming.

Common Concurrency Problems

Race Condition

Occurs when multiple threads access and modify the same data concurrently, leading to unpredictable outcomes.

  • See two threads trying to update the same counter
  • Watch as concurrent updates cause data corruption

Deadlock

Occurs when two or more threads are blocked forever, waiting for each other to release resources.

  • Watch threads acquire resources in different orders
  • See how circular waiting causes the system to halt

Livelock

Occurs when threads keep changing their states in response to another thread's action, but make no progress.

  • Observe threads continuously responding to each other
  • Watch threads remain active but make no progress