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: memory saving scheme for stacks


On Fri, 2004-07-23 at 13:17, sandeep wrote:
> >>Given that the threads could be interrupted and preempted at any point and any
> >>stack depth.
> > Fleshing out the idea a bit more:
> > 
> > Add a new kernel API where SST threads can indicate when they are
> > preemptable by other SST threads, i.e. when the thread usage is at its
> > lowest.
> how do you propose to decide when the thread usage is at it's lowest? - is only 
> way for this is - the responsibility comes on the programmer to code accordingly.

The idea is to place the responsibility on the programmer to correctly
scatter cyg_thread_ss_suspend/resume() throughout the code.

> but there are situations when SST can be moved out by another thread 
> (SSI/normal) as a result of it's time slice getting over. The stack usage may 
> not be at it's minimum then.

When an SST thread is inside a cyg_thread_ss_suspend(), no other SST
threads will run until that thread invokes cyg_thread_ss_resume().

As with any sharp knife, you can hurt yourself by having a SST thread
inside cyg_thread_ss_suspend/resume() wait for another SST to complete
some task(such as releasing a mutex).

There are of course many other implementation issues to be sorted out,
but I can't see any trainwreckers. This is not a trivial thing to do,
but it might be worth it. 
 
> > for (;;)
> > {
> > 	// sleep here...
> > 
> > 	cyg_thread_ss_suspend(); // do not let other SST threads run
> > 	// do processing where stack usage is at its highest
> > 	cyg_thread_ss_resume(); // let other SST threads run
> > }
-- 
Øyvind Harboe
http://www.zylin.com



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


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