LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-16-2005, 10:01 AM   #1
cnj22
LQ Newbie
 
Registered: Jul 2005
Posts: 1

Rep: Reputation: 0
Realtime networked linux


Hello all,

I'm trying to develop a real-time controller for a
nano-positioning system using a linux box (SUSE 9.3, minimal
install, PII 333MHz). Any advice from people who have worked on
similar projects or pointers to information would be very much
appreciated.

There are three basic requirements:

1. The control loop will need to run at 1kHz (ideally 5kHz) and
must sample 4 A/Ds, compute a 10x10 matrix multiplication and
then write to 3 D/As (easy within 1ms). The jitter in this loop
should be less than 10%.

2. The data collected from the D/As must then be sent over the
network to a second computer for analysis (not real-time)

3. Finally, the controller needs to be able to take commands from
another machine on the network (also not real-time)

The main problem that I've found is that the time slice for the
linux kernel is just over 1ms - so if I allow the control loop to
give up the processor (i.e. usleep(1)) to deal with a network
request, then I'll miss the next sample.

The primary questions I've got are:

1. Is this workable on a linux platform or should I move to a
RTOS? If a RTOS is the way to go could anyone point me at a free,
easy to use one that might suit (i.e. has real-time network
interface)?

2. I've read that it's possible to increase the frequency of the
time slicing in linux and that the latest kernel 2.6 is actually
running at 250Hz. If I could increase this to 2-3kHz it might
solve the problem. Is there any info on how I might do this and
would it destroy the system?

3. Does calling send() or recv() require a context switch?
i.e. could I have a single-threaded program that calls send() and
recv() once per loop and never gives up the processor?

4. I've seen timing information for the new kernel 2.6 that says
it can do a kernel thread context switch in <20us. Could someone
point me at good info for the newest implementation of pthreads?

5. I've read that kernel 2.6 has some real-time support built
in. Does increasing a thread's priority to -20 (i.e. nice(-20))
do this or am I missing something?

Thanks for any and all help!

Colin
 
Old 07-20-2005, 01:32 PM   #2
traene
Member
 
Registered: Jan 2005
Distribution: Archlinux, Debian, Centos
Posts: 222

Rep: Reputation: 35
Hello, i am sorry i haven't had an indepth look on your post. AFAIK, realtime OS have a different approach than pc - based OS. However, there are some things going on with realtime processing and linux. You may have a look at the RTLinux - Howto.

http://www.tldp.org/HOWTO/RTLinux-HOWTO.html

This may be an interessting thread also:
http://kerneltrap.org/node/5291
 
Old 08-07-2005, 11:06 AM   #3
maximurs
LQ Newbie
 
Registered: Mar 2004
Location: Netherlands
Distribution: debian 2.4.22
Posts: 4

Rep: Reputation: 0
I will suggest you have a look at RTnet<http://www.rts.uni-hannover.de/rtnet/>, a real-time networking solution on Ethernet, based on RTAI (real-time os based on normal Linux).
 
  


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
Linux realtime file replication bretticus Linux - Software 4 11-03-2005 09:28 AM
LiveFX realtime audio processor for linux daste Programming 1 10-21-2005 05:48 PM
Enhanced RTC, Chrony, Realtime Linux solarblast Linux - Software 0 03-06-2005 09:47 AM
why cant start a new RealTime linux forums vijeesh_ep LQ Suggestions & Feedback 8 01-06-2005 02:44 AM
SUSE linux w/ smp + realtime and XFS Thaidog Linux - Newbie 0 04-21-2003 10:06 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

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

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