0

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

Question 1) I am wondering 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 the 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 along with 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 though 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

Tanks for your explanations :)

[EDIT1] PS: 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 Computer is freshly formatted, installed the OS from scratch about 10 days ago as of this post

  • 3
    A CPU can stop, with HLT. It then stops doing anything until interrupted. – Daniel B Aug 6 '15 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 '15 at 22:59
  • Modern CPUs can pause themselves, as @DanielB says. This is a really important part of power management. – David Richerby Aug 7 '15 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. – David Richerby Aug 7 '15 at 8:26
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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