Re: heat, idle, and busy loop
From: Moe Trin (ibuprofin_at_painkiller.example.tld)
Date: 12/08/04
- Previous message: Jerome Plut: "Samsung YEPP YH-920 mp3 player"
- In reply to: Shi Jin: "heat, idle, and busy loop"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message: Jerome Plut: "Samsung YEPP YH-920 mp3 player"
- In reply to: Shi Jin: "heat, idle, and busy loop"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|