All books

Professional

Apps About Coach Log in Start reading

Computer Science · Glossary

What is Event loop?

Definition 16.12 University Computer Science — Year 2 · Chapter 16 — Sockets

An event loop serves many connections from one thread: it asks the system, with poll(fds, n, timeout), which of a set of descriptors are ready (a recv or an accept on them would not wait), handles each ready one briefly, and asks again. A connection’s state between two events, such as a request received in part, is kept in a structure of the program.

An event loop. One call reports every ready descriptor; each is served without waiting, and the loop returns to poll. Nothing blocks, so one thread keeps every connection moving.
An event loop. One call reports every ready descriptor; each is served without waiting, and the loop returns to poll. Nothing blocks, so one thread keeps every connection moving.
The rates of . Each connection costs a fork, a thread, or nothing extra; with one short request per connection, that cost is most of the work.
The rates of Output 16.7. Each connection costs a fork, a thread, or nothing extra; with one short request per connection, that cost is most of the work.
Read in context →