5

timing functionalities in linux

view full story
linux-howto

http://www.linuxquestions.org – hello everyone what are timing related functionalities in linux? what does linux have to offer with respect to measuring time? and does anyone know about the accuracy of timing for linux? thanks my answers Counters Clocks Alarm Timers Linux: • How linux keeps track of time • A Linux system actually has two clocks: One is the battery powered "Real Time Clock" (also known as the "RTC", "CMOS clock", or "Hardware clock") which keeps track of time when the system is turned off but is not used when the system is running. The other is the "system clock" (sometimes called the "kernel clock" or "software clock") which is a software counter based on the timer interrupt • First of all, I should say that you cannot guarantee user-mode processes to have exact control of timing because of the multi-tasking nature of Linux. Your process might be scheduled out at any time for anything from about 10 milliseconds to a few seconds (on a system with very high load). However, for most applications using I/O ports, this does not really matter. To minimise this, you may want to nice your process to a high-priority value (see the nice(2) manual page) or use real-time scheduling (see below) • It is difficult to get better than 10ms resolution in linux • Linux has a very simple view of what time it is; it measures time in clock ticks since the system booted. All system times are based on this measurement, which is known as jiffies after the globally available variable of the same name. Kernel response time: • Interrupt latency • ISR duration • Scheduler latency • Scheduler duration Linux Non-real-time Features – Linux scheduling algorithms are not designed for real-time tasks But provide good average performance or throughput – Unpredictable delay Uninterruptible system calls, the use of interrupt disabling, virtual memory support (context switch may take hundreds of microsecond). – Linux Timer resolution is coarse, 10ms – Linux Kernel is Non-preemptible. am i right? (HowTos)