I/O-Event Driven Programming
- Introducing the epoll I/O notification utilities!
- epoll is a package of Linux routines that help nonblocking servers yield the processor until it knows there's work to be done with one or more of the open client connections.
- There are three functions in the epoll suite that I'll briefly introduce in lecture, if not today, then on Wednesday.
- epoll_create, which creates something called a watch set, which itself is a set of file descriptors which we'd like to monitor. The return value is itself a file descriptor used to identify a watch set. Because it's a file descriptor, watch sets can contain other watch sets. #deep
- epoll_ctl is a control function that allows us to add descriptors to a watch set, remove descriptors from a watch set, and reconfigure file descriptors already in the watch set.
- epoll_wait waits for I/O events, blocking the calling thread until one or more events are detected.
- The example I'll work with in class is too large to put in the slide deck, so you should refer to an online copy. I'll run the new server in class, explain what it does, and cover key parts of the overall design and how it uses the epoll suite to efficiently operate as a nonblocking web server capable of managing tens of thousands of open connections at once.