summaryrefslogtreecommitdiff
path: root/thread_pthread_mn.c
AgeCommit message (Collapse)Author
2023-12-03Revert "Add missing GVL hooks for M:N threads and ractors"John Hawthorn
This reverts commit ad54fbf281ca1935e79f4df1460b0106ba76761e.
2023-12-02Add missing GVL hooks for M:N threads and ractorsJohn Hawthorn
[Bug #20019] This fixes GVL instrumentation in three locations it was missing: - Suspending when blocking on a Ractor - Suspending when doing a coroutine transfer from an M:N thread - Resuming after an M:N thread starts Co-authored-by: Matthew Draper <[email protected]>
2023-10-29Cast up before multiplicationNobuyoshi Nakada
2023-10-13use `uint32_t` instead of `__uint32_t`Koichi Sasada
2023-10-13Use `sysconf()` to get PAGE_SIZEKoichi Sasada
Some systems use not 4096 page size (64KB for example).
2023-10-12M:N thread scheduler for RactorsKoichi Sasada
This patch introduce M:N thread scheduler for Ractor system. In general, M:N thread scheduler employs N native threads (OS threads) to manage M user-level threads (Ruby threads in this case). On the Ruby interpreter, 1 native thread is provided for 1 Ractor and all Ruby threads are managed by the native thread. From Ruby 1.9, the interpreter uses 1:1 thread scheduler which means 1 Ruby thread has 1 native thread. M:N scheduler change this strategy. Because of compatibility issue (and stableness issue of the implementation) main Ractor doesn't use M:N scheduler on default. On the other words, threads on the main Ractor will be managed with 1:1 thread scheduler. There are additional settings by environment variables: `RUBY_MN_THREADS=1` enables M:N thread scheduler on the main ractor. Note that non-main ractors use the M:N scheduler without this configuration. With this configuration, single ractor applications run threads on M:1 thread scheduler (green threads, user-level threads). `RUBY_MAX_CPU=n` specifies maximum number of native threads for M:N scheduler (default: 8). This patch will be reverted soon if non-easy issues are found. [Bug #19842]