oxidecomputer / oxidecomputer/hubris
We should firm up the semantics of `userlib::sleep*`
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 3.6k
- Forks
- 239
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 23
Description
So, we've kind of avoided dealing with the timebase problem. (Well, okay, mostly me.)
Currently we express time in all APIs as "system ticks," where the system tick is set for the application (board+image) to whatever you want .... but in practice is milliseconds. And basically all code assumes it's milliseconds.
There are two problems with this.
- We often need timing more precise than milliseconds, but changing the tick frequency, while easy, would break basically all drivers.
- The
userlibtime-related APIs don't actually do what you'd expect.
On that second point -- if you call sleep_for(1), you will (in the absence of higher priority tasks keeping you from being scheduled at all) sleep for somewhere between 0ms and 1ms. In other words, it's really sleep_for_at_most_ms. Often, we actually want at least.
The actual kernel time API is based on absolute deadlines rather than intervals (basically to keep the kernel out of this argument) so I think we could fix this part in userlib.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by inspecting the userlib::sleep* APIs and the kernel time API described in the issue, focusing on how system ticks and absolute deadlines are represented. Compare the current interval behavior with the intended sleep semantics and account for existing drivers that assume milliseconds. Done means the timebase and sleep behavior are explicitly defined and consistently implemented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- embedded-iot, operating-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100