Gevent

已发布 2018-04-28 12:14:32

gevent

  • greelet
    • join
    • kill
    • get
  • monkey patch
    • socket
    • builtins: __impot__
    • dns
    • os: fork, waitpid
    • signal
    • select
    • ssl
    • subprocess
    • sys: stdin, sdout
    • thread
    • time: sleep
  • timeout
    • gevent.Timeout
    • gevent.with_timeout()
  • event loop: Instead of blocking and waiting for socket operations to complete (a technique known as polling), gevent arranges for the operating system to deliver an event letting it know when, for example, data has arrived to be read from the socket. Having done that, gevent can move on to running another greenlet, perhaps one that itself now has an event ready for it.
    • libev: run only on unix
    • A full-featured and high-performance event loop that is loosely modelled after libevent, but without its limitations and bugs.
      • The libevent API provides a mechanism to execute a callback function when a specific event occurs on a file descriptor or after a timeout has been reached. Furthermore, libevent also support callbacks due to signals or regular timeouts.
      • libev was created to improve on some of the architectural decisions in libevent
    • libuv: libuv was an abstraction around libev or IOCP depending on the platform, providing users an API based on libev.
  • event, result
  • Hub: a greenlet run the event loop
  • cooperative multitasking
    • The greenlets all run in the same OS thread and are scheduled cooperatively
  • pool with limited concurrency

nodejs

comments powered by Disqus