LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 02-29-2008, 07:57 AM   #1
boo_matic
LQ Newbie
 
Registered: Feb 2008
Posts: 3

Rep: Reputation: 0
Timing questions


Hello,

I was reading a bit about kernel hacking and module programming. I read an o'reilly book about it, etc...

I was wondering if I understand this right. Is it true I can't sleep for some time that's smaller than one jiffy, 4ms? I know there's udelay and mdelay, but busy waiting isn't really an option for me.

Or are there any other options?
 
Old 03-02-2008, 04:10 PM   #2
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940
Linux is not a real-time operating system (RTOS). If you need more precise timing than that, you're going to need to be looking at other alternatives.

Which (even within Linux) do exist! What is most appropriate for your application depends upon ... your application.

P.S. You cannot "busy wait" in the kernel. For very obvious reasons . . .
 
Old 03-02-2008, 11:19 PM   #3
boo_matic
LQ Newbie
 
Registered: Feb 2008
Posts: 3

Original Poster
Rep: Reputation: 0
Thank you for your reply.

No busy-wait? I read about udelay and mdelay in an o'reilly book, they said this would be busy-waiting.

Can you tell me something about the alternatives within linux?
 
Old 03-03-2008, 08:44 PM   #4
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940
What are you trying to do?

What is the requirement that is prompting you to explore in this direction?
 
Old 03-04-2008, 10:32 AM   #5
boo_matic
LQ Newbie
 
Registered: Feb 2008
Posts: 3

Original Poster
Rep: Reputation: 0
Well,
at the moment out of curiosity, because it's interesting. I'm just trying to understand linux a bit better.

Originally I was researching some ways to send DMX with an embedded linux device, open source, not for profit. But I think I'll do this with it's uart, which fortunately can be clocked at exactly 250kbit. But there's still one moment where I need to send a 88us break.
 
Old 03-04-2008, 09:00 PM   #6
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940
That's what you should use: a UART; a hardware-device that can be programmed to issue an external signal or an interrupt after a precisely controllable interval.

Linux can field at-least a "bottom half" response to a hardware interrupt "speedily," but it does not guarantee the interrupt-latency nor does it guarantee the additional latency inherent in scheduling the "upper half" (by any other name). This is not within the design scope of this operating-system.
 
  


Reply



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 start timing and print the timing result on portions of java codes ?? alred Programming 2 05-15-2006 10:00 AM
nanosecond timing cyb0rg777 Programming 8 02-16-2006 06:43 PM
mencoder timing delos Linux - Software 1 09-27-2004 02:24 PM
timing in c++ deveraux83 Programming 2 04-20-2004 05:34 PM
timing a process jonfa Linux - General 3 10-11-2001 04:33 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 02:43 PM.

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