Article Title: linux timer and time management. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
The linux system time is controlled by a chip called a 'system timer '.
The system timer is equivalent to a crystal oscillator and generates a fixed frequency. The operating system uses this fixed frequency for timing.
The system timer sends the interrupt signal at a certain frequency. This interrupt is called a timer interrupt.
This frequency value indicates that the cycle rate is configurable. The cycle rate before linux 2.5 is 100.
Increased to 2.5 HZ after 1000
That is to say, 1000 timer interruptions are generated in one second. The advantage of increasing the frequency is:
More accurate system timing
The system performance has improved a lot.
By the way, the windows beat rate is 100.
Linux Process Scheduling is completely dependent on the system timer.
During a process scheduling, You need to calculate the time slice allocated by each process. This time slice is actually controlled by a timer interrupt.
If three processes A, B, and C are allocated time slices of 10 ms, 20 ms, and 30 ms respectively
When the process AB is used up, the time slice C is executed after 21ms.
At this time, the system with a beat rate of 1000 will directly schedule the next process.
A system with a 100 cycle will waste 9 ms until the next timer is interrupted.