Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

The operating system needs to be running on one or more physical cores of a multi-core processor, right? Is it possible to identify which those physical cores are using a piece of code?

share|improve this question

closed as too broad by Ƭᴇcʜιᴇ007, Ignacio Vazquez-Abrams, nerdwaller, Kevin Panko, ncdownpat Jan 19 at 14:56

There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.If this question can be reworded to fit the rules in the help center, please edit the question.

    
Not precisely. But if you got a program with high CPU usage, you can look at individual core usage in Task Manager to know it. –  tumchaaditya Jan 16 at 19:55

2 Answers 2

up vote 6 down vote accepted

Actually, the operating system (kernel) is a part of every single process that runs on the machine. So in actuality, it's not like the operating system is running on one core while user programs are running on the other cores, but rather user processes are running on every core and every single time they need to interact with the operating system, they issue a system call which transfers control to the operating system on that same core.

So, the kernel is running on all cores and most operating systems will tell you what percentage the kernel is using of each core, which is actually a measure of how both how often the userspace programs interact with the kernel and how often the kernel interrupts the userspace processes for scheduling, hardware management, etc.

share|improve this answer

That depends on what OS you use. At least with the ones supporting dtrace, you certainly can measure the kernel CPU load per core.

mpstat which is based on sampling can also report detailed per core CPU load statistics.

Unless dedicated sets/cpu binding/affinity or similar techniques are used, the kernel part of the CPU load should be balanced between all cores.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.