concurrency in multiple core I know the basic definition between parallelism and concurrency. But there is not much information about
concurrency in multiple core.
what is the difference between concurrency in single-core vs concurrency in multiple-core?
Is there much difference performance-wise between concurrency in multiple core vs parallelism in multiple core?
Concurrency is not parallelism: indeed, concurrency refers to the sharing of resources in the same time frame. As an example, several processes may share the same CPU or share memory or an I/O device.
Two processes (or threads) can be defined concurrent if an only if the second process starts execution before the first has terminated (assuming that the execution happens on the same core of a multi-core CPU).
Therefore, if the two processes both run on the same core of a multi-core CPU the processes are concurrent but not parallel: in this case, parallelism is only virtual and refers to the OS doing timesharing. The OS seems to be executing several processes simultaneously. But, since the processes execute on the same core, only one instruction from one process can be executing at any particular time. Since the human time scale is billions of times slower than that of modern computers, the OS can rapidly switch between processes to give the appearance of several processes executing at the same time.
If you instead run the two processes on two different CPUS, the processes are parallel: there is no sharing in the same time frame, because each process runs on its own CPU. The parallelism in this case is not virtual but physical.
Finally, it is worth noting here that two processes running on different cores of the same multi-core CPU can not be classified as fully parallel, because the processes share the same CPU caches and will even contend for them.
It should now be clear that performance-wise, parallelism is better than concurrency.