When I run a single-threaded program that i have written on my quad core Intel i can see in the Windows Task Manager that actually all four cores of my CPU are more or less active. One core is more active than the other three, but there is also activity on those. There's no other program (besided the OS kernel of course) running that would be plausible for that activitiy. And when I close my program all activity an all cores drops down to nearly zero. All is left is a little "noise" on the cores, so I'm pretty sure all the visible activity comes directly or indirectly (like invoking system routines) from my program.
Is it possible that the OS or the cores themselves try to balance some code or execution on all four cores, even it's not a multithreaded program? Do you have any links that documents this technique?
Some infos to the program: It's a console app written in Qt, the Task Manager states that only one thread is running. Maybe Qt uses threads, but I don't use signals or slots, nor any GUI.
Link to Task Manager screenshot: http://img97.imageshack.us/img97/6403/taskmanager.png
This question is language agnostic and not tied to Qt/C++, i just want to know if Windows or Intel do to balance also single-threaded code on all cores. If they do, how does this technique work?
All I can think of is, that kernel routines like reading from disk etc. is scheduled on all cores, but this won't improve performance significantly since the code still has to run synchronous to the kernel api calls.
EDIT
Do you know any tools to do a better analysis of single and/or multi-threaded programs than the poor Windows Task Manager?
A single threaded process will only ever run on a single core at any given moment in time.
But it's possible for the OS to migrate a thread from one core to another. While the OS will try to keep a thread on the same core, if the last core the thread ran on is busy and another core is free, the OS can migrate the thread.
The tool that you want to do deeper analysis than Task Manager can is called perfmon (perfmon.exe) - it's a UI for capturing and graphing the performance counters which instrument Windows. You can use it to monitor all sorts of information on both a system and per-process level; learn to love it - it's one of a developer's best friends.
http://technet.microsoft.com/en-us/library/bb490957.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With