The difference
- Concurrency — multiple tasks make progress by switching between them. A single core can be concurrent via time-slicing
- Parallelism — tasks execute literally at the same time on multiple cores/CPUs
Threads, processes, coroutines
- Process — isolated memory space. Expensive to create and switch
- Thread — shared memory, lighter than a process. Race conditions!
- Coroutine / Fiber — cooperative switching without OS involvement. Very lightweight (PHP Fibers, Go goroutines, Python async)
PHP
PHP is traditionally synchronous: one request = one process. For true parallelism — Swoole, ReactPHP, or horizontal scaling via PHP-FPM.