Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 02-06-2010, 06:31 PM   #1
LQ Newbie
Registered: Feb 2010
Posts: 2

Rep: Reputation: 0
Unhappy timing functionalities in linux

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?


my answers


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?
Old 02-06-2010, 08:32 PM   #2
Senior Member
Registered: Jan 2005
Location: Melbourne, Australia
Distribution: Debian Stretch (Fluxbox WM)
Posts: 1,389
Blog Entries: 52

Rep: Reputation: 355Reputation: 355Reputation: 355Reputation: 355
Originally Posted by singapito View Post
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?
I'm not sure of the purpose of your questions. Are you building an application? Which parts are time critical?

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'.

Last edited by neonsignal; 02-06-2010 at 08:51 PM.
Old 02-07-2010, 07:01 AM   #3
LQ Newbie
Registered: Feb 2010
Posts: 2

Original Poster
Rep: Reputation: 0
i am new to Linux. All these while i was thinking windows is the best operating 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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
NetBeans C++ setup on Linux - problems with debugging functionalities iqbala Programming 2 12-03-2009 04:52 AM
graphical Linux router with firewall functionalities yiux Linux - Networking 0 02-20-2007 08:45 AM
how to start timing and print the timing result on portions of java codes ?? alred Programming 2 05-15-2006 10:00 AM
Linux and XP NOS functionalities farhan Linux - Networking 5 12-06-2004 04:01 AM
Adobe Photoshop like Functionalities in GIMP gem_skywalker Linux - Software 2 12-23-2003 03:54 PM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:06 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration