Stephen, Norman, et al.
After an exhaustive search, I've finally isolated my cycling frequency
problem, but I don't fully understand it yet.

In order to post the problem on the mailing list, I tried to reproduce the
fault in a single file of simple code, and then found that I was able to get
frequencies > 200Hz.

It took a while to realise the crucial difference between the working code
(freq > 200Hz possible), and the non-working code (freq limited to 200Hz).
Anyway, attached is a single file of C code which reproduces the problem.
There are two ways to change the make the program work, and these are marked
in comments.

You might wonder why I've done certain things (i.e. the 1 msec delay at the
start of each start_routine), but there are good reasons to do with my
original application.

init_module creates two threads and passes each a pointer to a semaphore. 
One thread simulates a clock with a tick event every 2msec (post the
semaphore).
The other thread is an event processor. It waits for the tick event (using
semaphore), and every 500th tick (1 second), it prints a message (in the
future there will be other events which can wake up this thread).

It seems that, in start_routine_clk(), the setting up of the 2msec period is
adversely effected by the 1 msec delay before it.
Strangely, reversing the order in which the two threads are created also
removes the problem.

Hope someone of you can help get to the bottom of this.
David
 

-----Original Message-----
From: Stephen D. Cohen [mailto:[EMAIL PROTECTED]]
Sent: 16 October 2001 14:20
To: '[EMAIL PROTECTED]'
Cc: '[EMAIL PROTECTED]'
Subject: RE: [rtl] Maximum cycling frequency of 200Hz?


Mr. Hamilton,

> I'm running a test program. There are two threads.
> One is just to generate clock events for the other.
> 
> So the first thread is set up as periodic with a time 
> interval x and then
> just loops...
>       while (1)
>       {
>               pthread_wait_np();
>               semaphore->signal();
>       }
> 
> The second thread waits on the semaphore, and counts the 
> clock events until
> 1 second passes (i.e. 1/x counts) and prints actual time.
> 
> Therefore, I expect to see print messages of the actual time 
> every 1 second.

        This should work just fine, as near as I can tell.  Since it is so
simple, please post your code so we can have a look at it.  Also, how are
you getting the actual time?

> So, how do others achieve higher rates? From what I read, I get the
> impression that I have to recompile the kernel with 
> #define HZ 1000
> in params.h file.

        Absolutely not.  That is only required to adjust the normal time
slice in standard Linux.  It is not necessary for RTLinux.

Regards,

Steve


--------------------------
Stephen D. Cohen
Engineering Manager
Xybion Sensor Positioning Systems
11528 53rd Street North
Clearwater, FL 33760
Voice: (727) 299-0150
Fax: (727) 299-0804 
[EMAIL PROTECTED]
www.xybion.com



************************************************************************
THIS EMAIL, AND ANY ATTACHMENTS, CONTAINS CONFIDENTIAL AND PRIVILEGED
INFORMATION INTENDED FOR THE USE OF THE ADDRESSEE. IF YOU ARE NOT THE
INTENDED RECIPIENT OR AN AUTHORIZED REPRESENTATIVE OF THE RECIPIENT, DO NOT
READ OR DISTRIBUTE THE CONTENTS OF THIS EMAIL AND DELETE IT FROM YOUR
SYSTEM. THIS EMAIL AND ALL ATTACHMENTS HAVE BEEN SCANNED FOR VIRUSES AND ARE
BELIEVED TO BE VIRUS FREE. HOWEVER, IT IS THE RECIPIENT'S RESPONSIBILITY TO
ENSURE THAT THEY ARE VIRUS FREE. XYBION DOES NOT ACCEPT ANY RESPONSIBILITY
FOR ANY LOSS OR DAMAGE ARISING IN ANY WAY FROM USE OF THIS EMAIL AND
ATTACHMENTS. XYBION ALSO DOES NOT ACCEPT RESPONSIBILITY FOR PERSONAL EMAIL
OR EMAIL NOT ASSOCIATED WITH ITS BUSINESS PURPOSES.
************************************************************************

Attachment: loop.c
Description: Binary data

Reply via email to