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: periodic threads with kapi?


Ryan Boder <icanoop@bitwiser.org> writes:

> On Mon, Aug 18, 2003 at 12:32:01PM +0100, Nick Garnett wrote:
> > If the OP wants genuine periodic threads then it is probably best to
> > set up an interval alarm that posts to a semaphore each time it
> > triggers. 
> 
> Is this the normal way periodic threads are done on ecos? Seems like kind of
> a hassle for something as common as periodic threads.

I'm not sure that they are that common for the sorts of applications
we see eCos being used for.

> 
> > This would be much cheaper in terms of overhead than using
> > cyg_thread_delay(). It also allows the alarm function to detect whether
> > the periodic thread has overrun.
> 
> Why is there extra overhead? Isn't the delay function implemented with a
> thread timer that is an alarm?

Each call to cyg_thread_delay() needs to set up the thread timer
object and install it in to the alarm list. Your own alarm can be set
up and installed only once. So you are moving work that needed to be
done on each cycle out to initialization code. All your thread has to
do is wait on the semaphore each time with no need to recalculate the
next wakeup. Everything else is handled by the alarm system.

-- 
Nick Garnett                    eCos Kernel Architect
http://www.ecoscentric.com      The eCos and RedBoot experts


-- 
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]