[En-Nut-Discussion] Maybe obvious ...

Nathan Moore nategoose at gmail.com
Thu Nov 12 20:20:10 CET 2009


Hey Paolo,

2009/11/12 Paolo Simoncelli <simonp at email.it>

> This should be quite a silly question, but maybe someone knows ;-)
>
> Does task switching start only after a NutThreadCreate() or does some
> context switching run in the background even if just a "hello world"
> main task is running ?


> In other words is NutOs truly "monotask" if no thread is activated ?
>

When the main function is called it is in the thread called "main", which is
the second thread that is run.
The first thread that is run is the idle thread, which does some work, calls
NutThreadCreate to create
the main thread, and mostly just loops on some code that puts the processor
in low power mode over
and over.  In Nut the Idle thread must always be ready to run.

Other threads that might be running though you didn't call NutThreadCreate
directly are the receive threads
for any network devices you have, the TCP state machine thread, the PPP
state machine thread, and the
DHCP thread.  There could be more, and it's likely that not all of these are
running on your "hello world"
set up.  These threads are created by the functions you would call to set up
the network interfaces.


Nathan


More information about the En-Nut-Discussion mailing list