0

I studied x86_64 assembly language, somewhere in my studies, I learned that the CPU could not stop doing stuff. It must constantly run/execute something.

Question 1) I wonder then, how come there is a graph in the "task manager" that shows how much CPU is being currently utilized? Doesn't it always do something? Doesn't it always execute some binary (low-level assembly) instruction?

Question 2) I read on Wikipedia that the CPU executes the "idle" system process. Why? Can't it just loop the schedule queue back?

Let me explain. Let's assume hypothetically our CPU has 100 cycles per second:

PROCESS1 is run for 10 cycles, PROCESS1 is preempted
PROCESS2 is run for 20 cycles, PROCESS2 is preempted
SYSTEM_IDLE is run for 70 cycles, SYSTEM_IDLE is preempted
loop

Can't the CPU be fully utilized exclusively by PROCESS1 and PROCESS2?

Like:

PROCESS1 is run for 40 cycles, PROCESS1 is preempted
PROCESS2 is run for 60 cycles, PROCESS2 is preempted
loop

Lastly, I am using a fairly old computer, memory is not lacking (i.e., there is plenty available), CPU utilization is at 40% at most, usually 10%.

Here's the problem, though:

When I run my web browser alone, only 1 tab everything is smooth CPU at 7%, memory 50%

When I run my web browser and a music player, 20 tabs, everything is lagging, can't even scroll (up or down) web pages. I get like 3 frames a second. The strange thing is that CPU utilization is only at 30%, rarely going to 35%, and memory about 70% full.

Last Question: Why can't the web browser use more CPU? I wouldn't mind if it could run as smoothly as when I run the browser with only 1 tab.

I am running Windows 10 x64. Browser is: Firefox (last version), Available memory = 500MB, Firefox uses about 270MB. CPU Speed 2.77Ghz 2 logic cores, ATI Radeon X1000 256MB dedicated. The computer is freshly formatted, and I installed the OS from scratch about 10 days ago as of this post.

4
  • 4
    A CPU can stop, with HLT. It then stops doing anything until interrupted.
    – Daniel B
    Aug 6, 2015 at 21:51
  • I think you might be better off addressing the actual problem that you have, the machine specs , and data you aquired when having that problem, and leaving out the what i read on the web parts.
    – Psycogeek
    Aug 6, 2015 at 22:59
  • Modern CPUs can pause themselves, as @DanielB says. This is a really important part of power management. Aug 7, 2015 at 8:24
  • This post contains three largely independent questions. The Stack Exchange format doesn't really work well in that case: people often only answer one or two of the subquestions so it becomes hard to find everything. Please split your question into three separate ones, with one part in each. Aug 7, 2015 at 8:26

1 Answer 1

0

Most processes spend their time waiting (waiting for a network packet, waiting for the user, waiting for some other process/thread, ...). It does not make sense for the operating system to schedule that process at all - it would just return immediately and continue to wait. Uselessly looping draws power.

Instead, if all processes are waiting (more precisely: if they are blocked), the operating system will turn the CPU off, putting it into a sleep state. The "thread" which does this is called the idle task. The CPU will then stop processing instructions until an interrupt fires (telling the OS that something happened).

While the CPU is not running, the clock continues to run however. So if you turn the CPU off every 100ms, and the CPU wakes up 50ms after you put it to sleep, your CPU is 50% loaded. The same idea applies to multi-core CPUs.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .