Multithreading on a Single Core – How to Implement Efficiently

multi-coremultithreading

Hypothetically, if you (I / someone) were to create a multi-threaded application, utilising the processing powers of multiple cores (for example, using TPL in C#). Would that program crash, if it were run on a computer with a single core? Or rather, would the application move to context switching / time-slicing?

Best Answer

No, multi-threading is much older then multi-core cpus. Even with multi-core cpus we use today, the number of threads on our systems vastly outnumbers the amount of cores. The specifics on how cpu time is allocated to each thread is OS dependent.