Concurrency vs Parallelism

Introduction

以感情關係解釋:

  • Concurrency:2017年,你和兩個女孩交往,腳踏兩條船,為了同時維繫多個感情關係,必須時常在不同的感情中切換

  • Parallelism:2017年,你和兩個女孩交往,你很專情但最後都分手了,而一段在夏天、另一段在冬天。

Example

  • Nodejs event loop is about concurrency, as it is single-thread, but have non-blocking IO, can process different jobs at the same time - Concurrency

  • For Multi-thread with multiple CPU core, each thread can process the job at the same time - Parallel

Reference

Last updated

Was this helpful?