Multi core load balancing?

sam1275tom

Reputable
Oct 13, 2014
462
0
4,860
Hello everyone, I found a interesting thing, when I use only one core of my CPU, it seems it's not really stress only one core, but the load is divided to all cores. Just see the pictures:
VsgKpl.png

gOAFIn.png

In the pictures we can see while running WinRAR benchmark in single thread mode, all cores are working, although the first core is the busiest one. And finally the total compute power equals one core (25% total).
My CPU is a quad core one with no HT, OS is Windows 7 Ultimate SP1. I want to know who does the load balancing? The CPU/PCH or the OS? Thank you.
 
Solution


It's not load balancing, it's scheduling. Your...


It's not load balancing, it's scheduling. Your benchmark is not the only running task that requires CPU time.

The Windows NT kernel (along with almost all other modern kernels) work on a kernel-thread scheduling model. Each process has one or more kernel threads and each thread may be in running/waiting/suspended state.

Threads that are running are currently executing on the logical processors.

Threads that are waiting are currently waiting for a logical processor to be available.

Threads that are suspended are waiting for a system call to complete before execution can resume.

The Windows NT scheduler is preemptive which means that whenever a high priority thread becomes ready it will immediately replace a lower priority thread that is running (moving it to the waiting state). A higher priority thread will only ever have to wait if all logical processors are occupied by threads of equal or higher priority. Threads of the same priority are scheduled in a round-robin fashion with each thread receiving a small chunk of time until it either terminates or is suspended.

What you're seeing is the kernel scheduler periodically moving the benchmark around as threads belonging to other processes take priority or are scheduled in its place.
 
Solution
OS task scheduler balances the load. Yes, WinRAR stresses one core, but there're more processes in system appart from WinRAR which WinRAR relies on. WinRAR has no direct access to the hard drive, instead it asks OS to read data from and write data to the HDD. And while WinRAR does its compression job in a single-threaded mode, system processes (drivers) that actually read/write data to/from HDD do their job in other threads that "occupy" the other cores.

BTW, did anyone try this app http://cpuloadvisor.com for load balancing?