[fpc-devel] custom ThreadManager and MemoryMutexManager for hard realtime

Stefan Kisdaroczi kisda at hispeed.ch
Wed Jan 6 13:31:03 CET 2010

Am 06.01.2010 12:35, schrieb Michael Schnell:
> Florian Klaempfl wrote:
>> Did you look at the xenomai website?
> Seemingly you need to do your own device drivers and not use any Linux
> system calls in your realtime process, that seems to run Linux in a kind
> of virtualization.
> So FPC programming for realtime would require to prevent FPC from
> creating Linux system calls. Thus you need a modified RTL (e.g. for
> memory management).

You can call normal linux system calls without problems, that is one of the
big features of xenomai, but of course you have to take care, it can have an
impact on the realtime performance.

I try to explain the concept:
(There are much better documents on xenomai.org)

  - Xenomai adds a realtime scheduler -> two cooperating schedulers.
  - ALL Tasks are 'normal' linux tasks, realtime task are additionaly
    registered in the realtime scheduler.
  - A realtime Task can be scheduled by linux AND xenomai:
    -> The Tasks can migrate while running from on to the other scheduler:
       running on realtime scheduler -> "primary mode"
       running on linux scheduler -> "secondary mode"
  On a linux system call in primary mode, the task will migrate to secondary
  mode automatically, with a blocking realtime call it will switch automatically
  back to primary mode.
  A lot of information is in the /proc-Interface, so you can see which task migrated
  how often to secondary mode. You can install a Trap-Handler too, which is great
  to find unwanted mode-switches.

  - Xenomai adds a Interrupt-Pipeline:
    Interrupts are handled first by the xenomai scheduler and then passed to the
    linux scheduler.
    --> Linux interrupt handling is stalled while the realtime scheduler has tasks
    to run

Device Drivers are programmed in kernel-space using RTDM:
  - RTDM is a realtime driver Interface supported by Xenomai and
    RTAI (another linux realtime extension), maybe others.
    There is also a RTDM interface for linux "native" realtime support using the
    "preempt_rt-patch" probably in mainline "soon" ...

  If you build your realtime apps as Xenomai userspace apps and make RTDM-Drivers,
  in about two years (just guessed), you will be able to run your realtime apps
  with the Xenomai Duo-Kernel approach or on the linux native preempt_rt realtime
  support without changing anything in the application or driver code, just recompile.


> -Michael
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 251 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20100106/dfe86ee7/attachment.sig>

More information about the fpc-devel mailing list