Upgrade to Pro — share decks privately, control downloads, hide ads and more …

AsyncIO

Renan Ivo
August 14, 2018

 AsyncIO

AsyncIO do eventloop à interface

Apresentado por @drgarcia1986 e @renanivo

Renan Ivo

August 14, 2018
Tweet

More Decks by Renan Ivo

Other Decks in Technology

Transcript

  1. "...a socket is the interface between the application layer and

    the transport layer within a host. It is also referred to as the Application Programming Interface (API) between the application and the network, since the socket is the programming interface with which network applications are built" — Kurose, Computer Networking A Top-Down Approach
  2. "What we need is the capability to tell the kernel

    that we want to be notified if one or more I/O conditions are ready (i.e., input is ready to be read, or the descriptor is capable of taking more output). This capability is called I/O multiplexing" — Stevens, Unix Networking Programming Volume 1
  3. "select function: This function allows the process to instruct the

    kernel to wait for any one of multiple events to occur and to wake up the process only when one or more of these events occurs or when a specified amount of time has passed." — Stevens, Unix Networking Programming Volume 1
  4. "The epoll API [...]: monitoring multiple file descriptors to see

    if I/O is possible on any of them. The epoll API [...] scales well to large numbers of watched file descriptors." — man pages, Linux (http://man7.org/linux/man-pages/man7/epoll.7.html)
  5. "This module allows high-level and efficient I/O multiplexing, built upon

    the select module primitives. Users are encouraged to use this module instead, unless they want precise control over the OS-level primitives used." — Docs, Python (https://docs.python.org/3/library/selectors.html)
  6. "Provide a way to access the elements of an aggregate

    object sequentially without exposing its underlying representation" — Design Patters, GoF
  7. "Generator is a special routine that can be used to

    control the iteration behaviour of a loop. However, instead of building an array containing all the values and returning them all at once, a generator yields the values one at a time, which requires less memory and allows the caller to get started processing the first few values immediately." — Wikipedia
  8. "Coroutines are computer-program components that generalize subroutines for non-preemptive multitasking,

    by allowing multiple entry points for suspending and resuming execution at certain locations." — Wikipedia
  9. PEP 492 Coroutines with async and await syntax • native

    coroutine • @types.coroutine • async with • async for