[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
BOUNCE rtl@rtlinux.org: Approval required: (fwd)
- To: rtl@rtlinux.org
- Subject: BOUNCE rtl@rtlinux.org: Approval required: (fwd)
- From: Der Herr Hofrat <der.herr@hofr.at>
- Date: Tue, 15 May 2001 20:22:57 +0200 (CEST)
>From owner-rtl Tue May 15 04:04:25 2001
Received: from hq.fsmlabs.com (localhost [[UNIX: localhost]])
by hq.fsmlabs.com (8.11.2/8.11.2) with ESMTP id f4FA4Mw06778
for <rtl@rtlinux.org>; Tue, 15 May 2001 04:04:23 -0600
Received: (qmail 23177 invoked by uid 1000); 15 May 2001 09:58:42 -0000
Date: Tue, 15 May 2001 13:58:42 +0400
From: Michael Barabanov <baraban@fsmlabs.com>
To: S?bastien GAUME <sgaume@b2i-toulouse.com>
Cc: rtl@rtlinux.org, yodaiken@fsmlabs.com
Subject: Re: [rtl] Nanosleep and priority
Message-ID: <20010515135842.A23167@fsmlabs.com>
References: <3AF9123A.F7EA2DE1@b2i-toulouse.com> <20010509062023.A10023@hq2> <3AFA3D6E.C518F97C@b2i-toulouse.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.3.17i
In-Reply-To: <3AFA3D6E.C518F97C@b2i-toulouse.com>; from sgaume@b2i-toulouse.com on Thu, May 10, 2001 at 09:04:15AM +0200
Organization: FSMLabs
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 (sgaume@b2i-toulouse.com) 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 majordomo@rtlinux.org OR
> > > echo "unsubscribe rtl <Your_email>" | mail majordomo@rtlinux.org
> > > --
> > > For more information on Real-Time Linux see:
> > > http://www.rtlinux.org/rtlinux/
> >
> > -- [rtl] ---
> > To unsubscribe:
> > echo "unsubscribe rtl" | mail majordomo@rtlinux.org OR
> > echo "unsubscribe rtl <Your_email>" | mail majordomo@rtlinux.org
> > --
> > For more information on Real-Time Linux see:
> > http://www.rtlinux.org/rtlinux/
> -- [rtl] ---
> To unsubscribe:
> echo "unsubscribe rtl" | mail majordomo@rtlinux.org OR
> echo "unsubscribe rtl <Your_email>" | mail majordomo@rtlinux.org
> --
> For more information on Real-Time Linux see:
> http://www.rtlinux.org/rtlinux/