Re: Synchronizing user space threads with kernel space in linux
Apr 30, 2004 7 Replies
C
Chesney Christ
I would appreciate having hints on how to do it or pointers to
>documentation and example code if available.
What you'll need to do is create a device driver with an entry in /dev, and then set up a poll()/select() call within it. These can be used to inform a user space application that some data has arrived to be processed.
Your user space code can open the device and use the above functions which among other things provide the ability to block a thread until an interrupt is received, etc. Much more elegant than signal processing.
The free book "Linux Device Drivers" covers this subject in detail.
"Jokes mentioning ducks were considered particularly funny." - cnn.com
Didn't find your answer? Ask the community — no account required.
C
Chesney Christ
Supposedly the low-latency patch can give worst-case latency of around
150us, but you'd need to check out how this fits on your architecture.
"Jokes mentioning ducks were considered particularly funny." - cnn.com
C
Chesney Christ
Keeps everything nice and simple. There is a consistent way of dealing with hardware.
"Jokes mentioning ducks were considered particularly funny." - cnn.com
M
Michael Schnell
"Mad@Spammers" schrieb:
Look at rtc.c in the Kernel source. They provide a blocking read to the application to have it wait for an event. Her some data is provided to the application, too.
-Michael
M
Michael Schnell
Nope. Linux can't guarantee any worst-case latency at all (I did find more than 100 msek with the low-latency patch in very rare instances).
-Michael
C
Chesney Christ
That's why I was quite careful not to use the word "guarantee".
Clearly if you need hard real time performance, you need to look at another OS.
"Jokes mentioning ducks were considered particularly funny." - cnn.com
G
Guy Macon
"Hard real-time means no surprises or silent failures as system configuration changes or load increases. Deadlines will still be met. For example, the worst case delay on a 1 millisecond thread on the HP Pavilion Notebook (AMD K7) is 12 microseconds. -
formatting link
"RTAI's microkernel approach guarantees that the data-acquisition task will take place on schedule, even while the previously acquired and calculated result is written to disk." -
formatting link
"Lineo Solutions, Inc. (Lineo) demonstrated ... hard real-time support with Linux .... Deterministic time metrics of the systems demonstrated ... is as follows.
"RTAI - the Realtime Linux Application Interface for Linux ... lets you write applications with strict timing constraints for your favourite operating system." -
formatting link
"KURT-Linux: Kansas University Real-Time Linux: Microsecond timing resolution and event-driven real-time scheduling..." -
formatting link
Guy Macon, Electronics Engineer & Project Manager for hire.
Remember Doc Brown from the _Back to the Future_ movies? Do you
have an "impossible" engineering project that only someone like
Doc Brown can solve? My resume is at http://www.guymacon.com/
C
Chesney Christ
formatting link
"What is RTAI?
RTAI means Real Time Application Interface. Strictly speaking, it is not a real time operating system, such as VXworks or QNX. It is based on the Linux kernel, providing the ability to make it fully pre-emptable. "
Your serve.
[BTW, isn't RTAI a kernel - a microkernel - all by itself ? You could say that this isn't actually Linux. Linux runs essentially as a process above RTAI. This isn't necessary in an OS such as, for example, Greenhills Integrity, which provides guaranteed latency and other goodies.]
"Jokes mentioning ducks were considered particularly funny." - cnn.com
Join the Discussion
Have something to add? Share your thoughts — no account required.
Didn't find your answer?
Ask the community — no account required
Report Content
You are reporting this content to the moderators. They will look at it
ASAP.