3 ms·
Can anyone clue me in on the status of async/await in hubris? I have some HAL code that both really needs and uses async (or callbacks) to work and currently ju
by ComputerGuru 5y ago
Can anyone clue me in on the status of async/await in hubris? I have some HAL code that both really needs and uses async (or callbacks) to work and currently just use my own homebrew WFE/WFI wakers (with a fixed, known a priori number of tasks) but it would be nice to switch to something more elegant and less brittle.
(Context: async/await-based per-task loop to facilitate background LoRa send/receive while other tasks can continue to operate (DMA, SPI, etc) independently, with the overall loop shutting the primary Cortex core down when processing is completed/while waiting for events/updates.)
The last I checked, hubris was strictly synchronous and I didn't get the sense that the interaction between tasks was architectured in such a way that would facilitate low-power designs for battery-powered devices.
- steveklabnik 5y agoWe don't use async in hubris, so there is no async/await. Hubris is 99.99999% synchronous. For more: https://hubris.oxide.computer/reference/#_why_synchronous https://hubris.oxide.computer/reference/#_why_synchronous (Basically, this probably hasn't changed since you looked at it, but for anyone else who hasn't seen it yet...) > shutting the primary Cortex core down We don't have mainline support for multicore systems, and there's a big ? in there, design-wise. So yes, you are right to recognize that that is the current state of things.
- ComputerGuru 5y agoHi Steve. Thanks for the confirmation - obviously a synchronous design doesn't automatically/necessarily preclude most high-level use cases that async can support - it just requires an alternative approach and some careful consideration. In fact, it could make it easier to do many things like power management. Can you comment on this: others have asked here on HN before but didn't seem to get an answer - does power management/consumption factor in at all in the architectural design (even if it's "this makes it possible to add power management later") or is it strictly a non-goal? (I know your current particular application domains aren't constrained by battery capacity.) It would be easy enough to hack the kernel to always WFI/WFE if all tasks are exited/completed, but I'm thinking about cases where task(s) are still running but the supervisor process is aware that they're all currently in a busy-waiting state. But that wouldn't be sufficient (on its own) if the OS requires certain peripherals to always remain powered up, uses a high-frequency tick interrupt that will constantly wake the device anyway, etc, etc.
- steveklabnik 5y agoI don't know what our "official" take is, but given that a rack of servers is going to draw, you know, a lot of power, I do think that keeping it simple has been a bigger priority than trying to minimize draw here. It wouldn't have a macro effect on the product's power usage anyway.
- ComputerGuru 5y agoThanks. That logic/reasoning is applicable to a lot of people/products and is totally understandable even if it’s a bit of a bummer. Cheers!
- iudqnolq 5y agoFor others, embassy.dev are the main people working on embedded async.