-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Expose thread/task priorities #819
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
Comments
It would be good if this also included exposing |
I think this is a worthy improvement to have as some systems do use priorities heavily. |
This would be extremely useful for situations where you’re wanting to shift low priority workloads off to queues that run in the background. #trifecta |
This crate seems to fit the bill for this RFC: Is it possible to get a pronouncement on it? Thanks. |
Thread management is a complex task. #613 established the direction for concurrency tooling with Actix. Then to reliably and effectively specify domain specific logic, such as scheduling and priority, a higher level scripting layer is needed. Torchbear has an issue to support cooperative multitasking for Speakeasy's collaborative runtime language, jazzdotdev/jazz#74 An example of stream relations mapping, ie with dependency and weighting, is already available in Cloudflare's Adopting a new Approach to HTTP Prioritization. This is one very helpful component that'll make this messy implementation process clean. |
Quoting upstream:
Now, it seems that looking at some of the external comments, this statement isn't actually true anymore. It looks like Rust has changed in some way since 2015 and the standard pthreads mechanisms now work. If that is actually the case, then this should probably be closed with "Use pthreads library calls". Can someone with internals knowledge verify this? |
I made the comment that @steveklabnik linked here: #819 (comment) @buzmeg that crate gets close but it doesn't quite cut it. For one, on Linux, Additionally, I don't believe it handles Mach threads on macOS, which don't use the pthread API for thread priorities at all. I implemented a real-time thread scheduling utility library on macOS a few years back at another gig and it is very different from POSIX. I can't comment on Windows. @jonhoo bits on affinity and such might also be impacted by API differences in musl and libc, mach, etc. When I originally made that comment I was using Rust as a hobbyist. I now write Rust at my day job (and am in fact in a place where I need to do real-time threading, core pinning, etc in an embedded environment with an RTOS) and I just wanted to chime in to say that it would still be super cool if a cross-platform implementation of this existed in the core or std, especially because of all the various skews between the tier 1 targets. |
Handling task priority, scheduling, and queuing in OS threads is too low-level. Rust with Actix can do this, similar to how Scala handles Akka actor priorities. Programming "actors" requires an additional layer of logic though, which is why I also mentioned Torchbear for its higher-level scripting environment. You'll see, when programming domain logic priority, as well as other higher dimensional attributes, the tools built on Torchbear are Godsent. |
I haven't used |
@naturallymitchell The An actor library would be nice but I don't think that belongs in the |
@dljsjr Oh okay! Thank you for clarifying about |
macOS does implement pthread priority APIs (on top of the Mach ones); it just doesn't support putting threads into realtime mode that way. |
@comex good to know, I only ever used the Mach task ports directly when I had to do that sort of thing on macOS. |
I spoke with the maintainer of Zircon on Freenode #fuchsia https://freenode.logbot.info/fuchsia/20200706#c4313960-c4314889 https://freenode.logbot.info/fuchsia/20200707 Fuchsia is even better than as documented Rust bindings already exist! Who's gonna try this?! |
Wednesday Jul 23, 2014 at 18:09 GMT
For earlier discussion, see rust-lang/rust#15927
This issue was labelled with: A-libs in the Rust repository
Trying to find an equivalent to the following C++ code,
I failed to set the task priority using just exposed API.
brsons statement on IRC,
leaves little doubt that an exposed API for this actually is needed.
The text was updated successfully, but these errors were encountered: