From: ko1@... Date: 2021-01-29T09:16:39+00:00 Subject: [ruby-core:102293] [Ruby master Feature#17566] Tune thread QoS / efficiency on macOS Issue #17566 has been updated by ko1 (Koichi Sasada). Actually, `Thread#priority` is not tested. I'm not sure we can use this `pthread_set_qos_class_self_np` API for `priority` because it accepts an integer and there is no agreement which number is "high" and "low". Introducing another API makes sense more for me. But I'm also not sure we can introduce a new API only for Mac OS. Also I'm not sure `pthread_set_qos_class_self_np` is needed for Ruby users (I think Mac OS will choose good core than a programmer, I guess). ---------------------------------------- Feature #17566: Tune thread QoS / efficiency on macOS https://bugs.ruby-lang.org/issues/17566#change-90148 * Author: mperham (Mike Perham) * Status: Open * Priority: Normal ---------------------------------------- Hi, new Apple M1 processors have "performance" and "efficiency" cores. Apple provides a QoS API so threads can tune which cores they should execute on. Some threads should be executed as high-priority, some should be treated as low-priority. This page shows the pthread APIs that Apple provides: https://developer.apple.com/library/archive/documentation/Performance/Conceptual/power_efficiency_guidelines_osx/PrioritizeWorkAtTheTaskLevel.html ``` pthread_set_qos_class_self_np(QOS_CLASS_BACKGROUND, 0) ``` I noticed Ruby already provides `Thread#priority=` which says `This is just hint for Ruby thread scheduler. It may be ignored on some platform`. Does this API work still or was it only active for Ruby 1.8's green threads? Should this API use the QoS APIs on macOS? -- https://bugs.ruby-lang.org/ Unsubscribe: