Comments (9)
I would for my day job (where we use real time Linux patches) have a use case for having priority inheritance even on Linux. That would allow using third party crates on some projects. Currently it is a massive pain to use PI since virtually nothing third party (or std) uses it (I think I have seen two crates for PI on Linux on crates.io). You basically have to roll your own everything for synchronisation.
Furthermore I expect that on some targets that are more focused on real-time (QNX for example) not having PI would annoy users. (Of course that is a tire 3 target, and I don't know if it has PI currently.)
Pethaps there could be a way to enable PI globally, like the global allocator attribute? Since Rust doesn't use pthreads mutices any more it is unfortunately not as easy as enabling the flag but would require larger implementation changes in std.
from rust.
std does not have an API for setting the thread priority
from rust.
I would for my day job (where we use real time Linux patches) have a use case for having priority inheritance even on Linux. That would allow using third party crates on some projects. Currently it is a massive pain to use PI since virtually nothing third party (or std) uses it (I think I have seen two crates for PI on Linux on crates.io). You basically have to roll your own everything for synchronisation.
Furthermore I expect that on some targets that are more focused on real-time (QNX for example) not having PI would annoy users. (Of course that is a tire 3 target, and I don't know if it has PI currently.)
Pethaps there could be a way to enable PI globally, like the global allocator attribute? Since Rust doesn't use pthreads mutices any more it is unfortunately not as easy as enabling the flag but would require larger implementation changes in std.
That sounds like a good candidate a build-std
option. It would definitely increase the maintenance burden, though, but that needn't be a blocker. The question then still remains whether the default should be platform-dependent.
from rust.
Isn't it generally better to have the wake queues in the kernel even when no PI is involved? E.g. on a RWLock a single FUTEX_WAKE can wake up all the waiters.
from rust.
The conclusion of the libs meeting was that In general we don't make any guarantees about thread priority since this is very OS-specific and not supported on all targets. However we should make a best effort to support PI where possible as long as this doesn't impact performance, but this is purely QoI and not an API guarantee.
from rust.
Definitely! I just wondered whether we really have to bother on the platforms were PI is difficult to maintain.
from rust.
We definitely want to keep using futexes on Linux, and in general we probably don't want to switch to a userspace queue on any target that has a more efficient OS mechanism. I don't think we need to guarantee PI, but we should attempt to give the kernel enough information to handle priority on targets that have built-in support for it, including Linux.
from rust.
cc @m-ou-se as the resident expert on our synchronization code.
from rust.
One data point of someone wanting priority inheritance for game development: https://users.rust-lang.org/t/mutex-priority-inversion/114584?u=the8472
from rust.
Related Issues (20)
- Float docs do not define the set of "arithmetic" operations
- Can't use an associated type of a generic param in other generic param's default value HOT 1
- ICE: `debuginfo: Trying to create type name for unexpected type: CoroutineWitness`
- unpretty: `Unexpected def kind SyntheticCoroutineBody`
- rustdoc search: allow queries to end in ::
- rustdoc search: allow type-based search for constants and statics
- Tracking Issue for fmt-debug option
- rustdoc search: allow eliding the return value of function signatures in type based search
- Very long compilation time on Apple Silicon platform
- rustdoc search: path matches that skip segments should be deprioritized HOT 1
- Large amounts of repeated data in debug info HOT 1
- `./x.py test compiler/rustc_abi` no longer works HOT 2
- Invalid suggestion when using `serde` `serialize_with`
- rustdoc: copy code button obscures scraped example expand button HOT 4
- internal compiler error: TyKind::Error constructed but no error reported, internal compiler error: TyKind::Error constructed but no error reported HOT 1
- Next-gen Trait Solver does not implement Generic Const Expressions HOT 2
- Too long compile time with implementing a trait function HOT 1
- ICE: builtin derive created an unaligned reference HOT 2
- Suggest wrapping code into `fn main() {}` when encountering `let` within `main.rs` HOT 2
- Failure to unify the generic regions in closure HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rust.