Daemon News Ezine BSD News BSD Mall BSD Support Forum BSD Advocacy BSD Updates

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

soft RT



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi everybody....

This message is sort of a follow-up to Benny Prijono's mail (16th March) 
concering soft RT capabilities in FBSD:


I have a simmilar question. Let me first briefly describe my problem:

I am working on sort of a heartbeat generation signal. This can be envisioned 
as something like a pacemaker. However it would NOT control any valves :) It 
will only send a "now" signal to some sound output program. The rate at which 
the "now" signal is sent is controled by some mathematical curve (i.e. the 
frequency of the "pacemaker" is time dependant). 
And of course... this program wont harm anybody if it is slightly out of 
sync. 

If I used /dev/rtc I would have to re-program the clock after each read() 
call to the new frequency. I was wondering if there is another approach apart 
from reading /dev/rtc....


Would the following work? :

  loop-start:
    send "now" signal to sound output program;
    usleep(microsecs);
    calculate: "offset" := time effectively slept - time I wanted to usleep();
    remember max "offset" value;
    next time I usleep() , I would usleep() "offset" usecs less;
    and spin lock / loop for the rest of the time.
  loop;

I _would_ prefer using that way instead of /dev/rtc. (easier for me)
however there are 2 questions:

   1) _apart_ from unexpected effects like trashing, etc
        could I effectively expect some maximum value for "offset" after some
        iterations? (i.e. would "offset" stay constant after lets say 100
        iterations given a normal system and no extra load). 
        
    2)  Is there a better way to achieve what I want? Did I miss smthg?

your ideas would be welcome.

greetings,
aaron.

        
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (FreeBSD)
Comment: For info see http://www.gnupg.org

iD8DBQE7cbSp6bxke2EQxE0RAlZXAKCVyZyHVmcGEc7nIn42/J+cL0BJ3ACg27AI
x/qIincHJV2UWynW4QuKeW0=
=uJ1H
-----END PGP SIGNATURE-----

To Unsubscribe: send mail to majordomo@xxxxxxxxxxx
with "unsubscribe freebsd-realtime" in the body of the message