by xena · 3y ago · 0 comments
Not to mention for the OS to handle N threads would likely take some kind of non-linear time, at least N^2 if I had to take a shot in the dark. But I imagine it'd depend on the OS and how the hardware handles interrupts. Even if the thread is sleeping it still takes resources to schedule it
[1] https://en.wikipedia.org/wiki/Completely_Fair_Scheduler#Algo...
An algorithm that takes N inputs, does N operations, and then sleeps for 10 seconds is not constant time, because in the asymptotic case the N iterations will take longer than the sleep.
Sorting [5, 50] is faster wall time then [6, 60].