3 ms·
Imagine you're the kernel, and you get notified that some new data is available on a connection. The basic operations you have to do are: 1) Figure out the ass
by nitwit005 11y ago
Imagine you're the kernel, and you get notified that some new data is available on a connection. The basic operations you have to do are:
1) Figure out the associated file descriptor (hashmap lookup perhaps)
2) Copy the new data to the socket's buffer
3) Wake up any threads waiting to read from the socket, or polling with a read interest
Obviously, that ignores a lot of protocol work, but that's the general idea. There isn't any need to loop over all of the open sockets.