zoukankan      html  css  js  c++  java
  • libev与libevent区别

    摘自stackflow的回答,主要从架构上说明了二者的区别:

    As for design philosophy, libev was created to improve on some of the architectural decisions in libevent, for example, global variable usage made it hard to use libevent safely in multithreaded environments, watcher structures are big because they combine I/O, time and signal handlers in one, the extra components such as the http and dns servers suffered from bad implementation quality and resultant security issues, and timers were inexact and didn't cope well with time jumps.

    Libev tried to improve each of these, by not using global variables but using a loop context for all functions, by using small watchers for each event type (an I/O watcher uses 56 bytes on x86_64 compared to 136 for libevent), allowing extra event types such as timers based on wallclock vs. monotonic time, inter-thread interruptions, prepare and check watchers to embed other event loops or to be embedded and so on.

    The extra component problem is "solved" by not having them at all, so libev can be small and efficient, but you also need to look elsewhere for an http library, because libev simply doesn't have one (for example, there is a very related library called libeio that does asynchronous I/O, which can be used independently or together with libev, so you can mix and match).

    So in short, libev tries to do one thing only (POSIX event library), and this in the most efficient way possible. Libevent tries to give you the full solution (event lib, non-blocking I/O library, http server, DNS client).

    Or, even shorter, libev tries to follow the UNIX toolbox philosophy of doing one thing only, as good as possible.

    Note that this is the design philosophy, which I can state with authority because I designed libev. Whether these design goals have actually been reached, or whether the philosophy is based on sound principles, is up to you to judge.

    这是libev作者亲自解释。大家膜拜吧,呵呵!

  • 相关阅读:
    ps+div+css打造蓝色后台login页面实现,ps切片,浏览器兼容
    mysql 常用命令与问题
    struts2 笔记
    hibernate在eclipse的逆向工程生成hbm.xml和bean类
    struts2 checkbox 传值的用法
    css 背景渐变,圆角,阴影用法与兼容
    Firefox 插件 JSview下载
    Spark插件开发完全入门手册,多级组织架构初步(原创) CVT
    Java 动态代理机制分析及扩展,第 2 部分(转) CVT
    Windows 2012服务器建立域控(AD DS)详解(转) CVT
  • 原文地址:https://www.cnblogs.com/xiangshancuizhu/p/3251879.html
Copyright © 2011-2022 走看看