Re:Sleeping Through the Technical Interview (2022)
by colanderman on Friday July 07, 2023 @03:58PM
(#36637515)
Linux's CFS is O(log N) to insert; O(1) to switch tasks (N being number of threads). [1] So O(N log N) it seems.
[1] https://en.wikipedia.org/wiki/Completely_Fair_Scheduler#Algo...
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