Hi,
I’m new to QNX4, and I’m writing C programs using Watcom 10.6.
I need to store data on disk at high rate (256 bytes / msec).
Every millisecond I have a new 256 bytes data packet to write on disk.
I need to program a fast process (< 1 msec) that will do this task.
I did some tests to see how much time it takes to write a 256 bytes packet
to the disk. I changed the ticksize to 0.25 msec and I’m reading the clock
to get a timestamp. So I get a first timestamp, I write to disk and I get a
second timestamp. I put that sequence in a loop. Most of the time the
difference between the 2 timestamps is 0 but once a while I can see a
difference of 1 to 5 msec (often after 64536 bytes have been written) which
is my worst case. I feel like the Fsys.eide driver wait for his buffer to
be full before initiating a write to disk and when the write sequence start,
it last 1 to 5 msec. My process can’t be that long, my worst case must last
under 1 msec.
Instead of 1 long writing sequence, I would prefer severals small writing
sequence
I did try to change my process’ priority for a higher priority (29) but it
did not change anything.
I did try to do a fflush() after a fwrite() of 256 bytes but it didn’t
change anything.
I did try to use unbuffered file I/O → use open() with O_DSYNC option
instead of fopen but it was worse, without O_DSYNC option it was the same as
buffered file I/O.
Should I use 2 process to achieve this task? Shared Mem? Proxies?
Should I try to reduce to Fsys.eide buffer using the -m option?
Do you have any suggestions?
Thanks for your help!
Benoit