ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: samuel@oriontransfer.org
To: ruby-core@ruby-lang.org
Subject: [ruby-core:86873] [Ruby trunk Feature#14736] Thread selector for flexible cooperative fiber based concurrency
Date: Fri, 04 May 2018 03:12:27 +0000 (UTC)	[thread overview]
Message-ID: <redmine.issue-14736.20180504031225.9310d7ec234372c5@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-14736.20180504031225@ruby-lang.org

Issue #14736 has been reported by ioquatix (Samuel Williams).

----------------------------------------
Feature #14736: Thread selector for flexible cooperative fiber based concurrency
https://bugs.ruby-lang.org/issues/14736

* Author: ioquatix (Samuel Williams)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
Ruby concurrency can be greatly enhanced by concurrent, deterministic IO.

Fibers have been shown many times to be a great abstraction for this purpose. The retain normal code flow and don't require any kind of Thread synchronisation. They are enjoyable to write code with because you don't have to concern yourself with thread synchronisation or other complicated issues.

The basic idea is that if some operation would block, it yields the Fiber, and other Fibers within the thread can continue to execute.

There are a number of ways to implement this. Here is a proof of concept to amend the existing `rb_io_wait_readable`/`rb_io_wait_writable`.

https://github.com/ruby/ruby/pull/1870

This design minimally affects the Ruby implementation and allows flexibility for selector implementation. With a small amount of work, we can support EventMachine (65 million downloads), NIO4r (21 million downloads). It would be trivial to back port.

This PR isn't complete but I am seeking feedback. If it's a good idea, I will do my best to see it through to completion, including support for EventMachine and NIO4r.



-- 
https://bugs.ruby-lang.org/

       reply	other threads:[~2018-05-04  3:12 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <redmine.issue-14736.20180504031225@ruby-lang.org>
2018-05-04  3:12 ` samuel [this message]
2018-05-05  2:39 ` [ruby-core:86881] [Ruby trunk Feature#14736] Thread selector for flexible cooperative fiber based concurrency samuel
2018-05-05  2:43 ` [ruby-core:86882] " samuel
2018-05-05  2:51 ` [ruby-core:86886] " samuel
2018-06-12  3:57 ` [ruby-core:87477] " samuel
2018-06-13  0:58   ` [ruby-core:87483] " Eric Wong
2018-07-04  8:08 ` [ruby-core:87777] " samuel
2018-07-04  8:17 ` [ruby-core:87778] " samuel
2018-07-04 16:39 ` [ruby-core:87785] " funny.falcon
2018-07-05  4:12 ` [ruby-core:87798] " samuel
2018-07-05  7:25 ` [ruby-core:87804] " funny.falcon
2018-07-05  7:48 ` [ruby-core:87807] " samuel
2018-07-05  8:33 ` [ruby-core:87808] " funny.falcon
2018-07-05  8:36 ` [ruby-core:87809] " samuel
2018-07-08  2:02 ` [ruby-core:87863] " samuel
2019-05-01 15:11 ` [ruby-core:92515] " eregontp
2019-05-01 15:15 ` [ruby-core:92516] " eregontp
2019-05-01 22:41 ` [ruby-core:92522] " samuel
2019-05-01 23:03 ` [ruby-core:92523] " samuel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.issue-14736.20180504031225.9310d7ec234372c5@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).