Is there a difference between concurrency and parallelism in java?

前端 未结 8 1392
时光说笑
时光说笑 2021-01-30 13:35

I have been doing some research in Google and cant quite get my head around the differences (if any) between concurrent and parallel programs in java. Some of the information I

8条回答
  •  有刺的猬
    2021-01-30 14:16

    I suppose it depends on your definitions, but my understanding goes roughly like this:

    • Concurrency refers to things happening in some unspecified order. Multitasking - executing multiple programs by interleaving instructions via time slicing - is an good way to think about this sense of concurrency.
    • Parallelism (or "true" parallelism) refers to things happening at literally the same time. This requires hardware support (coprocessors, multi-core processors, networked machines, etc.). All parallelism is concurrent, but not all concurrency is parallel.

    As far as I'm aware, neither term is Java-specific, or has any Java-specific nuances.

提交回复
热议问题