nanosleep high cpu usage?
问题 I noticed that a little test program which calls nanosleep is showing a huge difference in CPU usage when run on Linux machines with a kernel newer than 2.6.22. #include <time.h> int main (void) { struct timespec sleepTime; struct timespec returnTime; sleepTime.tv_sec = 0; sleepTime.tv_nsec = 1000; while (1) { nanosleep(&sleepTime, &returnTime); } return 0; } (Yes, I realise this program does nothing) If I compile this and run it on an openSUSE 10.3 machine (2.6.22.19-0.2-default), the