LWN: Comments on "A realtime developer's checklist" https://lwn.net/Articles/837019/ This is a special feed containing comments posted to the individual LWN article titled "A realtime developer's checklist". en-us Sat, 06 Sep 2025 04:40:19 +0000 Sat, 06 Sep 2025 04:40:19 +0000 https://www.rssboard.org/rss-specification lwn@lwn.net "priority" https://lwn.net/Articles/839010/ https://lwn.net/Articles/839010/ neilbrown <div class="FormattedComment"> With tongue firmly in cheek, I might suggest that &quot;priority&quot; relates to &quot;prior&quot; meaning &quot;before&quot;. And numbers &quot;before&quot; zero are normally negative.<br> <p> So the first priority has a numerical priority of &quot;-1&quot;. This is highest.<br> My second priority would have the value &quot;-2&quot;, which isn&#x27;t quite as high.<br> <p> A positive value suggests a &quot;laterity&quot;, meaning it can be left until later.<br> <p> </div> Sat, 05 Dec 2020 01:55:56 +0000 "priority" https://lwn.net/Articles/838996/ https://lwn.net/Articles/838996/ dfsmith <div class="FormattedComment"> Is there a reason that the priority (English word) is sometimes inverted from the English meaning of &quot;priority&quot;? It seems that &quot;importance&quot; would be less ambiguous. B-)<br> Examples:<br> &quot;safety is our number one priority&quot; -&gt; set priority to 99.<br> &quot;snacks are low priority&quot; -&gt; set priority to 1 (&quot;low&quot;/&quot;high&quot; priority works!)<br> &quot;our second priority is to ensure lunch is ready&quot; -&gt; set priority to 98.<br> &quot;coffee is way down our priority list&quot; -&gt; set priority to 10 (and ignore the yelling).<br> <p> </div> Fri, 04 Dec 2020 21:10:31 +0000 musl C and sched.h https://lwn.net/Articles/838924/ https://lwn.net/Articles/838924/ mrybczyn <div class="FormattedComment"> Thank you for the clarification!<br> </div> Fri, 04 Dec 2020 07:37:15 +0000 musl C and sched.h https://lwn.net/Articles/838840/ https://lwn.net/Articles/838840/ Hello71 <div class="FormattedComment"> This is not accurate. musl implements the majority of the sched_* functions, including sched_setaffinity, sched_getaffinity, sched_get_priority_max, sched_get_priority_min, sched_getcpu, sched_rr_get_interval, and sched_yield. The only ones not implemented are sched_{get,set}{param,scheduler}. As explained by musl author Rich Felker at <a rel="nofollow" href="https://www.openwall.com/lists/musl/2016/03/01/4">https://www.openwall.com/lists/musl/2016/03/01/4</a>, this is because on Linux, these syscalls operate on a per-thread basis, but POSIX requires them to operate on a per-process basis. However, as he explains, the fix is to simply use pthread_{get,set}schedparam instead.<br> </div> Thu, 03 Dec 2020 03:05:19 +0000 A realtime developer's checklist https://lwn.net/Articles/837940/ https://lwn.net/Articles/837940/ azz <div class="FormattedComment"> And in particular, given the present circumstances, real-time music collaboration applications like Jamulus. I&#x27;ve been using Jamulus a lot over the last few months with an RT-patched kernel, and I&#x27;ve seen several non-technical users enthusing lately about JamulusOS (an Ubuntu Studio-based distribution that seems to be pretty decent at getting low-latency/jitter behaviour out of machines that Windows&#x27; audio drivers struggle on).<br> </div> Fri, 20 Nov 2020 16:13:28 +0000 A realtime developer's checklist https://lwn.net/Articles/837825/ https://lwn.net/Articles/837825/ glenn Yes, it's more about predictability than latency, but optimizing latency can improve predictability (or allows one to achieve predictability on less powerful hardware). <p> Paul McKenney has a great paper on this: <a href="https://www.kernel.org/doc/ols/2008/ols2008v2-pages-57-66.pdf">"Real Time" vs "Real Fast": How to Choose?"</a>. Thu, 19 Nov 2020 18:56:18 +0000 A realtime developer's checklist https://lwn.net/Articles/837772/ https://lwn.net/Articles/837772/ adam820 <div class="FormattedComment"> Any kind of audio processing app, something like Ardour (JACK). It&#x27;s hard to play guitar, process the effects, and hear the output if the output lags behind your string hit by half a second. It&#x27;d be like talking and hearing your speech played back a half second behind; it&#x27;s hard to do.<br> </div> Thu, 19 Nov 2020 15:23:44 +0000 A realtime developer's checklist https://lwn.net/Articles/837734/ https://lwn.net/Articles/837734/ hummassa <div class="FormattedComment"> WRT RT, it&#x27;s not the length of the deadline, but its predictability :-)<br> </div> Thu, 19 Nov 2020 14:03:11 +0000 A realtime developer's checklist https://lwn.net/Articles/837730/ https://lwn.net/Articles/837730/ mathstuf <div class="FormattedComment"> Is instant messaging typically RT? Wouldn&#x27;t the typing latency be the highest thing? Or is this more about &quot;Typing…&quot; notifications? Things interacting with hardware (vsync, constant FPS targets, machine controllers) or wetware deadlines (audio processing, audio/video sync) certainly make sense, but I would have thought typing would have interfered too much. Though if it is, it&#x27;s almost certainly got longer deadlines than other use cases(?).<br> <p> Note, I don&#x27;t do RT development myself, so any misconceptions or naivete is certainly on my side :) .<br> </div> Thu, 19 Nov 2020 13:04:03 +0000 A realtime developer's checklist https://lwn.net/Articles/837639/ https://lwn.net/Articles/837639/ hummassa <div class="FormattedComment"> Videoconference applications.<br> VoIP (voice over Internet Protocol)<br> Online gaming.<br> Community storage solutions.<br> Some e-commerce transactions.<br> Chatting.<br> IM (instant messaging)<br> </div> Wed, 18 Nov 2020 19:27:19 +0000 A realtime developer's checklist https://lwn.net/Articles/837635/ https://lwn.net/Articles/837635/ meyert <div class="FormattedComment"> So what is a typical realtime application for Linux? Can you give an example of an Linux realtime &quot;killer&quot; app?<br> </div> Wed, 18 Nov 2020 18:15:57 +0000 musl C and sched.h https://lwn.net/Articles/837573/ https://lwn.net/Articles/837573/ mrybczyn <div class="FormattedComment"> Thanks for the comment (I&#x27;m the author of the article).<br> <p> Musl does include the sched_* functions, but they are not really implemented. Please check out <a href="https://git.musl-libc.org/cgit/musl/tree/src/sched/sched_setscheduler.c?id=43b640c2ff30bef9c943a8222008f4bd6f6cbaf6">https://git.musl-libc.org/cgit/musl/tree/src/sched/sched_...</a> for example. It just returns an error. This is what the discussion covered.<br> </div> Wed, 18 Nov 2020 05:35:47 +0000 A realtime developer's checklist https://lwn.net/Articles/837541/ https://lwn.net/Articles/837541/ glenn <div class="FormattedComment"> <font class="QuotedText">&gt; So you&#x27;re quite happy for a nuclear power plant to blow up because an operator wanted to play a shoot-em-up game on the same computer?</font><br> <p> Actually, no. Quite the opposite. I make no such argument.<br> <p> Mixed-criticality scheduling is a real field of study in real-time systems. It has wide applications in hard real-time environments. In the scheme I described, where SCHED_FIFO can preempt SCHED_DEADLINE, threads with hard real-time requirements are scheduled by SCHED_FIFO, while threads with soft real-time requirements (bounded deadline tardiness, in this case), are scheduled by SCHED_DEADLINE. These ideas are backed by solid real-time scheduling theory.<br> <p> Mixed-criticality scheduling is not widely supported outside of research kernels, but it is becoming a centerpiece feature of the seL4 microkernel.<br> <p> Let me defend my specific claim that the SCHED_DEADLINE admissions tests is not useful for many users. An admissions test is useful in an &quot;open system,&quot; where the sysadmin (or system designer) cannot predict or control what what is run under the SCHED_DEADLINE policy. If I had to guess at who could benefit from an open linux-rt system, I would guess multi-media and gaming. Contrast this with a &quot;closed system,&quot; where the sysadmin/system-designer controls everything that runs on the system. Who are these users? Robots (including autonomous vehicles), high-frequency trading systems, and I would argue pro-audio tools. Admissions tests are less useful in a closed system because the system-designer can account for CPU requirements ahead of time. After all, they already know enough about their execution time requirements provide execution-time parameters to SCHED_DEADLINE. In short, there is no need for an admissions test in a closed system. And this is where it gets in the way of more robust real-time scheduling: Linux could support a flavor of mixed-criticality scheduling if it did away with the admissions test that no one is really using!<br> <p> Please note that elimination of the admissions test does not mean eliminating budget enforcement. Budget enforcement can still be used to isolate run-away threads.<br> </div> Tue, 17 Nov 2020 17:20:42 +0000 A realtime developer's checklist https://lwn.net/Articles/837488/ https://lwn.net/Articles/837488/ Jonno <div class="FormattedComment"> <font class="QuotedText">&gt; We can&#x27;t do this today with the current Linux scheduler, since SCHED_DEADLINE preempts SCHED_FIFO. This could be done if we were able to reorder the relative priority of the scheduling classes, or simply let SCHED_FIFO preempt SCHED_DEADLINE. This would weaken (violate) the SCHED_DEADLINE admission test guarantees, but I find this feature less compelling than support for a flavor of mixed-criticality. </font><br> <p> In an ideal world, the scheduler would be able to tell whether it would be possible to meet all deadlines even if no SCHED_DEADLINE tasks gets scheduled until the next scheduler tick, and if so give priority to SCHED_FIFO, while still giving priority to SCHED_DEADLINE when necessary to meet deadlines.<br> <p> Unfortunately that would require doing admission control every time the scheduler has to pick a task (rather than just when changing the scheduling policy of a task) which would probably have a prohibitively high overhead.<br> </div> Tue, 17 Nov 2020 16:21:57 +0000 A realtime developer's checklist https://lwn.net/Articles/837492/ https://lwn.net/Articles/837492/ gus3 <div class="FormattedComment"> <font class="QuotedText">&gt; So you&#x27;re quite happy for a nuclear power plant to blow up because an operator wanted to play a shoot-em-up game on the same computer?</font><br> <p> If the operator wants to play a shoot-em-up while on duty, then the priority inversion is taking place within the operator, not the computer.<br> <p> <font class="QuotedText">&gt; mixed criticality would be lovely, but not at the expense of true real-time operation.</font><br> <p> If the constraints of RT can be satisfied in two different domains, whether cores or hosts, it&#x27;s still RT. Just because they have different scheduling requirements, doesn&#x27;t make either of them &quot;fake RT&quot;.<br> </div> Tue, 17 Nov 2020 15:46:43 +0000 A realtime developer's checklist https://lwn.net/Articles/837487/ https://lwn.net/Articles/837487/ Wol <div class="FormattedComment"> <font class="QuotedText">&gt; This would weaken (violate) the SCHED_DEADLINE admission test guarantees, but I find this feature less compelling than support for a flavor of mixed-criticality. </font><br> <p> So you&#x27;re quite happy for a nuclear power plant to blow up because an operator wanted to play a shoot-em-up game on the same computer?<br> <p> The whole point of Real Time is that deadlines are deadlines.As in &quot;you&#x27;re dead if they&#x27;re missed&quot;.<br> <p> I agree mixed criticality would be lovely, but not at the expense of true real-time operation.<br> <p> Cheers,<br> Wol<br> </div> Tue, 17 Nov 2020 14:21:13 +0000 musl C and sched.h https://lwn.net/Articles/837485/ https://lwn.net/Articles/837485/ binkley <div class="FormattedComment"> Perhaps the situation is rapidly changing, but when I check the musl C source repo, I do see `sched.h`:<br> <p> <a href="https://git.musl-libc.org/cgit/musl/log/?qt=grep&amp;q=sched.h">https://git.musl-libc.org/cgit/musl/log/?qt=grep&amp;q=sc...</a><br> <p> re: _a member of the audience noted that the musl C library does not implement [sched.h]_<br> <p> What might be meant is that musl&#x27;s implementation is incomplete for the purposes of the talk.<br> </div> Tue, 17 Nov 2020 13:05:13 +0000 A realtime developer's checklist https://lwn.net/Articles/837472/ https://lwn.net/Articles/837472/ glenn &gt; ...mixing scheduling classes is "strange". <p> On the RT kernel as-is, this is strange. However, you should be able to schedule unrelated threads on disjoint sets of CPUs under different scheduling policies (i.e., a SCHED_FIFO cluster and a SCHED_DEADLINE cluster). <p> There are theoretical grounds for mixing SCHED_FIFO- and SCHED_DEADLINE-style schedulers on shared CPUs. This technique is used in some mixed-criticality schedulers. These schedulers also consider the application-level importance of real-time threads, in addition to scheduling priority (application importance != scheduling priority!!). For example, a <a href="https://people.mpi-sws.org/~bbb/papers/pdf/ecrts07.pdf">simple mixed-criticality scheduler</a> might schedule application-critical threads with fixed-priorities (e.g., SCHED_FIFO) on single CPUs, while scheduling less-application-critical, but still real-time, threads with SCHED_DEADLINE and let these migrate among all CPUs. We can't do this today with the current Linux scheduler, since SCHED_DEADLINE preempts SCHED_FIFO. This could be done if we were able to reorder the relative priority of the scheduling classes, or simply let SCHED_FIFO preempt SCHED_DEADLINE. This would weaken (violate) the SCHED_DEADLINE admission test guarantees, but I find this feature less compelling than support for a flavor of mixed-criticality. Tue, 17 Nov 2020 03:58:41 +0000 A realtime developer's checklist https://lwn.net/Articles/837450/ https://lwn.net/Articles/837450/ dancol <div class="FormattedComment"> Keep in mind that even if *your* real-time application pre-allocates and locks all memory, the *kernel* code you invoke via system calls isn&#x27;t written with the same discipline in mind. Kernel mutexes, for example, are not real-time mutexes by default, so you can still get into priority inversion situations with the rest of the system by invoking kernel code that takes locks owned by non-RT tasks -- for example, the task list lock or an inode lock. (The RT patchset is meant to mitigate this problem.)<br> <p> On a vanilla kernel, you can use *some* OS services without risking priority inversion, but you have to be careful about which ones they are and audit the kernel-side code paths you invoke and make sure that one of your fancy important SCHED_FIFO threads isn&#x27;t going to get blocked behind some slowpoke non-RT part of the system because the SCHED_FIFO thread made a system call that takes a lock while it&#x27;s running in the kernel.<br> <p> If I had my way, we&#x27;d just apply the RT patchset universally, *and* make pthreads in gblic use PI by default, *and* implement surrogate execution so that priority inheritance did something for SCHED_OTHER threads (i.e. normal non-RT processes). (Right now, priority inheritance is useless for SCHED_OTHER.) I&#x27;m not likely to get my way because my proposal would tank throughput on batch workloads, but personally, I value consistency of performance over throughput.<br> </div> Mon, 16 Nov 2020 21:31:15 +0000