LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (https://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   How linux kernel adapts to underlying processor frequency while calculating time? (https://www.linuxquestions.org/questions/linux-kernel-70/how-linux-kernel-adapts-to-underlying-processor-frequency-while-calculating-time-4175436734/)

gdkool 11-12-2012 01:22 AM

How linux kernel adapts to underlying processor frequency while calculating time?
 
I am running openWRT on a virtual machine on a host running Windows XP and having AMD tm 1.6 GHz processor. I observed that clock on virtual machine is running fast such that a "sleep 10" returns in less than 10 seconds (around 7-8 seconds). The current value of HZ selected during build time is 100.

Since, this is a virtual machine, and underlying hardware will keep on changing, I want to understand how linux kernel adapts with the changing processor frequency during run time while calculating time. For example, 1 second will always be equal on a kernel image whether it is running over 700 MHz Pentium processor or 1.6 GHz AMD processor .

jefro 11-12-2012 08:15 PM

Real time clock and how the system cpu is generally not the same and hasn't been since xt's. As to why this is wrong on your setup, I'd guess some setting is off or the emulator is off or what not.

Maybe this image you have was made for a device that doesn't ever change cpu speeds or the device doesn't contain a real time clock.

gdkool 11-13-2012 02:23 AM

Quote:

Originally Posted by jefro (Post 4827977)
Real time clock and how the system cpu is generally not the same and hasn't been since xt's. As to why this is wrong on your setup, I'd guess some setting is off or the emulator is off or what not.

Maybe this image you have was made for a device that doesn't ever change cpu speeds or the device doesn't contain a real time clock.

This setup is a virtual machine (running openWRT Linux on VMware Player). So, I guess, it will utilize the hardware resources of the underlying host system. I could read /proc/cpuinfo to contain the details (processor etc.) of my host machine.

Could you point me to the settings which should be altered so that the image adjusts its clock according to the underlying hardware (which I thought should have been done by default)?


All times are GMT -5. The time now is 12:06 AM.