Realtime Data Acquisition with QNX


Author, Designer and Project Maintainer: Stephen Manley - smanley@nyx.net
Like to see more of this software? Send me an email or check out my other cool projects.

Introduction

The goal was to develop different approaches to control a multithreaded, multinode data acquisition network and to categorize baased on the theoetical and practical thoroughput of the system. This system was to make use of the realtime operating system features available in the QNX OS. Specifically, multiprocess communication controlled with Sempahores (shared memory) in one case and Message Passing in the other. Additionally, for bonus marks, an approach using message queues was used as well.

A complete report in Wordperfect 8 format is available for download with discussions of the preformance and system architectures. You can download it here. This also includes the full table of experimental results, conditions, etc.

Usage

This system requires an interface to a data acquisition card. Since there's no way you're going to have the DTL board we're running, some tweaks to the interrupt code and the reading protocols is probably going to be in order. Once this is done, you too can see how QNX multiuser features can be used in DAQ systems. Wheee. I should port this to linux. If you're interested let me know. Linux needs some more realtime operating system features in the kernel, but, otoh, Linux needs to have a reason for those features :).

Message Passing

This approach makes use of the QNX operating system features for message passing using direct naming. The message primitives Send(), Reply(), and Recieve(). The program executes and spawns two additional program threads to act as two readers, ReaderA and ReaderB. The main process acts as a data collection and message handling proceedure. Readers A and B request data from the server and block until a reply is obtained which contains the 32 bit sampled value.

The readers send a request for data and the block. The collector process waits for a request and then sends a reply message that contains the information.

The complete source code is available. (Including illustrative comments!)

Shared Memory (Semaphore Protection)

These functions make use of built in semaphore protected memory. The QNX features new_queue(), queue_get() and queue_put() are used to set up and preform IO on the message queue. Mutual exlusion is used to maintain casuality amoung the processes using the shared memory buffer. A Collect process handles filling the memory with samples, and the two readers are passed a queue to remove the data from.

The complete source code is available. (Including illustrative comments!)

Message Queues

In a similar fashion to share memory, a QNX message queue was used to implement the same functionality. mq_send() and mq_recieve() are used to pass the information between the collection process and the two reader processes. Message queues are priority driven and as such are assigned a priority of zero to make sure that optimial efficiency is obtained.

The reader processes attempt to take a message out of their queue and then block until a message arrives. The collector process adds messages (data) to the queue and then waits for another cycle.

The complete source code is available. (Including illustrative comments!)

Preformance Results

Some statistics of overall preformance times from the three approaches tested:

Table of Results

Experimental Results Table - Message Queues - Node 3
Process Name Test 1 Test 2 Test 3
Reader A 44.160ms 44.036ms 44.036ms
Reader B 44.160ms 44.036ms 44.036ms
Collector 44.160ms 44.036ms 44.036ms

A complete table of results is abailable in the full writeup in wordperfect format. See above.

Download and Liscencing

This program is released under the terms of the GNU Public Liscence. Do what you will with it. If you are interested in it closed-source, email me and we can work something out. Please contact me if you are / are interested in working on this project further.

Grab the complete source code


Last Edited: 09/21/99
Created: 09/21/99
Maintained By: Stephen Manley - smanley@nyx.net