I've recently been trying to wrap my brain around asynchronous I/O, that is, epoll()
on Linux and kqueue()
on FreeBSD; instead of creating multiple threads and using something like select()
, you can create only one thread and still respond to many I/O events at once.
I've been trying to understand how this works at a deep level in the machine code, but have hit a brick wall. (Perhaps my Google-Fu is just lacking.) I can't seem to find any CPU instructions related to async I/O at all - so how does it work?