This book aims to explain how
IOCPworks, and how we can use this for efficient, high performance I/O. The book is divided into three parts:
Part 1 - An express explanation: is probably what you want to read if you're interested in a short introduction.
The Appendix contains some additional references and small articles explaining some concepts that I found interesting and which is related to the kind of code we write here.
Part 2 is special. 99% of readers should not even go there. You'll find page up and down with code and explanations just to implement the simplest example of a cross-platform-eventloop that actually works. Turns out that there is no "express" way of doing this.
The reason I added Part 2 was all the work I've put into exploring things from the ground and up. It sets up a pretty bare bones cross platform event loop we can use to toy around with. It's just an example meant to explore how a proper cross platform event loop works since such code bases can be pretty daunting to dive into themselves.
Later in another book we might use this exact code to explore how higher level concepts like
Futuresin Rust work.
Part 2 could also serve as an introduction to make it easier to read and understand the source code of libraries like mio or BOOST ASIO. Even though these libraries have extensive documentation already it can be difficult to know where to start.
This book should be interesting if you want to learn more about:
How FFI works in Rust and what the crates
mioprovides for you
How to create a cross platform event loop using the same methods as
Reactorin the async library your're most likely using works
How to create a library in Rust that conditionally compiles code for the three major platforms
How to make syscalls on Linux, OSX and Windows
This subject is admittedly pretty difficult. If both Rust and concurrent programming is something that's new to you, I do suggest that you check out my previous books first. After that you should be more than prepared for this book:
When researching information about Kqueue, Epoll and IOCP myself it turned out that getting a deeper understanding of this subject was pretty hard with information scattered around and mostly covering one aspect of either Epoll, Kqueue or IOCP. Therefore, I chose to spend some extra time and effort to collect this information and present it here to make it easier for the next person that ventures on the same quest as I did.