3 ms·
> because the OS will have to sort all the sleep timers Not necessarily (though yes, in any efficient real life it would). It could wait for a tick of the cloc
by dspillett 12y ago
> because the OS will have to sort all the sleep timers
Not necessarily (though yes, in any efficient real life it would). It could wait for a tick of the clock and on each scan an unordered list of things to see if any are due to happen.
Of course if the list gets big enough that the list takes a long time to scan then it will break sleep sort because if enough time passes for two or more events to have happened between two checks, those events will happen in an undefined order.
- bitJericho 12y agoThat's pretty much a selection sort.