Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Linux - Kernel This forum is for all discussion relating to the Linux kernel.


  Search this Thread
Old 01-18-2013, 02:05 AM   #1
LQ Newbie
Registered: Dec 2011
Posts: 3

Rep: Reputation: Disabled
How to implement timer kernel


Subject: How to implement timer in Kernel to get response time of 1 milli sec from RT patch.

I have an application running every 1 milli sec and other process in same system processes some images.
System is embedded ARM OMAP with 1 GHz processor. Using 2.6.33 with PREEMPT patch.

I used the 1 milli sec in user space with timer_create() system call and whenever i get the NET_RX interrupt from ethernet driver(may be due to image transfer) my application doesn't get scheduled every 1 milli sec and misses the timeline.
So i thought to improve the scheduling of my application to every 1 milli sec, i thought to move the timers to Kernel. Is this the correct way. If yes how to do it?

Also i can see from '/proc/softirqs' i can see only NET_RX is increasing and NET_TX and SCHED values are not at all changing. Why is this so ?

If not what are the issues and any better ways.

Last edited by ashok4linux; 01-18-2013 at 02:06 AM.
Old 01-18-2013, 04:34 PM   #2
LQ Guru
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 9,078
Blog Entries: 4

Rep: Reputation: 3165Reputation: 3165Reputation: 3165Reputation: 3165Reputation: 3165Reputation: 3165Reputation: 3165Reputation: 3165Reputation: 3165Reputation: 3165Reputation: 3165
"No, probably not."

Think of it this way, instead ... your (user-mode) application needs to process "a TO-DO-LIST of images," as fast as it can. Each of the processes that are responsible for "processing images" (there should be only one, if the processing is not I/O-dependent; or more than one, if it is ...) grabs a work-request off of this queue, processes it, and sends it on its way down another queue.

There's a high-priority task which gets "immediately" notified by an incoming ethernet packet. (You don't need to dumpster-dive down to the hardware interrupt level: just listen on a port.) This task collects the incoming request and pushes it onto the TO-DO list.

There's another task that services the queue of completed requests. It runs on equal priority with the image-processing tasks, so that the outbound queue doesn't get stoppered-up, but it has relatively little to do.

The architecture thusly described is ... "flexible." It's connected, so to speak, by rubber hoses and storage tanks, so that any momentary variances in the actual workload can be "flexibly" absorbed by any of them, but the workflow system as a whole will always process the load as rapidly as it can.

After all ... the "timeline that must not be missed" simply tells the system that "a new unit-of-work has just arrived." The task that's responsible for responding to this is given a (slightly...) increased dispatching priority so that it can pre-empt the image-processing tasks, gather the new request, put it on the queue, then go back to sleep again.


embedded, interrupts, kernel config, realtime

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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to implement delay (microseconds) with real timer ticking at 100ms. mayankparasher Programming 1 12-24-2009 12:04 PM
Trouble when try to implement a timer thread using C++ steven_yu Programming 10 12-26-2007 08:12 PM
How can I implement an accurate timer under the heavey loading situation! appforce Programming 3 10-04-2005 06:58 PM
Kernel Timer koby *BSD 1 07-19-2005 05:37 AM > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 09:20 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