Re: heat, idle, and busy loop

From: Moe Trin (ibuprofin_at_painkiller.example.tld)
Date: 12/08/04

  • Next message: Tim Wescott: "Re: Student looking for re-readers for his thesis ( it deals with embedded system, USB, Linux, microcontrolers, firmwares ... )"
    Date: Wed, 08 Dec 2004 13:13:52 -0600
    
    

    In article <pan.2004.12.08.13.59.41.815540@hotmail.com>, Shi Jin wrote:

    >I have been having this question in mind for long a time: what is going on
    >with the system's idle process?
    >I think it is just a busy loop like
    >while(1)
    >{
    >}

    Look at your boot messages - or in /proc/cpuinfo you are looking for
    those three magic letters "hlt".

    >Somebody on the newsgroup said that the CPU(at least x86) hat have a simple
    >power saving mode that can be used in the idle loop to sleep the processor
    >until the next interrupt.
    >This is great.

    The 'HLT' machine instruction goes back at least as far as the 8086 from
    1978. The instruction literally stops the processor until an interrupt
    occurs - really, it's not "running in place" like your busy loop - it has
    stopped moving at all. Go find the instruction book for any x86 processor
    or clone (that includes AMD, Cyrix, and so on), and look at the machine
    instructions.

    >But when I write a simple c code containing the busy loop above, I see the
    >CPU usage 100% by a stupid loop program.

    Of course - it's running in circles as fast as it can.

    >I don't understand what is exactly the difference between the OS's idle loop
    >and my stupid loop.

    You know, I bet you could find this on google - did you search there?

            Old guy


  • Next message: Tim Wescott: "Re: Student looking for re-readers for his thesis ( it deals with embedded system, USB, Linux, microcontrolers, firmwares ... )"

    Relevant Pages

    • Re: programming language
      ... you will find the source code to my bf interpreter. ... instruction_pointer is the index of the instruction currently being executed in the instruction array. ... execute() is where the action happens. ... executegets a pointer to a bf_vm, where it executes one instruction, increments the instruction pointer of the bf_vm so that it points to the next instruction (or does a loop), and returns. ...
      (comp.programming)
    • Re: How much does it take to execute MMX instruction?
      ... a unrolled loop with lots of nop's in the ... This way we have accurate enough instruction timings. ... Pentium M, in general, has latency one clock cycle less, than Pentium ...
      (comp.lang.asm.x86)
    • Re: About dispatching process
      ... (Of course somewhere within the instruction sequence, it would have to check for hierarchy.) ... Subject: About dispatching process ... A disabled loop by itsself will not generate a problem. ... For IBM-MAIN subscribe / signoff / archive access instructions, ...
      (bit.listserv.ibm-main)
    • Re: Is a RISC chip more expensive?
      ... the instruction grouping rules on the 21164 were complicated. ... and these are only as good as the compiler writer... ... What makes you think there even was a scheduler? ... of the scalar b outside the loop that modified the vector a. ...
      (comp.arch)
    • Re: Sydney-X1 FPGA Computer Challenges Commodore, Amiga and Apple
      ... DUT Phase shifts measured by a PB machine code loop counter. ... the simple empty loop takes about .75 nanoseconds per iteration. ... the memory address,%esi instruction.) This addition ... that 1 instruction per clock cycle is plausible. ...
      (sci.electronics.design)