Deep understanding of the Linux kernel-timing measurement

Source: Internet
Author: User
Tags event timer time and date

Timing measurement: It is done by several hardware circuits based on fixed frequency oscillator and counter.



Overview of the time system:

Time-related tasks in the kernel:



Hardware devices:
Realtime Clock (RTC): 1, real Time clock, independent of the CPU and all chips, each PC has.
2, it has a special battery, not affected by the power outage of the PC.
3, can be in IRQ8 on-site periodic interruption, frequency of 2-8192hz
4. Programmable

Timestamp counter (TSC): 1, time Stamp Counter receive clock signal plus one
2, the frequency of the clock signal, if it is 1GHz, timestamp counter nanosecond plus one.

Programmable Interval Timer (PIT): 1, Programmable Interval timer
2, usually a 8354CMOS chip using the 0x40~0x43 I/O port
3, by issuing a clock interrupt to notify the kernel another time interval passed.
4. Always send interrupts with fixed to frequency

CPU Local timer: Has APIC provided, APIC (32bit), PIC (16bit), can be programmed to generate very low frequency interrupts for local timer programming
The local APIC timer sends interrupts only to its own processor, and the pit generates a global outage that any CPU can handle.
The APIC timer is based on the clock signal, and the pit is based on internal clock oscillation.

High Accuracy Event Timer (HPET):

Linux time-of-mind architecture:

The kernel periodically performs timing-related operations:
1, updated since the system started the time elapsed
2. Update Time and date
3. Determine how long the current process has been running on each CPU, and if it exceeds the time slice allotted to him, preempt it.
4. Update System Resource Usage statistics
5. Check whether the time interval of each soft timer has been reached.

Deep understanding of the Linux kernel-timing measurement

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.