Is it possible that a single-threaded program is executed simultaneously on more than one CPU core?
Posted
by Wolfgang Plaschg
on Stack Overflow
See other posts from Stack Overflow
or by Wolfgang Plaschg
Published on 2010-01-05T19:25:54Z
Indexed on
2010/04/18
9:23 UTC
Read the original article
Hit count: 391
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?
© Stack Overflow or respective owner