> Date: Thu, 24 Aug 2000 11:28:07 -0500 > From: Troy Davis <[EMAIL PROTECTED]> > Subject: [rtl] thread scheduling in user space > > Hello all- > I want to create a thread (or process) that executes on a regular > basis (about 20 times per second - 20 hz) in user space. Doing this > using the rtlinux thread library in kernel space is very easy, but it > does not appear to be the case in user space using the regular pthread > library in linux. Another method of doing this would be to utilize a > rtlinux timer or thread in a module but I'm unsure of how to trigger a > function in user space from an event in rtlinux. What I'm > trying to do > is create an interrupt driven read/write function in user > space to send > and poll for messages over a tcp/ip connection. The messages > being sent > over tcp/ip do not need to occur in real-time, so a simple 'is there a > message? okay - send it or receive it' will work. Anyone have any > ideas on this? I'm doing something very much like this. I have a user process that opens the /dev/rtfn devices (four: command, status, data in, data out) and then does a select call to block on reading the rtl FIFO. When the real time task writes the FIFO the kernel will unblock your select call and your code to read the FIFO will run, do its thing, and call select again to block and repeat. Works great! I have bi-directional data flow from 16 channels of A/D, two D/A channels, 16 DIO bits and two 10-bit Gray code absolute position encoders with a time stamp from an IRIG-B generator board. The TCP/IP network client that talks to my rtl system is a Lab Windows/CVI application that runs the user interface the operator uses and saves the data to disk for later analysis with MatLab. I used select because I was more familiar with its semantics, but I think "poll" is the native Linux call and select is just a API layer on top of poll, so using poll directly would probably be a bit more efficient. My system normally runs at 60Hz but, has been tested at 300 Hz and worked fine on a AMD K6-233. My A/D I/O board is really lame -- DT2801. W. Richard Steven's book "Advanced Programming in the Unix Environment" has a chapter on I/0 Multiplexing which is a good place to start if not familiar with the select or poll system calls. --wally. -- [rtl] --- To unsubscribe: echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED] --- For more information on Real-Time Linux see: http://www.rtlinux.org/rtlinux/
