Parallel coding Vs Multithreading (on single cpu)

前端 未结 7 1345
忘掉有多难
忘掉有多难 2020-12-30 13:11

can we use interchangeably \"Parallel coding\" and \"Multithreading coding \" on single cpu?

i am not much experience in both, but i want to shift my coding style t

7条回答
  •  感情败类
    2020-12-30 13:31

    The fact is that you cannot achieve "real" parallelism on a single CPU. There are several libraries (such as C's MPI) that help a little bit on this area. But the concept of paralellism it's not that used among developers working on popular solutions.

    Multithreading is common these days thanks to the introduction of multiple cores on a single CPU, it's easy and almost transparent to implement in every language thanks to thread libs and threadsafe types, methods, classes and so on. This way you can simulate paralellism.

    Anyway, if you're starting with this, start by reading about concurrency and threading topics. And of course, threads + parallelism work good together.

提交回复
热议问题