Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ractor: a proposal for new concurrent abstraction without thread-safety issues #3365

Merged
merged 2 commits into from Sep 3, 2020

Conversation

@ko1
Copy link
Contributor

@ko1 ko1 commented Jul 27, 2020

Quoted from https://bugs.ruby-lang.org/issues/17100


This ticket proposes a new concurrent abstraction named "Ractor", Ruby's
Actor-like feature (not an exact Actor-model).

Ractor achieves the following goals:

  • Parallel execution in a Ruby interpreter process
  • Avoid thread-safety issues (especially race issues) by limiting the object sharing
  • Communication via copying and moving

I'm working on this proposal in a few years, and the project name was
"Guild". I renamed it from Guild to Ractor because of Matz's preference.

Resources:

Current implementation is not complete (many bugs are remaining) but it passes current CI.
I propose to merge it soon and try the APIs, continue to develop the implementation on a master branch.

@ko1 ko1 force-pushed the ko1:ractor_parallel branch 3 times, most recently from d02410a to 847d281 Jul 29, 2020
Copy link
Contributor

@benoittgt benoittgt left a comment

Hello @ko1. Thanks a lot for Ractor. This is a very interesting feature. While playing with code snippet. I noticed few things. Feel free to use any suggestion or not. 😄

🙇🏻‍♂️

bootstraptest/test_ractor.rb Show resolved Hide resolved
bootstraptest/test_ractor.rb Outdated Show resolved Hide resolved
doc/ractor.md Show resolved Hide resolved
doc/ractor.md Outdated Show resolved Hide resolved
doc/ractor.md Outdated Show resolved Hide resolved
doc/ractor.md Outdated Show resolved Hide resolved
doc/ractor.md Outdated Show resolved Hide resolved
doc/ractor.md Outdated Show resolved Hide resolved
doc/ractor.md Outdated Show resolved Hide resolved
doc/ractor.md Outdated Show resolved Hide resolved
@ko1 ko1 force-pushed the ko1:ractor_parallel branch 2 times, most recently from d04762d to 602f56e Aug 2, 2020
@ko1
Copy link
Contributor Author

@ko1 ko1 commented Aug 2, 2020

@benoittgt I'll squash most of commit, is it okay? (your commit doesn't appear in ruby repo).

@benoittgt
Copy link
Contributor

@benoittgt benoittgt commented Aug 2, 2020

@ko1 No problem! ;)

@ko1 ko1 force-pushed the ko1:ractor_parallel branch from 7a3f56a to 8fd9c51 Aug 3, 2020
@ko1 ko1 changed the title Ractor parallel Ractor: a proposal for new concurrent abstraction without thread-safety issues Aug 3, 2020
@ko1 ko1 marked this pull request as ready for review Aug 3, 2020
@ko1 ko1 force-pushed the ko1:ractor_parallel branch 5 times, most recently from 2d946c8 to 7194182 Sep 1, 2020
This commit introduces Ractor mechanism to run Ruby program in
parallel. See doc/ractor.md for more details about Ractor.
See ticket [Feature #17100] to see the implementation details
and discussions.

[Feature #17100]

This commit does not complete the implementation. You can find
many bugs on using Ractor. Also the specification will be changed
so that this feature is experimental. You will see a warning when
you make the first Ractor with `Ractor.new`.

I hope this feature can help programmers from thread-safety issues.
@ko1 ko1 force-pushed the ko1:ractor_parallel branch from 7194182 to 45647a0 Sep 3, 2020
This implementation has memory corruption errors so and
it causes BUG on rare occasions. This commit skips
suspect tests on Github actions Compiler tests.
@ko1 ko1 force-pushed the ko1:ractor_parallel branch from 45647a0 to dc7f421 Sep 3, 2020
@ko1 ko1 merged commit b52513e into ruby:master Sep 3, 2020
100 checks passed
100 checks passed
check_encoding
Details
CodeQL-Build CodeQL-Build
Details
gcc-10
Details
make (check, --jit)
Details
make (check)
Details
check_branch
Details
make (check, ubuntu-20.04)
Details
make (test, windows-2019, 2019)
Details
make (check)
Details
gcc-9
Details
make (check, --jit-wait)
Details
make (check, ubuntu-20.04, -DRUBY_DEBUG)
Details
make (test-bundler-parallel)
Details
gcc-8
Details
make (check, ubuntu-18.04)
Details
make (test-bundled-gems)
Details
gcc-7
Details
make (check, ubuntu-18.04, -DRUBY_DEBUG)
Details
make (leaked-globals)
Details
gcc-6
Details
make (check, ubuntu-16.04)
Details
gcc-5
Details
make (test-bundler-parallel, ubuntu-20.04)
Details
gcc-4.8
Details
make (test-bundler-parallel, ubuntu-20.04, -DRUBY_DEBUG)
Details
clang-12
Details
make (test-bundler-parallel, ubuntu-18.04)
Details
clang-11
Details
make (test-bundler-parallel, ubuntu-18.04, -DRUBY_DEBUG)
Details
clang-10
Details
make (test-bundled-gems, ubuntu-20.04)
Details
clang-9
Details
make (test-bundled-gems, ubuntu-20.04, -DRUBY_DEBUG)
Details
clang-8
Details
make (test-bundled-gems, ubuntu-18.04)
Details
clang-7
Details
make (test-bundled-gems, ubuntu-18.04, -DRUBY_DEBUG)
Details
clang-6.0
Details
make (test-all TESTS=--repeat-count=2, ubuntu-20.04)
Details
clang-5.0
Details
make (test-all TESTS=--repeat-count=2, ubuntu-18.04)
Details
clang-4.0
Details
make (leaked-globals, ubuntu-20.04)
Details
clang-3.9
Details
make (leaked-globals, ubuntu-18.04)
Details
aarch64-linux-gnu
Details
powerpc64le-linux-gnu
Details
s390x-linux-gnu
Details
x86_64-w64-mingw32
Details
c99
Details
c11
Details
c17
Details
c2x
Details
c++98
Details
c++11
Details
c++14
Details
c++17
Details
c++2a
Details
-O0
Details
-O3
Details
gmp
Details
jemalloc
Details
valgrind
Details
coroutine=ucontext
Details
coroutine=copy
Details
disable-mathn
Details
disable-jit-support
Details
disable-dln
Details
disable-rubygems
Details
OPT_THREADED_CODE=1
Details
OPT_THREADED_CODE=2
Details
OPT_THREADED_CODE=3
Details
NDEBUG
Details
RUBY_DEBUG
Details
ARRAY_DEBUG
Details
BIGNUM_DEBUG
Details
CCAN_LIST_DEBUG
Details
CPDEBUG=-1
Details
ENC_DEBUG
Details
GC_DEBUG
Details
HASH_DEBUG
Details
ID_TABLE_DEBUG
Details
RGENGC_DEBUG=-1
Details
SYMBOL_DEBUG
Details
THREAD_DEBUG=-1
Details
RGENGC_CHECK_MODE
Details
TRANSIENT_HEAP_CHECK_MODE
Details
VM_CHECK_MODE
Details
USE_EMBED_CI=0
Details
USE_FLONUM=0
Details
USE_LAZY_LOAD
Details
USE_RINCGC=0
Details
USE_SYMBOL_GC=0
Details
USE_THREAD_CACHE=0
Details
USE_TRANSIENT_HEAP=0
Details
USE_RUBY_DEBUG_LOG=1
Details
DEBUG_FIND_TIME_NUMGUESS
Details
DEBUG_INTEGER_PACK
Details
ENABLE_PATH_CHECK
Details
GC_DEBUG_STRESS_TO_CLASS
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.