timing functionalities in linux
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?
• 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?
It is quite possible to achieve microsecond level accuracy and resolution in a Linux application. It has high-resolution timers and the infrastructure required.
However, you are correct when you point out that Linux is not a real time operating system. The scheduling is normally non-preempting (since it would be inefficient to preempt), and the scheduling algorithms are oriented towards priorities rather than guaranteed response time.
You shouldn't use Linux for a critical real-time application, but for non-critical ones it could be useful (particularly if the latencies required are not less than say 10 microseconds).
There are ways to improve the real-time performance:
* use the real-time kernel patches
* remove any unnecessary daemons to reduce unpredictable disk access
* turn off the swap file
Many of the changes to allow the kernel to be preemptible have already been made in the mainstream kernel.
Latency times are reasonable (as compared to say Windows), but I would note that low latency is not the same thing as being 'real time'.
i am new to Linux. All these while i was thinking windows is the best operating system.so i was talking to one of my friends about Linux and he said in choosing any operating systems. These are the best 3 questions and i tried to answer them but i dont know if am on the right path.Am not building an application.I wish i could)) thanks neonsignal
|All times are GMT -5. The time now is 09:41 AM.|