Epoll, select and kqueue have a similar model, but Windows IOCP is different

All these APIs follow a similar model which can be abstracted the same way. They are all waiting for when action is going to occur on a collection of sockets.

It’s relatively simple to write an abstraction library which will work with epoll and kqueue since both APIs work in a similar fashion - they will tell the application when a socket can be read from or be written to or it has closed.

But IOCP - I/O Completion Ports as used by Windows (although IBM AIX Unix also does it this way) uses a model when the caller had to allocate a bucket of memory for each socket operation that we listen on.

As a programmer you basically have to give the operating system a bucket of memory to read from or write to or fill with data from a connecting socket. The first time I learned this was frustrating since I had to completely throw away my first implementation - the needs of IOCP changed how my interfaces worked.

This is why nginx to this day isn’t optimized to run on Windows.

So is Windows and IOCP worth supporting? As much as I would like to say no, the issue is that windows remains an important operating system for most enterprises.

My feeling is that this make IOCP heavier in overhead but I could be wrong. To really understand it you would need to more empirical work than I have had time to:

 

 

Related pages