Thread: CPU hog

  1. #16
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398

    Another analogy!

    It's like bathrooms in the house. Most of the time they're empty, but everybody wants to use them at the same time.
    I suppose that the CPU is always querying hardware and filling buffers.
    Actually, this stuff doesn't need much CPU "power"... If your CPU monitor says 0%, then all that background stuff is taking less than 1%.

    That automobile anology was bad, because the CPU never slows down, or stops execuiting instructions. When it says 0%, then your processor is "revving" full speed in a loop that has a bunch of conditional-branch statements (machine language if-statements). 99% (or more) of the conditional statements return "false", so it is running lots of do-nothing loops... ready to jump into action when needed.

    The operating system will allocate CPU time to all running applications. If you are running only one application, then it's not so important for your program to "play-nice". But, you shouldn't use CPU time just to sit in a loop. By using Sleep(), you are telling the operating system that you aren't doing anything important, and other programs can have 100% for a while.

    Oh no! Another analogy!
    Say you go to a party, and there are three cookies for everyone. You're not hungry and you only eat one... You can either take 3 and throw 2 away, or leave the extra two for somebody who wants a couple extra. If you are the only one who shows up to the party, you can eat all you want, and throw some away without affecting anyone else.

  2. #17
    Registered User
    Join Date
    Dec 2004
    Location
    Mercer, PA
    Posts
    25
    Hahahaha nice illistration. (speaking of cookies im going to have some brownies soon!)
    I never really realized that the CPU is runing at max. I came with my own theory that when data was available the hardware that got it (keyboards, mice, network cards, ect) send info to processor to be processed. So in essence it just sits there waiting for orders. But then again that is wrong since it really is the brain that governs many things...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. pthread question
    By quantt in forum Linux Programming
    Replies: 7
    Last Post: 04-07-2009, 01:21 AM
  2. questions on multiple thread programming
    By lehe in forum C Programming
    Replies: 11
    Last Post: 03-27-2009, 07:44 AM
  3. Upgrading my old CPU (for another old one!)
    By foxman in forum Tech Board
    Replies: 16
    Last Post: 01-11-2008, 05:41 PM
  4. Can you still view the bios screen with a bad CPU?
    By HyperCreep in forum Tech Board
    Replies: 4
    Last Post: 12-31-2006, 06:57 PM
  5. CPU temp
    By PING in forum Tech Board
    Replies: 5
    Last Post: 01-28-2006, 06:25 AM