[En-Nut-Discussion] Thread management (killing threads)

PragmaLab info at pragmalab.nl
Tue Jul 7 10:39:27 CEST 2009


Hi all,

our application (internetradio on a Mega256 using NutOs 4.3.3) has reached
the point that new threads have to be added but RAM (heap) becomes a real
bottleneck. The good news is that by design, not all threads don't have to
run concurrent: eg we play from a card, or from the internet, never at the
same time. And there are more tasks (threads) that never will have to run
concurrent. But like most (all?) NUtOS users, we create all threads at
startup, thus claiming the stack needed for that thread, while only using it
when the trhead is not in the idle state.

To use resources in a more efficient way, the smartest thing to do seems to
manage threads in a more dynamic way: in stead of creating them at startup,
we create them at the moment we need them. And when the task is finished,
kill the thread so the resources, especially the stackspace, becomes
available again. 

I know that in the history of NutOS killing threads has always been
troublesome and I searched the archives to see what the current status was
on this topic, without any new clues. Simply calling 'NutThreadKill' from
the running thread doesn't work, at least that is my experience so far.

So:

- is anyone there using threadmanagement in a more dynamic way?
- is anyone using 'NutThreadKill()' with more succes?

Thanks for you time and answers....

Regards,

Rob van Lieshout

 




More information about the En-Nut-Discussion mailing list