全部书籍

专业

应用 关于 Coach 登录 开始阅读

书籍暂未推出简体中文版——当前显示英文版。

Computer Science · 术语表

什么是 Event loop?

Definition 16.12 University Computer Science — Year 2 · 第 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.
在原文中阅读 →