Skip to content

Concurrency and Parallelism

Concurrency is the composition of independently progressing tasks. Parallelism is simultaneous execution of computations. A concurrent design may run on one core through interleaving; a parallel execution needs multiple processing resources.

gantt
    title Concurrent interleaving on one worker
    dateFormat X
    axisFormat %L
    section Worker
    Task A :a1, 0, 3
    Task B :b1, 3, 2
    Task A :a2, 5, 2
    Task B :b2, 7, 3

Concurrency is often about responsiveness and managing waiting. Parallelism is often about reducing elapsed compute time or increasing throughput. They overlap when concurrent tasks execute simultaneously.

Learning sequence

  1. Threads and tasks
  2. Safety and liveness
  3. Java Memory Model
  4. Executors and futures
  5. Parallel computation

Shared concerns

Race conditions, visibility failures, deadlock, starvation, load imbalance, and oversubscription do not belong exclusively to either concurrency or parallelism. They arise from coordination, memory, scheduling, and workload structure.

Apply the operational consequences through pools and bounded resources, resilience controls, and the debugging and profiling workflow.