Ok, I think I see the problem now. The second task wakes up
as soon as the first one calls nanosleep (20 us delay sounds about right).

nanosleep puts the task to sleep and chooses the next runnable task.
If you want to see the effects of priority scheduling, try replacing
> nanosleep(&rqtp,&rmtp); // with rqtp.tv_nsec = 2000000
with
while (gethrtime() < start_time + 2000000);
i.e., a busy wait.

Michael.

S?bastien GAUME ([EMAIL PROTECTED]) wrote:
> Well, each time a task wakes up or goes to sleep, it asks for the date. In
> fact, I do :
> 
> start_time = gethrtime();
> nanosleep(&rqtp,&rmtp); // with rqtp.tv_nsec = 2000000
> end_time = gethrtime();
> 
> That's how I can check when the tasks really wake up and how long they last.
> The results show me that they last about the expected 2 ms, that they wake up
> every 5 ms and that ... the task with the lower priority level wakes up 20 us
> after the other. It makes me think that the first task is still running.
> 
> I still don't know what's wrong with that.
> 
> Sebastien
> 
> Victor Yodaiken a ecrit :
> 
> > Are you sure that the first task is still running?
> >
> > On Wed, May 09, 2001 at 11:47:38AM +0200, S?bastien GAUME wrote:
> > > Hello !
> > >
> > > I've come across surprising results while using the nanosleep function
> > > in my realtime tasks. I wrote a program in which two tasks are created.
> > > Both are periodic (running under the oneshot mode, period = 5 ms), are
> > > supposed to start at the same time and should last 2 ms. One has a
> > > greater priority level then the other. And I'm aiming to check if the
> > > realtime scheduling works well.
> > >
> > > What  really surprises me is that the task with the lower priority level
> > >
> > > always starts about 20 us after the first task ! At that moment, this
> > > task is not supposed being able to wake up and to start...
> > >
> > > I  feel the impression that the realtime tasks behave as if there is no
> > > realtime scheduling, although the fifo realtime scheduling should be on
> > > and work.
> > >
> > > So, I you have any idea of what the problem could be,...
> > >
> > > Thank you
> > >
> > > Sebastien
> > >
> > > -- [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/rtlinux/
> >
> > -- [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/rtlinux/
> -- [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/rtlinux/
-- [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/rtlinux/

Reply via email to