Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> the resource can wake the scheduler at any time and tell it to poll

Isn't that called interrupting?

The terminology seems a little off here, but perhaps that is only my perception.



No, it's not. Interrupting is when you call the scheduler at any time, even when it's doing some other work. When it's idle, it can not be interrupted.

Interruptions are something one really tries to restrict to the hardware - kernel layers. Because when people write interruption handlers, they almost always write them wrong.


To elaborate on what it is rather than what it is not, when implementing poll based IO with rust async, typically you have code like “select(); waker.wake()” on a worker thread. Select blocks. Waking tells the executor to poll the related future again, from the top of its tree. The waker implementation may indeed cause an executor thread to stop waiting, it depends on the implementation. It could also be the case that the executor is already awake and the future is simply added to a synchronised queue. Etc. You can implement waking however you like, and technically this could involve an interruptible scheduler, if you really wanted. But you would kinda have to write that.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: