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

Thiago A. Corrêa thiago.correa at gmail.com
Fri Nov 13 14:17:27 CET 2009


On Thu, Nov 12, 2009 at 5:20 PM, Nathan Moore <nategoose at gmail.com> wrote:
> 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.
>

Also, it's good to remind that Nut/OS uses cooperative threads,
meaning one thread must relinquish it's hold on the CPU before the
other runs. This happens when you call IO functions, NutSleep or
NutThreadYield. So, if your hello world had something like this:

main() {
   fprintf( fp, "Hello World" );
   while( true );
}

Then no context switching is ever happening, because of the inifinite
loop in there. Unless of course, you had a NutThreadYield in the loop.

Kind Regards,
    Thiago A. Correa



More information about the En-Nut-Discussion mailing list