How to implement System Idle process

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
amirsadig

How to implement System Idle process

Post by amirsadig »

I have notice that my OS eat alot of CPU, when I run it in VMWare (emulator). I think that because my process run a loop.
what the idea behind a system idle process (like in windows or linux). is it also a 100% loop? but with low priority. that mean the scheduler will run this proccess only if there is no others task.

please correct me if I wrong!
quaak

Re:How to implement System Idle process

Post by quaak »

Use the cpu halt instruction in your idle loop.
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re:How to implement System Idle process

Post by Brendan »

Hi,
amirsadig wrote: I have notice that my OS eat alot of CPU, when I run it in VMWare (emulator). I think that because my process run a loop.
what the idea behind a system idle process (like in windows or linux). is it also a 100% loop? but with low priority. that mean the scheduler will run this proccess only if there is no others task.

please correct me if I wrong!
On some OS's the kernel just uses HLT in a loop. More advanced OS's also use power management (ACPI, APM, CPU throttling, etc) to send things (and/or the entire computer) to sleep after certain time delays expire.

IMHO the OS should make as much use of idle time as possible, especially OS's designed for desktop use where the CPU is mostly used in bursts (ie. idle time should be used as much as possible to do anything that can improve performance when the CPU isn't idle).

For example, my OS uses idle time to clean physical memory pages, perform garbage collection on kernel data and check for bad/faulty memory in addition to HLT (and eventually power management).


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Post Reply