4 ms·
> It obsoletes the need for a traditional RTOS with kernel context switching Uh, what does async have to do with hard real-time guarantees?
by adastra22 10mo ago
> It obsoletes the need for a traditional RTOS with kernel context switching
Uh, what does async have to do with hard real-time guarantees?
- deleted 10mo ago[deleted]
- bfrog 10mo agoIt doesn't have anything to do with it. It's some nice syntax over cooperative multitasking.
- adastra22 10mo agoThe README should be corrected then. It is currently making a very false claim.
- apitman 10mo agoThe claim is you can get embedded concurrency without an OS. Do you disagree? I prefer C for embedded but must admit that's pretty compelling.
- 5d41402abc4b 10mo agoIf it has async and concurrency isnt this an OS?
- zipy124 10mo agoThere isn't much difference between this and an OS. It's just that in an OS you switch between processes, whereas here they switch between async tasks. One could argue this is pretty semantic and that you could easily just call this an OS.
- adastra22 10mo agoThe claim is it "obsoletes the need for a traditional RTOS with kernel context switching." I don't think the authors understand what an RTOS is, because it has very little to do with concurrency. It is about providing hard guarantees about execution timing of interrupt events. E.g. you need to poll an input port every 20ms, or something like that, because that's when the signal will be on the wire. Not "Please wait at least 20ms before resuming" but rather "I must resume execution in +0.020 sec from now with timing error constrained to no more than +/- 100 nanoseconds" This is traditionally done by having an operating system with deterministic timing in its interrupt handling, so that it can schedule preemptive wake-up calls exactly when needed. As well as some important edge case handling like fast queueing of interrupts for later processing, or even dropping them entirely if a hard scheduled interrupt is being processed. Preemptive execution and OS threading is an absolute requirement. Async rust doesn't even provide hard interrupts. It's cooperative multithreading so if some other event handler happens to be running when you need to resume, you're boned. So AFAICT Embassy doesn't do this at all? In which case it doesn't "obsolete the need for a traditional RTOS with kernel context switching."
- pflanze 10mo ago> So AFAICT Embassy doesn't do this at all? I haven't used Embassy, but the README mentions "Tasks on the same async executor run cooperatively, but you can create multiple executors with different priorities so that higher priority tasks preempt lower priority ones" and links to an example that shows how a higher priority task runs even though a lower priority one runs a long time job (does not yield), thus understanding and infrastructure seems to be there. So, Embassy may in its entirety replace an RTOS / be one, but it's not the async mechanism that can provide the RT part (and I guess you're right to point out the dangerous sentence as it could mislead people to use only async and believe it's RT). OTOH the sentence would be right if it were something like "async multitasking is an alternative to preemptive multitasking, and can replace the use of a preemptive OS if real-time guarantees are not needed (note that Embassy separately allows running multiple executors to allow to pre-empt tasks running in lower-priority executors)". They should probably also describe what the reason for not needing per-task stack size tuning is.
- apitman 10mo ago
- kahlonel 10mo ago99% people in this thread have no idea what you mean. And that’s the reason projects like these make it to frontpage every other day and have hundreds of upvotes/comments.
- adastra22 10mo agoAnd you are downvoted for understanding the issue, of course.
- a456463 10mo agoYup! Which is also the reason why I distrust projects like these in general: bold claims when there is nothing to be backed up with. What else is hiding behind such bold claims?
- the__alchemist 10mo agoThe claims, including in comments in this thread read to me as "I will make this claim". Then, someone points out that the claim is inaccurate. "I didn't really mean that, I meant slightly softer version". It feels disingenuous.
- cyber-crank 10mo agoWhat I'm seeing is an Embassy dev giving hard evidence of how this can be used for real-time tasks ironically proving that the weirdly upset people, who are claiming no one here knows what they are talking about, are in fact the ones who don't know what they are talking about.
- the__alchemist 10mo agoHey: for this particular thread, the example claim in question is It obsoletes the need for a traditional RTOS, which isn't true. See elsewhere in this comments section as well, there are several good examples.
- dirbaio 10mo ago(Embassy dev here) You can get preemptive scheduling of async tasks with InterruptExecutor. You create one executor for each priority level, then spawn the tasks in the right one. The latency of the executor and the compiler-generated async state machines is predictable, so you can use Embassy for hard real-time work. See example: https://github.com/embassy-rs/embassy/blob/main/examples/nrf52840/src/bin/multiprio.rs https://github.com/embassy-rs/embassy/blob/main/examples/nrf... Additionally the executor has support for scheduling tasks by priority or deadline within a single priority level. (in latest git, will be in next crates.io release)