[En-Nut-Discussion] Killing Processes and malloc
Moritz Struebe
morty at gmx.net
Thu Mar 13 14:06:12 CET 2008
Ole Reinhardt schrieb:
> Hi,
>
>
>> To solve this I was thinking of adding a allocated mem list for each
>> process. This does bring a bit of overhead but I think is't a worth that
>> price. The root of the list would be in NUTTHREADINFO. If a process gets
>> kill you just have to work along this list and free the mem. On an atmel
>> this will cost you 2 Bytes per process 2,5 Bytes per alloc. (I'd align
>> the blocks to a word and then use 16bit pointers.) (BTW: It should be
>> "long word" in heap.c:183)
>>
>
> For me this sounds quite interesting. Especialy I'm interested in the
> way you start other applications at runtime. How do you solve the
> linking problem? Are thos "processes" always complete instances of a
> NutOS runtime?
>
>
Basically I'm going the LegOS way. After compiling the kernel I create a
linkerscript. When compiling an application I use that linkerscript.
Therefore all the symbols which are in the kernel get resolved nicely
and the library functions don't get included.
Then I "just" have to transmit the whole thing to the node and start it.
(It's a little more complicated because you have to choose the right
linkerscipt and also need some meta information as well as Flash
allocalisation and you must not use the data-section, but that's the
basic idea.) This part is already working. Therefore I'm now trying to
get rid of all the pitfalls on the way.
APPLICATION("Thread2", 192, arg)
{
/*
* Endless loop in high priority thread.
*/
NutThreadSetPriority(16);
for (;;) {
putchar('U');
NutSleep(125);
}
}
Ends up as 56 bytes. Including quite a bit of headerinformation.
>> Of course I'd implement this with ifdefs. Is there any interest in
>> adding this to the trunk. Or has anyone got a better idea?
>>
>
> Yes I think this could be quite interesting!
>
Ok. I also already implemented realloc, because IMO this is a very handy
function. But it all needs some more testing. I'll keep you tuned. :-)
Cheers
Morty
> Cheers,
>
> Ole
>
>
More information about the En-Nut-Discussion
mailing list