What is the difference between concurrency and parallelism?

前端 未结 30 3475
清歌不尽
清歌不尽 2020-11-22 00:21

What is the difference between concurrency and parallelism?

Examples are appreciated.

30条回答
  •  南旧
    南旧 (楼主)
    2020-11-22 01:12

    Concurrent programming execution has 2 types : non-parallel concurrent programming and parallel concurrent programming (also known as parallelism).

    The key difference is that to the human eye, threads in non-parallel concurrency appear to run at the same time but in reality they don't. In non - parallel concurrency threads rapidly switch and take turns to use the processor through time-slicing. While in parallelism there are multiple processors available so, multiple threads can run on different processors at the same time.

    Reference: Introduction to Concurrency in Programming Languages

提交回复
热议问题