Task allocation with available logical CPUs is the task of the operating system. If you are writing a multi-threaded application, the OS will control the distribution of various threads to the hardware processors in the system. You have nothing to do as a programmer to make this happen.
However, you can manage this directly - link a specific thread to work on a specific core or a subset of logical processors, but as a rule, it is less efficient than allowing the OS to control the distribution of hardware, since it has a broader understanding of all the processes that work in the system and in In most cases, it handles the distribution in the most efficient way.
In short, if your application is multithreaded, it will run on as many available cores as the system will provide.
J ... source share