It does affect the OS, but what it does is...when it transfers execution to another thread (the scheduling) it saves the state of the processor, swaps in the next thread's info, runs the thread, pauses it again, saves the latest, swaps back another thread's info, and runs...

And so on Maybe that's not quite what it does but you see what I mean

Check out setjmp and longjmp for info on things like this...however...DON'T use them in C++ programs because they mess up constructor/destructor calls because they're very low level.