pdserv  3.3
Process data server
pdserv - Process-Data Communications Server Library

Suppose that you have written a funky process control program. You have lots of input signals, either as a result of sampling field signals or due to calculation. Furthermore, these calculations are influenced by parameters that you would like to change from time to time.

These types of programs typically used for real time processes. A real time process is severely limited in the system resources it is allowed to use. Practically all system calls involve memory transfers of some sort. New memory space has to be allocated, which means that the calling process will be blocked for a short while.

For desktop users, this is hardly noticeable, except when swap space is being used. For real time applications, this is a show stopper!

So how can you interact with the process without using system calls? How can you see what your signals are doing without using some sort of network communication?

Description

This library allows you to do just that without using system calls in the context of your application. Of course it uses system calls, otherwise it would be rather introverted. These system calls are done in a separate communications process that is forked off during initialization. Any blocking calls to system functions will thus not influence you original application.

The two processes, i. e. your application and the communications process, communicate with each other exclusively via shared memory that was obtained by using anonymous mmap() (see the manpage) during initialisation.

So what prevents this shared memory from being swapped out, thereby blocking your process once again? YOU, if you choose! A real time application usually calls mlock() somewhere during initialization to tell the kernel not to swap out memory to disk. The library does NOT do this automatically. First of all, only root is allowed to call mlock(). Secondly, mlock() is practically called by every real time process somewhere anyway. If this is not required, the library will not force you!

This library is not limited to real time processes (in which case you would not use mlock() - see above). The only requirement is that an update() function is called every time a calculation result is completed.

Concepts

The library assumes various concepts that need explanation:

Using the library

Installing the library will present you a dynamically loadable module and a header file to include.

See the documentation in the pdserv.h as well as the example for information to use the library.

Switches that you need for compiling and linking to the library are available using pkg-config command, which reads libpdserv.pc.

    # pkg-config --cflags libpdserv
    # pkg-config --libs libpdserv

Using the default installation paths (/opt/etherlab), pkg-config will not find its specification file using its default values. To help it, call:

    # export PKG_CONFIG_PATH=/opt/etherlab/lib/pkgconfig

before calling pkg-config.

Alternatively, you can import pdserv in your CMake project using

find_package(pdserv)
target_link_libraries(myapp PUBLIC EtherLab::pdserv)

You may need to adapt CMAKE_PREFIX_PATH for CMake to find pdserv.

License

Copyright 2010 - 2019 Richard Hacker (lerichi at gmx dot net)

This file is part of the pdserv library.

The pdserv library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

The pdserv library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with the pdserv library. If not, see http://www.gnu.org/licenses/.

vim: spelllang=en spell tw=78