Linux timer and time management

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.