Answer the question
In order to leave comments, you need to log in
How is the multithreading of the program implemented?
I'm just wondering how does a programmer create a program that can use all the available CPU cores? After all, using 4 cores instead of 2, you can get better performance, right? But how is it implemented? Through certain instructions of the language in which you write the program or otherwise?
Answer the question
In order to leave comments, you need to log in
You still have a lot to learn before you get started.
Not always. If algorithms that can be "parallelized", if those that can't.
Any actual OS has entities such as processes and threads. And most languages have tools to deal with it all.
Regarding c++
1. API oc and any abstracting them (std::thread here)
2. https://software.intel.com/ru-ru/blogs/2011/11/21/... variety 1. but this the approach is quite different from the libraries, so it should be taken out separately.
3. Cuda www.nvidia.ru/object/cuda-parallel-computing-ru.html
4. Opencl https://www.khronos.org/opencl/ same as Cuda but not tied to nvidia
5. SIMD intrinsics not multithreading , but parallel execution at the processor level.
An example wrapper https://github.com/QuantStack/xsimd that uses them.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question