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]

memory saving scheme for stacks


In my system I have a number of threads that typically do a bit of
processing and then long periods of sleep.

Since only one thread can run at any one time, there is lots of 
unused stack memory at any moment in time. This can be as much as 20% of
the overall memory in the system. Ignore SMP systems here.

A scheme to reclaim this memory comes to mind:

- When a thread is created, it is marked as being special:
"stacksaving-thread". SST for short.
- Only one SST thread runs at any one time.
- All SST share the same stack memory location.
- When SST thread is switched out, the portion of the stack that is in
use is saved off to a different memory location.
- When a SST thread is switched in, the portion of the stack that is in
use is restored from the saved off location.
- The threads in my system typically have 200-1000 bytes of stack in use
at any one time => memory copy shouldn't bring the system to its knees.

I'm sure this has been done before as I can't see anything that
indicates that this is impossible.


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