Recommended backend for Linux 5.11, and POSIX threads interop

Marc Lehmann schmorp at schmorp.de
Sat Aug 21 17:23:43 CEST 2021


Hi!

On Sat, Aug 21, 2021 at 08:37:55AM +0200, Amirouche <amirouche at hyper.dev> wrote:
> I am diving in to libev.
> 
> 1) I want to understand what is the recommended backend; The pod document
> goes into a long description of how epoll is broken, but then it seems to me
> EPOLL is the recommended backend on Linux:

epoll is the recommended backend for performance, in general. what's
broken is epoll, not libev's epoll backend, and libev tries to work around
it, but one should be aware of the issues, because they can cause major
slowdowns, and epoll is not faster for every use case - for example, a
busy server with only active connections might well have faster throughput
wiht select than with epoll.

> 2) In the THREAD LOCKING EXAMPLE, the code rely on a mutex and a condvar;
> Would it work better with CAS operation?

Neither me nor google know what a CAS operation is w.r.t. pthreads. If
you are talking about different thread systems, yes, different thread
systems might work better differently, but thats probably because they
are different.

If CAS stands for compare-and-swap though, then, no, I don't think it
would be better, as you would have to busy-wait, as CAS cannot wait. Note
that pthreads mutex internally might well use a CAS operation, so the
example might already use what you propose - again, that depend son your
implementation.

-- 
                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_              http://www.deliantra.net
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      schmorp at schmorp.de
      -=====/_/_//_/\_,_/ /_/\_\



More information about the libev mailing list