sleepy_penguin RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
* [sleepy.penguin] [PATCH 0/6] epoll wrapper cleanups
@ 2013-04-11  4:17 Eric Wong
  2013-04-11  4:17 ` [sleepy.penguin] [PATCH 1/6] test_epoll: fix timing error in test Eric Wong
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Eric Wong @ 2013-04-11  4:17 UTC (permalink / raw)
  To: sleepy.penguin

I've decided to provide lower-level access to epoll users without the
extra overhead of automatic GC marking and Epoll#set management.

The normal Epoll class is now implemented in Ruby, while the low-level
Epoll::IO class is a lightweight C wrapper.  This should make code
easier to maintain, and folks that really want good concurrency can
use Epoll::IO directly (without the GC-safety normal Epoll provides).

I'm also deprecating the Epoll#set and Epoll#delete APIs, since
they're expensive to maintain.  They will be removed in
sleepy_penguin 4.0 (probably 12 months or so).

I've also made Epoll thread-safe for Rubinius, as Rubinius C extensions
do not (or will not) hold any global lock, so the @marks array must be
protected.  Epoll::IO does not need additional locking to be
thread-safe, it uses thread-local storage and the kernel eventpoll
struct is already protected by its internal locking.

Most of these changes have been my experiences in using epoll in recent
years (mostly outside of Ruby) and also close inspection (and some
hacking :) of the epoll implementation in Linux.

I'll document these patches more, later, and push.

 ext/sleepy_penguin/epoll.c       | 633 ++++++---------------------------------
 ext/sleepy_penguin/epoll_green.h |   8 +-
 ext/sleepy_penguin/inotify.c     |  11 +-
 lib/sleepy_penguin.rb            |   1 +
 lib/sleepy_penguin/epoll.rb      | 266 ++++++++++++++++
 test/test_epoll.rb               |  31 +-
 test/test_epoll_io.rb            |  24 ++
 test/test_epoll_optimizations.rb |   2 +-
 8 files changed, 418 insertions(+), 558 deletions(-)


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-04-12 21:18 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-11  4:17 [sleepy.penguin] [PATCH 0/6] epoll wrapper cleanups Eric Wong
2013-04-11  4:17 ` [sleepy.penguin] [PATCH 1/6] test_epoll: fix timing error in test Eric Wong
2013-04-11  4:17 ` [sleepy.penguin] [PATCH 2/6] test_epoll: synchronize writes to the pipe array Eric Wong
2013-04-11  4:17 ` [sleepy.penguin] [PATCH 3/6] split Epoll and Epoll::IO, rewrite Epoll in Ruby Eric Wong
2013-04-12 20:38   ` Eric Wong
2013-04-11  4:17 ` [sleepy.penguin] [PATCH 4/6] epoll: implement thread-safety for mark/flag arrays Eric Wong
2013-04-12 21:18   ` Eric Wong
2013-04-11  4:17 ` [sleepy.penguin] [PATCH 5/6] epoll: cache alignment for per-thread structure Eric Wong
2013-04-11  4:17 ` [sleepy.penguin] [PATCH 6/6] avoid ENOMEM checking in common code paths Eric Wong

Code repositories for project(s) associated with this public inbox

	https://yhbt.net/sleepy_penguin.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).