Chava Leviatan wrote:
I have a kernel thread which needs to be woke-up every 50 mili
seconds (un-conditionaly) to be used as
a periodic timer
Are you sure a simple kernel timer is not a better option? why do you need a
new kernel thread for this?
The kernel version I am using is 2.4.18 .
I have made a small research and found 2 possibilities:
schedule_timeout
interruptible_sleep_on_timeout.
What wrong with?
msleep(50*HZ/1000);
Not sure if it's available in the ancient 2.4.18 version though.
I made some experiements with both of them , and under a medium load
(24Mbit) , it seems that
the interruptible is more accurate. The schedule has deviation of
several miliseconds every
50/100 samples (I totally took a batch of 150 samples - each sample
is a 50 mili interval ).
The interruptible_sleep, has also that deviation , but less frequent
(once per batch), and the overall
picture shows that it is more accurate.
Make sure to give your kernel thread real time scheduling priority (SCHED_RR or
SCHED_FIFO).
Making sur eno driver blocks interrupts for long time is also a good idea :-)
On the other hand, I have read that the interruptible_sleep is less
stable and gets into race conditions.
The question is : Did everyone tried to work with both of those
APIs? If the interruptible_sleep is called unconditionaly , does it
still un-recommended for use ?
The race condition people mention with interruptible_sleep_on_timeout is
related to using it with a condition.
msleep is still better, though.
Hope this helps,
Guilad
--
Gilad Ben-Yossef <[EMAIL PROTECTED]>
Codefidence. A name you can trust(tm)
Web: http://codefidence.com | SIP: [EMAIL PROTECTED]
IL: +972.3.7515563 ext. 201 | Fax: +972.3.7515503
US: +1.212.2026643 ext. 201 | Cel: +972.52.8260388
Resistence was futile.
-- Danny Getz, 2004.
=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]