[En-Nut-Discussion] Thread management (killing threads)
PragmaLab
info at pragmalab.nl
Tue Jul 7 20:57:22 CEST 2009
Hi Morty,
> the main problem with killing threads is the memory
> management. You need to know which memory was allocated to
> which thread, so you can free it when you kill a thread.
> About a year ago I've written some code to do this and also
> sent some patches which partly made it into the Nut/OS
> codebase. If you are interested I can search that code.
> Shouldn't be too much trouble to add it to the current
> codebase, as HEAPNODE ist now used everywhere.
> Basically you have to add an thread-element and a
> next-element to HEAPNODE. When allocating you write
> current-thread to the memory and link it into the list (as
> with the debug-code). When killing a thread you need to walk
> the list and free all memory which isn't needed any more.
>
> I can also send you my Diploma Theses, which also describes
> this problem. It's in German, though.
I'll be more then happy to read more about the subject in your Diloma
Theses. German is OK (will take me a bit longer to read, but it will make me
realize that I didn't take my German lessons for nothing all those years).
In fact, I started to modify the NutOS code already to be able to 'find
back' the allocated blocks that got associated with the thread, but then
realized that someone else might had run into the same problem. If you could
share the specific code with me, it would be very much appreciated.
The struct itself (NUTTHREADINFO) doesn't seem to get removed either when
killing the thread, is it?
Thanks and best regards.....
Rob (info - at - pragmalab.nl)
More information about the En-Nut-Discussion
mailing list