TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Moving CHERIoT RTOS to a tickless model

71 pointsby JNRowe12 months ago

5 comments

01HNNWZ0MV43FF11 months ago
Interesting. I don&#x27;t know much about OSes, but in userspace there&#x27;s an analog for event loops.<p>Almost all of them have a timer heap or timer wheel or something (that&#x27;s below the level of abstraction I work at) which can always answer the question, &quot;When do I wake up next?&quot;. And then every event is reducible to either a timer timeout or an external event like the file driver giving you data from a file, getting a packet from the network, mouse movement, etc.<p>Games often don&#x27;t need this because they tick at 60+ Hz to render everything anyway, so it&#x27;s easier to just hang everything off that and check every timer on every frame, it&#x27;s going to be a tiny waste of CPU compared to the rest of the game logic.<p>However in one case I was writing an event-based program for work, using C++, with limitations on what dependencies I could pull in, so I set a fixed tick (something like every 1 second) and when I got external events, I just ran the whole tick function instantly. This introduced some latency but it was in places that didn&#x27;t matter, and it made the code really easy to follow.
评论 #40622375 未加载
layla5alive11 months ago
It&#x27;s easy to assume OS schedulers have a lot of intellect behind them, but in reality, like most software, they&#x27;re often shipped in a half-baked state. Even mature schedulers like the Linux kernel are far from perfect.<p>It surprised me that yield wasn&#x27;t a concept from the beginning for this RTOS (reading it, when they started describing the problem, I was already asking &quot;why aren&#x27;t they yielding instead of sleeping?&quot;), but glad to see the improvement in the next paragraph.<p>There are always things to improve, which I find refreshing - I hope AI doesn&#x27;t take that away. Or if it does, it had better also eliminate poverty, war, etc. Let people spend their days playing.
评论 #40620171 未加载
theamk11 months ago
&gt; almost all of the calls to thread_sleep wanted to yield to allow another thread to make progress, rather than to guarantee some time had elapsed.<p>That&#x27;s .. deeply alarming and likely indicates the bad code. I&#x27;ve seen many beginner programmers use sleep&#x2F;yield to busy-wait on something, and it&#x27;s almost always a bad design decision: using proper synchronization primitive would be safer and more performant too.<p>Just to make sure that my guess was correct, I&#x27;ve searched CHERIoT codebase for some thread_sleep calls. There were only 15 hits, and most of them were related to implementation; only two examples were actual use in the code: busy-wait in TLS stack and polling for response in SNTP driver. Both of those are bad design - they should be using proper synchronization mechanisms.
评论 #40620840 未加载
评论 #40621334 未加载
kats11 months ago
One suggestion is they could make the thread_sleep() function always yield. Then have a lowest-priority task that actually sleeps.
brcmthrowaway11 months ago
Is Linux&#x2F;Windows&#x2F;Mac tickless?
评论 #40620892 未加载
评论 #40620074 未加载
评论 #40626375 未加载
评论 #40619928 未加载