I am just interested how sleep(time in ms)
is implemented in a C library or basically at the OS level...
I am guessing...
- May be the based on the processor speed you do a while loop of nop's (I am not sure if the sleep time will be accurate)...
- Any special register in processor, where you write some value and the processor simply halts for specified time (this would be very inefficient as the processor can't run even other programs).
Any clues? Probably C library source code can explain? I am not too particular about how "C" is implementing it... I am just wondering in general how the "sleep()" function is implemented.
See Question&Answers more detail:os