That's weird... How long does the process portion alone take?

On Tue, 25 Sep 2001, lionel wrote:

> The context :
> We are designing a realtime Radio Link Control driver with hard real time
> constraints.
>
>
> We launch 2 threads on a bi processor, 1 thread on P1, 1 thread on P2.
> Both threads run in an infinite loop and both are periodic (10 milli
> seconds).
> Both treads try to lock a mutex, make a few code then unlock the mutex (they
> try to access a shared list protected by a mutex).
> The execution time of the code between the lock and the unlock of the mutex
> is no more than a few micro seconds.
>
> But when I mesure the execution time of the code that lock, process, and
> then unlock the mutex with the help of the function clock_gethrtime(), I can
> notice than sometimes it take 5 milli seconds (the value is nearly always
> the same : 5ms +/- a few micro seconds) ???.
>
> Any help would be appreciated.
>
> Thanks.
>
> -----------------------------------------------------
> Hardware : Bi processor PIII 1 GHz 512Mo
> -----------------------------------------------------
> Software :
>   Redhat 7.1
>   Kernel 2.4.4 from kernel.org
>   RT-Linux 3.1
> -----------------------------------------------------
> Code for thread 1 (idem for thread 2 except counter2):
>
> void *thread_test1(void* notusedP) {
>
>   hrtime_t start, end, process;
>   pthread_make_periodic_np(pthread_self(), gethrtime(),   10000000); /* 10
> milli seconds */
>
>   while (1) {
>
>     start = gethrtime();
>
>    /* code that acquire a mutex here not detailled */
>
>     end = gethrtime();
>     process = end - start;
>     if (process > 1000000) { /* 1 milli second */
>       counter1+=1; // extern variable displayed when cleaning up the module
>     }
>     pthread_wait_np();
>   }
> }
>
>
> -- [rtl] ---
> To unsubscribe:
> echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
> echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
> --
> For more information on Real-Time Linux see:
> http://www.rtlinux.org/
>

-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
--
For more information on Real-Time Linux see:
http://www.rtlinux.org/

Reply via email to