On 1/3/2010 5:53 PM, [email protected] wrote:
It's not an issue, except possibly vis-a-vis battery life in a laptop.
I haven't looked at the source code, but there are other concerns with the "while (true) { checkStuff(); Sleep(0); }" approach.
According to the TFM, Sleep(0) is effectively a NOP when there are no other processes at that priorty ("If there are no other threads of equal priority ready to run, the function returns immediately, and the thread continues execution.").
It also follow from the TFM that it will keep lower priority processes from running at all.
For me, I'm most worried about behavior under virtualization -- this is unlikely to play nice under a VM unless you choose a non-work conserving scheduler (which most people don't choose).
I would add that laptops are not the only machines these day that do effective power management. This will likely keep your cores out of any P-states, and the higher power dissipation will keep fans running (higher).
As I mentioned off list, a better approach, if it can be made to work with the current code structure, is select(2) or poll(2) (or one of the newer variants) on UN*X.. The equivalent, TTBOMK, for Win32 is WaitForMultipleObjects. All of these leave the process unscheduled until there I/O is available or a timeout occurs.
-ch _______________________________________________ time-nuts mailing list -- [email protected] To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts and follow the instructions there.
