Visual Learn - Master CS concepts

Visualizing Computer Science Concepts

CS Fundamentals

Concurrency vs Parallelism vs Multithreading

They sound similar, but they happen at different levels of the system.

Animations

1Concurrency

terminal.exe
Live

    [ EXEC ]      [ WAIT ]
       |             |
       v             |
     [ ๐Ÿ‘จ ]         [   ]
    (Task 1)      (Task 2)
  
  CPU: [โ–“        ] 10%
  

The Illusion of Simultaneousness. Concurrency is about dealing with lots of things at once. It's a structure where a single worker switches between tasks quickly.

2Parallelism

terminal.exe
Live

    [ EXEC ]      [ EXEC ]
       |             |
       v             v
     [ ๐Ÿ‘จ ]         [ ๐Ÿ‘ฉ ]
    (CPU 1)       (CPU 2)
  
  SYSTEM: [โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“] 100%
  

Truly Simultaneous. Parallelism is about doing lots of things at once. It requires multiple physical workers (CPU cores) running tasks at the exact same moment.

3Multithreading

terminal.exe
Live

  PROCESS [================]
    |
    |--> ๐Ÿงต T1 [ ACTIVE ]
    |--> ๐Ÿงต T2 [ ..    ]
    |--> ๐Ÿงต T3 [ ..    ]
  

Implementation Detail. A technique where a process is split into threads that share resources but execute independently. Can be used for both concurrency or parallelism.

The Golden Rule

"Concurrency is about structure, Parallelism is about execution."