TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: How to get started with real-time Linux?

67 点作者 withoutsnow超过 2 年前
I would like to learn and work on both software and hardware of real-time Linux. Any books or projects do you recommand for getting started?

18 条评论

pwnna超过 2 年前
I found this to be hard-ish to get started as well. However, it turns out you just need to write your program to be performant, and know a few tricks to tune the OS and the scheduler. After looking on the internet and failing to find material about this, I wrote a series of blog post for this topic recently, starting with this post: <a href="https:&#x2F;&#x2F;shuhaowu.com&#x2F;blog&#x2F;2022&#x2F;01-linux-rt-appdev-part1.html" rel="nofollow">https:&#x2F;&#x2F;shuhaowu.com&#x2F;blog&#x2F;2022&#x2F;01-linux-rt-appdev-part1.html</a><p>The series is mostly complete, except one to two posts on more advanced topics like validation and lockless programming.
评论 #33060809 未加载
c_o_n_v_e_x超过 2 年前
It&#x27;s not Linux but if you wanted to learn about real time, you could check out Ardupilot for drones. You&#x27;ll get to learn about a variety of topics including:<p>- hardware (embedded hardware, brushless motors, propellers, batteries, radio, etc.)<p>- guidance (sensor fusion algorithms, kalman filtering, etc.)<p>- navigation (GPS&#x2F;GNSS, magnetometers, barometers, accelerometers, gyroscopes, etc.)<p>- control (PWM control, PIDs, feed forward loops, etc.)
评论 #33088965 未加载
评论 #33064443 未加载
FlashPackets超过 2 年前
Your best starting point in LinuxCNC it may very well be the single greatest application for real time linux
rramadass超过 2 年前
Real-Time is a broad field and implemented in one of 3-ways a) On bare-metal, b) Using a RTOS (eg. FreeRTOS, QNX) c) On Linux&#x2F;etc. As such you have to understand what is actually involved when you say something is &quot;real-time&quot; (Hard&#x2F;Soft). As a first approximation &quot;real-time&quot; can be said to be about minimizing latency (within accepted bounds) of service requests (ISRs, task functions etc). Thus if you do it via (a) above you get the best control but have to do everything, (b) gives you some framework support via a RTOS kernel and (c) is always &quot;soft real-time&quot; unless you break out of the kernel. The difficulty increases as you go from (a)-&gt;(b)-&gt;(c) since there are more intermediate layers and abstractions. But this is the best way to approach the study of the subject. With that in mind i can suggest the following books;<p>1) <i>Real-Time Embedded Systems: Design Principles and Engineering Practices by Xiaocong Fan.</i> - Good text book.<p>2) <i>Introduction to Embedded Systems: Using Microcontrollers and the MSP430 by Manuel Jiminez et.al.</i> - Very good book teaching you bare-metal MCU programming.<p>3) <i>Hands-On RTOS with Microcontrollers: Building real-time embedded systems using FreeRTOS, STM32 MCUs, and SEGGER debug tools by Brian Amos</i> - Great book showing the use of all tools&#x2F;ecosystem needed for RTOS programming.<p>4) <i>POSIX.4 Programmers Guide: Programming for the Real World by Bill Gallmeister.</i> - The classic indispensable work on &quot;real-time programming&quot; for Unix-like systems.
评论 #33092770 未加载
gapo超过 2 年前
Real-time linux can be thought of taking vanilla linux - configuring the kernel in a certain way, booting your kernel with certain boot params and writing your real-time application in a certain way.<p>While there quite a few hiccups along the way - you will be able to bring down jitter or OS noise to around 1 us. Of course a microkernel based OS like QNX can take you down to around 1 ns - but then the point of using Linux is that you are able to utilize the ecosystem around it.<p>Look into isolation, real-time patch and high performance computing.
f1shy超过 2 年前
If it must not be linux, I would recommend going for something embedded, like FreeRTOS or similar. The advantages: - Linux + Real Time has become a buzz word, and you will find lots of bad information - If you want to learn HW, nothing better as embedded, where you interact with the hardware. - The FreeRTOS is so small you can really understand it pretty fast. You can see how it is made, much easier than Linux. - The essentials you learn with that, will work with Linux later.
评论 #33089598 未加载
Wesmio超过 2 年前
You are aware that real time only means guaranteed right?<p>What is your goal as this is a broad field?<p>If you wanna just start with it, I would try to read up on cars, can Bus and how all of that works.
评论 #33059500 未加载
jcelerier超过 2 年前
The best I&#x27;ve managed to achieve is by taking Linux off the real-time equation as much as possible : use isolcpu to tell Linux to not schedule processes on specific cores, put them there yourself with pthread API, nice etc. You can also control on which core interrupts happen fairly easily. This gives you almost microcontroller-like access to some of your CPU cores.
评论 #33091925 未加载
numpad0超过 2 年前
I think I have been on a similar path of thought: While there are many speed tricks and parallelized processing to try and to use in modern PC, there are surprisingly little available resources for realtime, as in synchronous-to-wall-clock, processing.<p>You can set up a timer interrupts in Arduino, There are web-JavaScript tutorials to set up callback function to execute every 3000ms, but you won&#x27;t be doing RPC over network with timestamps and expiration, without going neck deep in something specialized and chaotic as ROS2.<p>I&#x27;m picturing some sort of distributed, networked, timestamped <i>system</i> that can schedule remote executions and construct time correlated observations, something obvious to designers&#x2F;architects of original SNMP spec and NIST 4D&#x2F;RCS project, and I&#x27;m predicting we&#x27;ll have an industry standard framework just casually appearing by the end of this decade. It&#x27;s weird we don&#x27;t have one.
nailer超过 2 年前
Basically:<p>- Traditional Unix optimises for sharing resources and using them efficiently - &#x27;multiprocessing&#x27;, &#x27;time slicing&#x27;, &#x27;resource sharing&#x27;, &#x27;garbage collecting&#x27;, etc.<p>- Realtime: optimises for deterministic low latency. SCHED_FIFO processes that use a logical CPU and do not yield during the trading day, use money to buy more memory or crash rather than allow the GC to destroy your latency during the trading day.<p><a href="https:&#x2F;&#x2F;access.redhat.com&#x2F;documentation&#x2F;en-us&#x2F;red_hat_enterprise_linux_for_real_time&#x2F;9&#x2F;html&#x2F;optimizing_rhel_9_for_real_time_for_low_latency_operation&#x2F;index" rel="nofollow">https:&#x2F;&#x2F;access.redhat.com&#x2F;documentation&#x2F;en-us&#x2F;red_hat_enterp...</a> is RHEL RT focused but the kernel optimisations discussed are all OSS licensed.
snvzz超过 2 年前
Don&#x27;t.<p>Linux is too complex to provide any sort of guarantee; real-time Linux is just soft realtime.<p>Look at an actual RTOS instead, such as seL4[0].<p>0. <a href="https:&#x2F;&#x2F;sel4.systems&#x2F;About&#x2F;seL4-whitepaper.pdf" rel="nofollow">https:&#x2F;&#x2F;sel4.systems&#x2F;About&#x2F;seL4-whitepaper.pdf</a>
评论 #33090790 未加载
eliasmacpherson超过 2 年前
I seem to recall an ubuntu music variant distro with the RT patch baked in but cannot for the life of me dig it up.<p>This however may give you a nice point to dive in from:<p><a href="https:&#x2F;&#x2F;ubuntu.com&#x2F;engage&#x2F;an-introduction-to-real-time-linux-part-i" rel="nofollow">https:&#x2F;&#x2F;ubuntu.com&#x2F;engage&#x2F;an-introduction-to-real-time-linux...</a><p>for more advanced projects consider getting preempt-rt going in a yocto install.
评论 #33089015 未加载
arminiusreturns超过 2 年前
Others are offering good books and things, but my experience during my autonomous vehicle days, I found just seeing how rt-linux was being used by others during market research was very useful in understanding how it was being used and where it failed and needed a more tested RTOS. So my suggestion is start searching the startup space and see how its being used these days.
hansvm超过 2 年前
Not a book or a project, but I can&#x27;t recommend enough using Xenomai4&#x2F;EVL. Under the common use case of &quot;some small kernel of code needs bounded latency&quot; plus &quot;I want to use normal Linux and not think about realtime shenanigans damnit,&quot; you&#x27;ll have a substantially easier time developing in that environment than anything else I&#x27;m aware of.
meltyness超过 2 年前
Having only dealt with this at the level of writing code for a RISC microcontroller, another facet I don&#x27;t see mentioned that may be of importance is the following CPU implementation detail.<p>Code compiles to assembly instructions which typically appear atomic to the author, however, such instructions may take variable numbers of cycles to execute.
rubicks超过 2 年前
1. install hwlatdetect<p>2. use hwlatdetect<p>3. give up when you realize you can&#x27;t buy commodity hardware with documented NMIs or open-source firmware
ofrzeta超过 2 年前
I am not an expert on the matter but as far as I understand you need the appropriate hardware platform, too? Last time I did some research about it I came to the conclusion that for instance Raspberries make for a poor RT platform. Is that not the case?
akimball超过 2 年前
<a href="https:&#x2F;&#x2F;rt.wiki.kernel.org" rel="nofollow">https:&#x2F;&#x2F;rt.wiki.kernel.org</a> <a href="https:&#x2F;&#x2F;en.m.wikipedia.org&#x2F;wiki&#x2F;RTLinux" rel="nofollow">https:&#x2F;&#x2F;en.m.wikipedia.org&#x2F;wiki&#x2F;RTLinux</a>