[ruby-core:115669] [Ruby master Feature#20053] M:N Threads, now w/ macOS support (kqueue)

Issue #20053 has been reported by jpcamara (JP Camara). ---------------------------------------- Feature #20053: M:N Threads, now w/ macOS support (kqueue) https://bugs.ruby-lang.org/issues/20053 * Author: jpcamara (JP Camara) * Status: Open * Priority: Normal ---------------------------------------- I have a PR here that adds support for macOS to M:N threads using `kqueue`: https://github.com/ruby/ruby/pull/9178 It adds in `kqueue`/`kevent` calls when present in the OS. Technically this would open up support for FreeBSD as well, but I don't have a way of testing that so i'm not sure how well it does or doesn't work there. I wanted to get support going for macOS so more devs can try out M:N threads and test it. I do think there should be a larger discussion around the potential relationship between this and some of the awesome fiber scheduler work over the last few years (and the potential of utilizing anything from io-event?). But that can be a topic for another day - let's get macOS support in the meantime! Disclaimer: C isn't my day-to-day language, so I could definitely use feedback there. I'm also more of a kernel event queue (kqueue, epoll, io_uring) _enthusiast_, but `kqueue` isn't something I have specific experience writing with - just lots of reading code and small toy code up until this point. So someone like @ioquatix would probably be a good person to get eyes on it. -- https://bugs.ruby-lang.org/

Issue #20053 has been updated by byroot (Jean Boussier). Assignee set to ko1 (Koichi Sasada) ---------------------------------------- Feature #20053: M:N Threads, now w/ macOS support (kqueue) https://bugs.ruby-lang.org/issues/20053#change-105611 * Author: jpcamara (JP Camara) * Status: Open * Priority: Normal * Assignee: ko1 (Koichi Sasada) ---------------------------------------- I have a PR here that adds support for macOS to M:N threads using `kqueue`: https://github.com/ruby/ruby/pull/9178 It adds in `kqueue`/`kevent` calls when present in the OS. Technically this would open up support for FreeBSD as well, but I don't have a way of testing that so i'm not sure how well it does or doesn't work there. I wanted to get support going for macOS so more devs can try out M:N threads and test it. I do think there should be a larger discussion around the potential relationship between this and some of the awesome fiber scheduler work over the last few years (and the potential of utilizing anything from io-event?). But that can be a topic for another day - let's get macOS support in the meantime! Disclaimer: C isn't my day-to-day language, so I could definitely use feedback there. I'm also more of a kernel event queue (kqueue, epoll, io_uring) _enthusiast_, but `kqueue` isn't something I have specific experience writing with - just lots of reading code and small toy code up until this point. So someone like @ioquatix would probably be a good person to get eyes on it. -- https://bugs.ruby-lang.org/

Issue #20053 has been updated by jpcamara (JP Camara). @ko1 you’ll see a huge amount of discussion on the PR between me and @ioquatix - you can ignore all of that and just look at the PR code. I will open up a separate issue to discuss that separately from this kqueue work. I’ve made some changes since I first opened the PR - some small refactors for clarity, and all the tests pass now. It’s stable now and I won’t make any other changes (unless you request some!). ---------------------------------------- Feature #20053: M:N Threads, now w/ macOS support (kqueue) https://bugs.ruby-lang.org/issues/20053#change-105682 * Author: jpcamara (JP Camara) * Status: Open * Priority: Normal * Assignee: ko1 (Koichi Sasada) ---------------------------------------- I have a PR here that adds support for macOS to M:N threads using `kqueue`: https://github.com/ruby/ruby/pull/9178 It adds in `kqueue`/`kevent` calls when present in the OS. Technically this would open up support for FreeBSD as well, but I don't have a way of testing that so i'm not sure how well it does or doesn't work there. I wanted to get support going for macOS so more devs can try out M:N threads and test it. I do think there should be a larger discussion around the potential relationship between this and some of the awesome fiber scheduler work over the last few years (and the potential of utilizing anything from io-event?). But that can be a topic for another day - let's get macOS support in the meantime! Disclaimer: C isn't my day-to-day language, so I could definitely use feedback there. I'm also more of a kernel event queue (kqueue, epoll, io_uring) _enthusiast_, but `kqueue` isn't something I have specific experience writing with - just lots of reading code and small toy code up until this point. So someone like @ioquatix would probably be a good person to get eyes on it. -- https://bugs.ruby-lang.org/

Issue #20053 has been updated by jpcamara (JP Camara). @ko1 My updates are in based on your feedback. At this point is it too close to the Ruby 3.3 release to potentially get Mac support in? I also responded about the scenario in `#readpartial` where native threads end up getting created in MN threads. I think I may have a solution - but since it was present before this PR, i'll open a separate PR for the fix. ---------------------------------------- Feature #20053: M:N Threads, now w/ macOS support (kqueue) https://bugs.ruby-lang.org/issues/20053#change-105721 * Author: jpcamara (JP Camara) * Status: Open * Priority: Normal * Assignee: ko1 (Koichi Sasada) ---------------------------------------- I have a PR here that adds support for macOS to M:N threads using `kqueue`: https://github.com/ruby/ruby/pull/9178 It adds in `kqueue`/`kevent` calls when present in the OS. Technically this would open up support for FreeBSD as well, but I don't have a way of testing that so i'm not sure how well it does or doesn't work there. I wanted to get support going for macOS so more devs can try out M:N threads and test it. I do think there should be a larger discussion around the potential relationship between this and some of the awesome fiber scheduler work over the last few years (and the potential of utilizing anything from io-event?). But that can be a topic for another day - let's get macOS support in the meantime! Disclaimer: C isn't my day-to-day language, so I could definitely use feedback there. I'm also more of a kernel event queue (kqueue, epoll, io_uring) _enthusiast_, but `kqueue` isn't something I have specific experience writing with - just lots of reading code and small toy code up until this point. So someone like @ioquatix would probably be a good person to get eyes on it. -- https://bugs.ruby-lang.org/

Issue #20053 has been updated by hsbt (Hiroshi SHIBATA). Status changed from Assigned to Closed https://github.com/ruby/ruby/pull/9178 has been merged. ---------------------------------------- Feature #20053: M:N Threads, now w/ macOS support (kqueue) https://bugs.ruby-lang.org/issues/20053#change-105765 * Author: jpcamara (JP Camara) * Status: Closed * Priority: Normal * Assignee: ko1 (Koichi Sasada) * Target version: 3.3 ---------------------------------------- I have a PR here that adds support for macOS to M:N threads using `kqueue`: https://github.com/ruby/ruby/pull/9178 It adds in `kqueue`/`kevent` calls when present in the OS. Technically this would open up support for FreeBSD as well, but I don't have a way of testing that so i'm not sure how well it does or doesn't work there. I wanted to get support going for macOS so more devs can try out M:N threads and test it. I do think there should be a larger discussion around the potential relationship between this and some of the awesome fiber scheduler work over the last few years (and the potential of utilizing anything from io-event?). But that can be a topic for another day - let's get macOS support in the meantime! Disclaimer: C isn't my day-to-day language, so I could definitely use feedback there. I'm also more of a kernel event queue (kqueue, epoll, io_uring) _enthusiast_, but `kqueue` isn't something I have specific experience writing with - just lots of reading code and small toy code up until this point. So someone like @ioquatix would probably be a good person to get eyes on it. -- https://bugs.ruby-lang.org/
participants (3)
-
byroot (Jean Boussier)
-
hsbt (Hiroshi SHIBATA)
-
jpcamara (JP Camara)