Reputation:
Can a single process run different threads on different cores?
(I think they can)
In that case, do the different cores share the same address space but with different caches? Does that mean caches will be redundant?
Thanks!
Upvotes: 30
Views: 17854
Reputation: 21710
A single process can run threads simultaneously on multiple processors IF the underlying system schedules threads (and not processes) for execution (aka kernel threads). This is the way threads are implemented on most systems these days (e.g., Windows, Linux).
However, there are still some systems that schedule processes for execution. On such systems, threads are scheduled by a library (aka user threads). In other words, the process schedules its own threads for execution. On those systems, the threads for the process executing on the same processor.
Upvotes: 14
Reputation: 75669
Yes, a single process can run multiple threads on different cores.
Caching is specific to the hardware. Many modern Intel processors have three layers of caching, where the last level cache is shared across cores.
It does not mean the non-shared caches are redundant, but it does have implications for multicore performance. In particular, if one core updates a value in the address space that currently lives in another core's private cache, then a cache coherence protocol must be run to ensure that another core can no longer read a stale value.
Upvotes: 27