On UP machines the best way to work is clearly to have both Linux and RTAI work UP. Notice however that with a kernel compiled UP you can use all the available RTAI schedulers.
If you have an SMP kernel and want to run it on a UP machine than you have to use rtai_sched_8254.
Q: Is there a specicfied minimum period for an rt_task service? I mean to ask, when we make a task periodic , how fast can I do it?
A: You won't get much better than 20us worst case interrupt latency with RTAI, at 50us minimum period. And then you have to be picky about the motherboard; older designs seem to be better than the current state of the art for realtime response.
A: The "Latency" value you mentioned is used by the scheduler to determine and program the delay for the next timer interrupt:
$ cat rtai_sched.c ... delay = (int)(rt_times.intr_time - (now = rdtsc())) - tuned.latency;It should therefore be adjusted appropriately for your system. On X86 this is done automatically, I think, but on PowerPC it should be set via module parameter:
$ insmod rtai_sched.o Latency=50000
Q: We have a kernel module that provides some system calls. We used the LXRT method for extending these calls to userspace apps. We have one method which has a critical region, and I would normally use a semaphore to guard it, but I'm unsure about using the rt_sem_wait inside the kernel module - I'm afraid of hanging the system. (I'm thinking that application 1 makes the call, putting the kernel module in the critical region. Application2 then makes the same call, and the kernel module tries to take the semaphore - what happens next?)
A: (from the mailinglist archive)
Negative time is due to the fact that RTAI do some kind of calibration at startup (there is even a tool for fine tuning somewhere in rtai dir) This calibration try to minimize jitter of rt-task and usually it requires to anticipate call of rtai task to recover time delays
In some good cases the time delays are less than expected and rt-task shot before it's time
If you don't like this beavior you can just wait to real fire time with a simple "wait until fire time" as first step in the rt-task routine