Mentioned in particular is that poll returns a larger set of possible They both call a lot of the same functions. and the definition of the poll syscall and do_poll.here’s the definition of the select syscall and do_select.I went to look at the definition of poll and select in the Linux kernel The first surprising thing I learned from this chapter are that pollĪnd select fundamentally use the same code. They tell you which ones have data available to read/write to.Give them a list of file descriptors to get information about.These 2 system calls are available on any Unix system, while epoll is Select because that’s where the chapter started. The 3 system calls that let you ask Linux to monitor lots of fileĭescriptors are poll, epoll and select. Spending all CPU time to ask “are there updates now? how about now? howĪbout now? how about now?“, instead we’d rather just ask the Linux kernel The problem with this is that it can waste a lot of CPU time. You could have a loop that basically does: for x in open_connections: You need to know when people send you new data on thoseĬonnections, so you can process and respond to them. If you’re a web server, you might have thousands of connections open at You get a new file descriptor representing that connection. Time you accept a connection with the accept system call ( here’s the man page), Let’s talkĪbout why, how epoll is different from poll and select, and about how it works! Servers need to watch a lot of file descriptors ![]() Who needs to watch a lot of file descriptors at aįor example if you’re writing a web server in node.js on Linux, it’sĪctually using the epoll Linux system call under the hood. ![]() This chapter is basically about how to monitor a lot of file descriptorsįor new input/output. I learn helps me understand them, so here’s my attempt at explaining! ![]() Select, poll and epoll for quite some time. I/O models”) because I’ve been meaning to understand better what’s up with The select, poll, and epoll system calls. I thought this was a cool reminder of how you can learn a lot byĭocumenting something & writing small test programs!īut today we’re going to talk about something I learned from this book: Uncovered while writing test programs during the preparation of man Programs is important: quite a few kernel and glibc bugs have been Writing test programs) to gain that understanding. Topic, or be prepared to invest the time (e.g., reading source code, You need to have a reasonably high degree of understanding of the In the contributing guidelines (you can contribute to the linux man pages!! mind=blown), there’s a list of missing man pages that would be useful to contribute.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |