This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: R: R: Thread execution time


On Thu, 2003-08-28 at 04:00, Michele Portolan wrote:
> There is a couple of things that I still don't understand:
> When tm_basic mesures "Thread switch" it is just the time needed to make a
> context switch (i.e. save the context of old thread, load the new one's and
> let it start), is it?
> Where CYGNUM_KERNEL_SCHED_TIMESLICE_TICKS is set? I cannot find it
> I also find really strange for "ticks" to be a fixed time, regardless of the
> actual work frequency. In my configration I get a "Thread Switch" of
> approximately 50ms. So it seems that OS executes for at least as much time
> as threads. Is it correct?
> 

Think of system "ticks" as the heartbeat of the OS.  They are designed 
to be a fixed quantity, normally 10ms.  To generate such a periodic 
quantity, we rely on hardware which may have a timer run from a periodic
clock at a high rate.  This can be anything, so long as we can determine
when 10ms have gone by (and hopefully get an interrupt at that point).
The relationship between hardware clock "ticks" and system "ticks"
(sadly the same name is used for two very different things) is kept
in the constant CYGNUM_HAL_RTC_PERIOD which is calculated by the CDL
for your platform.

As for 50ms thread switch times, there is something very wrong with
your setup.  Times around 50us (1000 times faster) are more usual.

> Michele
> 
> ----- Original Message -----
> From: Andrew Lunn <andrew.lunn@ascom.ch>
> To: Michele Portolan <michele.Portolan@imag.fr>
> Cc: <ecos-discuss@sources.redhat.com>
> Sent: Thursday, August 28, 2003 12:12 PM
> Subject: Re: [ECOS] R: [ECOS] Thread execution time
> 
> 
> > On Thu, Aug 28, 2003 at 11:24:22AM +0200, Michele Portolan wrote:
> > > What do you mean by "ticks"? Do yo mean clock cycles?
> >
> > A tick is normally 10ms, but as with everything else in eCos, its
> > configurable.
> >
> > > I am working on possible modifications of context-switching mechanism to
> > > implement fault tolerance funtionalities.
> > > I have just begun, there is not much yet, but I need these data as a
> > > comparison and make some "a priori" evaluation
> >
> > Well 50ms round robin times and micro second context switches? There
> > are orders of magnitude differences here!
> >
> > What sort of fault tolerance functionalities? IMHO, they don't make
> > much sense in an embedded system. You don't have a process context you
> > can clean up when something goes wrong. The thread could have all
> > sorts of mutex's locked, semaphores signaled, memory allocated
> > etc. Killing a thread will probably result in a deadlock sometime
> > later or memory exhortion. You just have a cascade of faults....
> >
> > About the only fault tolerance functionality that makes sense to me is
> > "Something major has happened, lets try to do a controlled shutdown
> > and reboot before the watchdog timer reboot us anyway." The eCos
> > exception handling gives you enough to do this already.
> >
> >          Andrew
> > >
> > > Michele
> > >
> > > > On Thu, Aug 28, 2003 at 10:54:19AM +0200, Michele Portolan wrote:
> > > > > Hi,
> > > > > how can I know the time quantum left by eCos to a thread, i.e. the
> time
> > > > > between two context switches?
> > > >
> > > > Im not sure i understand what you mean. Do you mean how long does a
> > > > thread run before it is round robin time sliced by another thread at
> > > > the same priority? By default a thread runs for five ticks. Its
> > > > controlled by CYGNUM_KERNEL_SCHED_TIMESLICE_TICKS.
> > > >
> > > > > Is there also a way to estimate the time needed by "load context"
> only
> > > and
> > > > > not complete context switch?
> > > >
> > > > What exactly are you trying to work out? What is the reason behind
> these
> > > > questions.
> > > >
> > > >         Andrew
> > >
> > >
> > > --
> > > Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
> > > and search the list archive: http://sources.redhat.com/ml/ecos-discuss
> > >
> >
> > --
> > Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
> > and search the list archive: http://sources.redhat.com/ml/ecos-discuss
> >
-- 
Gary Thomas <gary@mlbassoc.com>
MLB Associates


-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]