• Competitor rules

    Please remember that any mention of competitors, hinting at competitors or offering to provide details of competitors will result in an account suspension. The full rules can be found under the 'Terms and Rules' link in the bottom right corner of your screen. Just don't mention competitors in any way, shape or form and you'll be OK.

How do they know?

Associate
Joined
31 Jul 2005
Posts
894
Location
Edinburgh
I have a Dual core CPU and was wondering how does the system know what core to use? I look at the performance monitor and it shows Core 0 doing most of the work but Core 1 does a bit too. This constantly varies but I was wondering how the work is divided up? My CPU only runs at 50-60% when I'm playing games etc.
 
Windows has a task (process/thread) scheduler in its kernel, it decides what core to schedule a particular processes/thread's timeslice on. Generally it will try to keep processes/threads on the same processor for various efficiency reasons. (Moving a thread may invalidate CPU cache's etc.) If however the core a task had its last timeslice on is actually busy with something else when the task becomes runnable again, and the other core is free at that point, Windows will obvisouly rather schedule the timeslice on the other core than have a ready process wait while a core is available to service it (as common sense would also dictate.) Hence why you'll sometimes see processes switching cores etc. whether temporarily or for a longer period.

For single threaded applications therefore the most CPU an app can consume is 100% of one core's cycles (e.g. 50% of the total CPU cycles.) As most games are still single threaded this is why you see about 50%-60% overall CPU usage -- the game takes up as much cycles as it can based on it's single thread, probably running mostly on one of the cores, and the rest of the system's processes, which take up fairly little cpu, effectively gets scheduled on the other core.

Apps with at least 2 independent CPU intensive threads could make use of something approaching 100% of the available CPU cycles on a dual-core system (making allowances for some thread syncronization and the rest of the system etc.) Obviously if the app has 2 threads but one is IO bound (e.g. waits for disk IO more than anything else for example), it will still only use something just over 50% of the available CPU cycles.
 
Last edited:
Back
Top Bottom