How to encourage Windows to distribute threads to different cores?
I am wrinting multithread application using windows API, I have “main” thread created by OS to do user interface and “workers” threads doing their stuff in background. When workers thread do their jobs, my user interface gets very slow, initial investigation showed my application only consume 25% of CPU power and all threads (including first one created by OS which handle UI) run on single core. I know I could manually detect number of cores and pin threads to core by setting affinity, but I expect Windows should do this automatic, not wasting 75% of CPU power in idle. Am I expecting too much?
Threads are started by CreateThread(NULL, 1000000, ThreadFunction, 0, 0, NULL);