3 ms·
Interesting idea I hadn't seen before. It's basically bucket sort, but using the scheduler to hold the bins.
by _delirium 15y ago
Interesting idea I hadn't seen before. It's basically bucket sort, but using the scheduler to hold the bins.
- _delirium 15y agoCorrecting myself: while that's what I think of it conceptually (everything is placed into integer-valued "bins" via the integer parameter taken by sleep()), implementation-wise it's probably equivalent to heapsort or something similar, depending on whether the scheduler stores sleeping threads in a heap or some other data structure.