I've always been curious as to how putting a thread to sleep works at the low level.
I've always imagined that it blocks the thread by running a loop for the specified amount of time, not letting the thread do any other work, but that would be ludicrous and still cause the CPU to do actual work.
I'm guessing it tells the Operating System to remove it from the schedule somehow? If that's the case then how does the Operating System handle it? Do runtimes that offer green threads would have to do this too?