On a GNU/Linux machine, if one wants to do "real-time"(sub millisecond time critical) tasks, you almost invariably have to go through the lengthy, complex, and problem prone process of patching the kernel to expose adequate support[1] [2].
在GNU / Linux机器上,如果想要做“实时”(亚毫秒时间关键)任务,你几乎总是必须经历修补内核的冗长,复杂且容易出错的过程以获得足够的支持[ 1] [2]。
The biggest problem is, many systems where real-time tasking is most useful do not have the fundamental hardware requirements to even allow these patches to work, namely a high resolution timer peripheral. Or if they do, it is specific to the hardware, so as such needs to be specifically implemented in the patch on a case by case basis. This is true even if the CPU/instruction clock rate is more than fast enough to give the required time granularity and then some.
最大的问题是,许多实时任务最有用的系统没有基本的硬件要求甚至不允许这些补丁工作,即高分辨率定时器外设。或者如果他们这样做,则它是特定于硬件的,因此需要根据具体情况在补丁中具体实现。即使CPU /指令时钟速率足够快以提供所需的时间粒度然后一些,这也是如此。
So, my question is, what are some of the best second place ways/tricks to get as close as possible to the above real-time goal? Things that one can simply do in the applications source code, without intimate knowledge of underlying hardware or too much "kernel hacking".
所以,我的问题是,有哪些最好的第二方式/技巧可以尽可能接近上述实时目标?人们可以在应用程序源代码中简单地做的事情,而不需要深入了解底层硬件或太多“内核黑客”。
Elevating process priority, starting an extra thread for "critical" tasks, and (in C) using variants of nanosleep() are the best looking answers/tricks I have come up with so far. I hope to find more.
提升流程优先级,为“关键”任务启动额外的线程,以及(在C中)使用nanosleep()的变体是迄今为止我提出的最佳答案/技巧。我希望能找到更多。
4 个解决方案
#1
4
The sched_setscheduler(2) and friends allow you to use two different soft real-time schedulers, SCHED_FIFO SCHED_RR. Processes running under these schedulers are prioritised higher than regular processes. So as long as you only have a few of theses processes, and control the priorities between them, you can actually get pretty descent real-time responses.
sched_setscheduler(2)和朋友允许您使用两个不同的软实时调度程序SCHED_FIFO SCHED_RR。在这些调度程序下运行的进程的优先级高于常规进程。因此,只要您只有一些这些过程,并控制它们之间的优先级,您实际上可以获得非常下降的实时响应。
As requested in a comment, here is the difference between SCHED_FIFO and SCHED_RR:
根据评论中的要求,这是SCHED_FIFO和SCHED_RR之间的区别:
With the "real-time" schedulers, there are up to 100 different priorities (POSIX only requires 32 distinct levels, so one should use sched_get_priority_min(2) and sched_get_priority_max(2) to get the actual number. The schedulers both work by preempting processes and threads with lower priority, the difference is in how they handle tasks with the same priority.
使用“实时”调度程序,最多有100个不同的优先级(POSIX只需要32个不同的级别,因此应该使用sched_get_priority_min(2)和sched_get_priority_max(2)来获取实际数量。调度程序都通过抢占进程来工作和优先级较低的线程,区别在于它们如何处理具有相同优先级的任务。
SCHED_FIFO, is a first in first out scheduler (hence the name). This means that the the task that hits the run queue first, is allowed to run until it is done, voluntarily gives up its space on the run queue, or is preempted by a higher priority task.
SCHED_FIFO,是先进先出调度程序(因此得名)。这意味着首先命中运行队列的任务被允许运行直到完成,自愿放弃运行队列上的空间,或被更高优先级的任务抢占。
SCHED_RR, is a round robin scheduler. This means that tasks with the same priority are only allowed to run for a certain time quantum. If the task is still running when this time quantum runs out the task is preempted, and the next task in the run queue (with same priority) is allowed to run for up to its time quantum. As with SCHED_FIFO, higher priority tasks preempt lower priority ones, how ever, when a task which was preempted by a higher priority task is allowed to run again, then it's only allowed to run for the time left in its quantum. See the Noes-section in sched_rr_get_interval(2) for how to set the time quantum for a task.
SCHED_RR是一个循环调度程序。这意味着具有相同优先级的任务仅允许运行一定时间量。如果当该时间量程耗尽时任务仍在运行,则任务被抢占,并且允许运行队列中的下一个任务(具有相同的优先级)运行达到其时间量。与SCHED_FIFO一样,优先级较高的任务优先于较低优先级的任务,但是当允许更高优先级任务抢占的任务再次运行时,它只允许在其量程中剩余的时间运行。有关如何设置任务的时间量程,请参阅sched_rr_get_interval(2)中的Noes部分。
#2
3
MRG
MRG
Sub-millisecond is going to be hard to guarantee on a non-RT kernel. I know a lot of very good work has taken place over recent years (e.g. the big kernel lock has gone), but that's still not enough to guarantee it.
在非RT内核上难以保证亚毫秒。我知道近年来已经发生了很多非常好的工作(例如,大内核锁已经消失了),但这仍然不足以保证它。
You could take a look at Scientific Linux from those friendly atom-botherers at CERN and Fermilab. That can have MRG installed (see my link), which gives you a pre-pack setup of the PREEMPT_RT patch.
您可以从CERN和Fermilab的那些友好的原子 - 粒子破坏者那里看一下Scientific Linux。可以安装MRG(参见我的链接),它为您提供了PREEMPT_RT补丁的预包装设置。
Or if you've got the money you could get Redhat MRG. That's a fully supported Linux distro with the PREEMPT-RT patch built in, so that would do away with the problem prone patching of the kernel.
或者,如果你有钱,你可以得到Redhat MRG。这是一个完全支持的Linux发行版,内置了PREEMPT-RT补丁,因此可以解决内核修补问题。
Thing is, Redhat charge a lot for it ($3000 PER YEAR PER INSTALLATION). I think they've tumbled that one of the biggest customers for it is the high speed trading investors who have still gots $lots-and-lots and so won't notice $3000/box/year going out the door.
事实上,Redhat为它收取了很多费用(每年安装3000美元)。我认为他们已经失败了,其中一个最大的客户是高速交易投资者,他们仍然有很多批次,所以不会注意3000美元/盒/年的出门。
How I Got On with MRG
我如何与MRG合作
I've done a fair bit of work with MRG (using both of the above), and it is pretty good. It replaces the interrupt service routines in the stock kernel with threads to service the interrupt. That means that you can run your software at priorities higher than the IRQ threads! That's the sort of thing you have to do if you want to get close to guaranteeing sub-millisecond latency on your application.
我已经使用MRG(使用上述两种方法)完成了相当多的工作,而且非常好。它用线程替换库存内核中的中断服务程序来服务中断。这意味着您可以以高于IRQ线程的优先级运行您的软件!如果您希望接近保证应用程序的亚毫秒延迟,那么您就必须这样做。
There seems to be a gradual drift of MRG things into the mainline kernel, which is a good thing in my opinion. Maybe one day it will become the mainline thing.
似乎MRG事物逐渐漂移到主线内核中,这在我看来是件好事。也许有一天它会成为主线。
Other Gotchas
其他陷阱
Modern CPU thermal management can be a real pain in the neck. I've had systems which lock up for 0.3 seconds whilst a System Management Interrupt was being serviced (by the bleedin' BIOS, not the OS), just because the CPU's warmed up a little bit. See this. So you have to be wary of what your underlying hardware does. Generally you have to start worry about ditching the managed cooling of modern PCs and go back to a big fan spinning fast all the time.
现代CPU热管理可能是一个真正的痛苦。我的系统在系统管理中断服务时被锁定了0.3秒(由bleedin'BIOS,而不是操作系统),只是因为CPU的预热了一点点。看到这个。因此,您必须警惕底层硬件的功能。一般来说,你必须开始担心放弃现代个人电脑的管理冷却,然后回到一个快速旋转的大风扇。
#3
2
You can get quite far with Linux by removing the 'disturbance' from other processes the to the realtime process. I played with the same thing in Windows, which is a much larger horror to get right, but it shows the direction. So a kind of check-list:
通过消除其他进程到实时进程的“干扰”,你可以在Linux上走得很远。我在Windows中使用了同样的东西,这是一个更大的恐怖,但它显示了方向。所以一种检查清单:
- Most important (strange but true): the hardware. Don't go for a laptop, this will be optimized to do strange things during SMM interrupts. Nothing you can do.
- 最重要的(奇怪但真实):硬件。不要去买笔记本电脑,这将被优化为在SMM中断期间做一些奇怪的事情。你什么都做不了。
- The drivers: Linux (and Windows) has bad drivers and good drivers. Related to hardware. And there is only one way to find out: benchmarking.
- 驱动程序:Linux(和Windows)有糟糕的驱动程序和良好的驱动程序。与硬件有关。而且只有一种方法可以找到:基准测试。
Isolate from rest of system, disable all sharing:
从系统的其余部分隔离,禁用所有共享:
- Isolate one CPU (
man cpuset
). Create two CPU sets, one for normal processes, and one for your realtime process. - 隔离一个CPU(man cpuset)。创建两个CPU集,一个用于正常流程,一个用于实时流程。
- Reduce realtime part of your code to the minimum. Communicate with large buffer with other parts of the system. Reduce IO to bare mimimum (since IO has bad guarantees).
- 将代码的实时部分降至最低。与系统的其他部分的大缓冲区通信。将IO减少到最小值(因为IO有不好的保证)。
- Make the process have the highest (soft) realtime priority.
- 使进程具有最高(软)实时优先级。
- Disable HyperThreading (you don't want to share)
- 禁用超线程(您不想共享)
- pre-allocate the memory you need, and mlock() the memory.
- 预分配你需要的内存,以及mlock()内存。
- Isolate the devices you use. Start by allocating a dedicated IRQ to the device (move the other devices to another IRQ, or remove other devices/drivers).
- 隔离您使用的设备。首先为设备分配专用IRQ(将其他设备移动到另一个IRQ,或删除其他设备/驱动程序)。
- Isolate the IO you use.
- 隔离您使用的IO。
Reduce activity of rest of system:
减少系统其余部分的活动:
- only start processes you really really need.
- 只启动你真正需要的流程。
- remove hardware you don't need like disks and other hardware.
- 删除不需要的硬件,如磁盘和其他硬件。
- disable swapping.
- 禁用交换。
- don't use Linux kernel modules or load them up front. The init of modules is unpredictable.
- 不要使用Linux内核模块或预先加载它们。模块的init是不可预测的。
- preferably remove the user also :)
- 最好删除用户:)
Make it stable and reproducable:
使其稳定和可重复:
- disable all energy savings. You want the same performance all of the time.
- 禁用所有节能。您希望始终保持相同的性能。
- review all BIOS settings, and remove all 'eventing' and 'sharing' from them. So no fancy speedsteps, thermal management etc. Choose low latency, don't choose things with 'burst' in the name since that generally trades throughput for worse performance.
- 检查所有BIOS设置,并从中删除所有“事件”和“共享”。所以没有花哨的速度步骤,热管理等。选择低延迟,不要选择名称中带有“突发”的东西,因为这通常会影响吞吐量以降低性能。
- review Linux driver settings, and lower latencies (if applicable).
- 查看Linux驱动程序设置,并降低延迟(如果适用)。
- use a recent kernel which tries to look like a realtime kernel each day somewhat more.
- 使用最近的内核,它每天尝试看起来像一个实时内核。
And then benchmark, using stress testing and leaving the machine on for days while recording max. latencies.
然后进行基准测试,使用压力测试并将机器打开数天,同时记录最大值。延迟。
So: good luck :)
所以:祝你好运:)
#4
1
The biggest problem is, many systems where real-time tasking is most useful do not have the fundamental hardware requirements to even allow these patches to work, namely a high resolution timer peripheral.
最大的问题是,许多实时任务最有用的系统没有基本的硬件要求甚至不允许这些补丁工作,即高分辨率定时器外设。
I strongly disagree: The biggest problem is that you might be blocked or pre-empted for an arbitrary amount of time with no warning. It hardly matters if you can sleep with 1us accuracy if you might occasionally go to sleep for 500ms. Realtime computing is about guaranteed worst case times, not precision sleep intervals. If you want to program an I2C EEPROM you could benefit from a high-resolution timer that would let you meet the setup/hold times as closely as possible without wasting any time. An occasional random delay of 500ms wouldn't matter because the EEPROM would just sit there waiting. That's not a realtime application, though. If you are implementing a control loop with a 1us update to drive a servo, that 500ms delay will cause a huge position disruption while the system runs uncontrolled.
我强烈不同意:最大的问题是你可能会在没有任何警告的情况下被阻止或抢占任意时间。如果你可能偶尔睡觉500毫秒,你可以以1us的准确度睡觉并不重要。实时计算是关于保证最坏情况的时间,而不是精确的睡眠间隔。如果您想对I2C EEPROM进行编程,您可以从高分辨率定时器中受益,该定时器可以让您尽可能地满足建立/保持时间,而不会浪费任何时间。偶尔随机延迟500ms并不重要,因为EEPROM只会坐在那里等待。但这不是一个实时应用程序。如果您正在实施一个带有1us更新的控制回路来驱动伺服系统,那么500ms的延迟将导致系统在系统不受控制地运行时发生巨大的位置中断。
You can't do anything in your application to work around the fact that your disk driver may spend hundreds of milliseconds processing IO completions in an interrupt context. The patches that make the driver friendlier to RT apps are what make an RT kernel.
您无法在应用程序中执行任何操作来解决磁盘驱动程序在中断上下文中花费数百毫秒处理IO完成的事实。使驱动程序对RT应用程序更友好的补丁是构成RT内核的补丁。
#1
4
The sched_setscheduler(2) and friends allow you to use two different soft real-time schedulers, SCHED_FIFO SCHED_RR. Processes running under these schedulers are prioritised higher than regular processes. So as long as you only have a few of theses processes, and control the priorities between them, you can actually get pretty descent real-time responses.
sched_setscheduler(2)和朋友允许您使用两个不同的软实时调度程序SCHED_FIFO SCHED_RR。在这些调度程序下运行的进程的优先级高于常规进程。因此,只要您只有一些这些过程,并控制它们之间的优先级,您实际上可以获得非常下降的实时响应。
As requested in a comment, here is the difference between SCHED_FIFO and SCHED_RR:
根据评论中的要求,这是SCHED_FIFO和SCHED_RR之间的区别:
With the "real-time" schedulers, there are up to 100 different priorities (POSIX only requires 32 distinct levels, so one should use sched_get_priority_min(2) and sched_get_priority_max(2) to get the actual number. The schedulers both work by preempting processes and threads with lower priority, the difference is in how they handle tasks with the same priority.
使用“实时”调度程序,最多有100个不同的优先级(POSIX只需要32个不同的级别,因此应该使用sched_get_priority_min(2)和sched_get_priority_max(2)来获取实际数量。调度程序都通过抢占进程来工作和优先级较低的线程,区别在于它们如何处理具有相同优先级的任务。
SCHED_FIFO, is a first in first out scheduler (hence the name). This means that the the task that hits the run queue first, is allowed to run until it is done, voluntarily gives up its space on the run queue, or is preempted by a higher priority task.
SCHED_FIFO,是先进先出调度程序(因此得名)。这意味着首先命中运行队列的任务被允许运行直到完成,自愿放弃运行队列上的空间,或被更高优先级的任务抢占。
SCHED_RR, is a round robin scheduler. This means that tasks with the same priority are only allowed to run for a certain time quantum. If the task is still running when this time quantum runs out the task is preempted, and the next task in the run queue (with same priority) is allowed to run for up to its time quantum. As with SCHED_FIFO, higher priority tasks preempt lower priority ones, how ever, when a task which was preempted by a higher priority task is allowed to run again, then it's only allowed to run for the time left in its quantum. See the Noes-section in sched_rr_get_interval(2) for how to set the time quantum for a task.
SCHED_RR是一个循环调度程序。这意味着具有相同优先级的任务仅允许运行一定时间量。如果当该时间量程耗尽时任务仍在运行,则任务被抢占,并且允许运行队列中的下一个任务(具有相同的优先级)运行达到其时间量。与SCHED_FIFO一样,优先级较高的任务优先于较低优先级的任务,但是当允许更高优先级任务抢占的任务再次运行时,它只允许在其量程中剩余的时间运行。有关如何设置任务的时间量程,请参阅sched_rr_get_interval(2)中的Noes部分。
#2
3
MRG
MRG
Sub-millisecond is going to be hard to guarantee on a non-RT kernel. I know a lot of very good work has taken place over recent years (e.g. the big kernel lock has gone), but that's still not enough to guarantee it.
在非RT内核上难以保证亚毫秒。我知道近年来已经发生了很多非常好的工作(例如,大内核锁已经消失了),但这仍然不足以保证它。
You could take a look at Scientific Linux from those friendly atom-botherers at CERN and Fermilab. That can have MRG installed (see my link), which gives you a pre-pack setup of the PREEMPT_RT patch.
您可以从CERN和Fermilab的那些友好的原子 - 粒子破坏者那里看一下Scientific Linux。可以安装MRG(参见我的链接),它为您提供了PREEMPT_RT补丁的预包装设置。
Or if you've got the money you could get Redhat MRG. That's a fully supported Linux distro with the PREEMPT-RT patch built in, so that would do away with the problem prone patching of the kernel.
或者,如果你有钱,你可以得到Redhat MRG。这是一个完全支持的Linux发行版,内置了PREEMPT-RT补丁,因此可以解决内核修补问题。
Thing is, Redhat charge a lot for it ($3000 PER YEAR PER INSTALLATION). I think they've tumbled that one of the biggest customers for it is the high speed trading investors who have still gots $lots-and-lots and so won't notice $3000/box/year going out the door.
事实上,Redhat为它收取了很多费用(每年安装3000美元)。我认为他们已经失败了,其中一个最大的客户是高速交易投资者,他们仍然有很多批次,所以不会注意3000美元/盒/年的出门。
How I Got On with MRG
我如何与MRG合作
I've done a fair bit of work with MRG (using both of the above), and it is pretty good. It replaces the interrupt service routines in the stock kernel with threads to service the interrupt. That means that you can run your software at priorities higher than the IRQ threads! That's the sort of thing you have to do if you want to get close to guaranteeing sub-millisecond latency on your application.
我已经使用MRG(使用上述两种方法)完成了相当多的工作,而且非常好。它用线程替换库存内核中的中断服务程序来服务中断。这意味着您可以以高于IRQ线程的优先级运行您的软件!如果您希望接近保证应用程序的亚毫秒延迟,那么您就必须这样做。
There seems to be a gradual drift of MRG things into the mainline kernel, which is a good thing in my opinion. Maybe one day it will become the mainline thing.
似乎MRG事物逐渐漂移到主线内核中,这在我看来是件好事。也许有一天它会成为主线。
Other Gotchas
其他陷阱
Modern CPU thermal management can be a real pain in the neck. I've had systems which lock up for 0.3 seconds whilst a System Management Interrupt was being serviced (by the bleedin' BIOS, not the OS), just because the CPU's warmed up a little bit. See this. So you have to be wary of what your underlying hardware does. Generally you have to start worry about ditching the managed cooling of modern PCs and go back to a big fan spinning fast all the time.
现代CPU热管理可能是一个真正的痛苦。我的系统在系统管理中断服务时被锁定了0.3秒(由bleedin'BIOS,而不是操作系统),只是因为CPU的预热了一点点。看到这个。因此,您必须警惕底层硬件的功能。一般来说,你必须开始担心放弃现代个人电脑的管理冷却,然后回到一个快速旋转的大风扇。
#3
2
You can get quite far with Linux by removing the 'disturbance' from other processes the to the realtime process. I played with the same thing in Windows, which is a much larger horror to get right, but it shows the direction. So a kind of check-list:
通过消除其他进程到实时进程的“干扰”,你可以在Linux上走得很远。我在Windows中使用了同样的东西,这是一个更大的恐怖,但它显示了方向。所以一种检查清单:
- Most important (strange but true): the hardware. Don't go for a laptop, this will be optimized to do strange things during SMM interrupts. Nothing you can do.
- 最重要的(奇怪但真实):硬件。不要去买笔记本电脑,这将被优化为在SMM中断期间做一些奇怪的事情。你什么都做不了。
- The drivers: Linux (and Windows) has bad drivers and good drivers. Related to hardware. And there is only one way to find out: benchmarking.
- 驱动程序:Linux(和Windows)有糟糕的驱动程序和良好的驱动程序。与硬件有关。而且只有一种方法可以找到:基准测试。
Isolate from rest of system, disable all sharing:
从系统的其余部分隔离,禁用所有共享:
- Isolate one CPU (
man cpuset
). Create two CPU sets, one for normal processes, and one for your realtime process. - 隔离一个CPU(man cpuset)。创建两个CPU集,一个用于正常流程,一个用于实时流程。
- Reduce realtime part of your code to the minimum. Communicate with large buffer with other parts of the system. Reduce IO to bare mimimum (since IO has bad guarantees).
- 将代码的实时部分降至最低。与系统的其他部分的大缓冲区通信。将IO减少到最小值(因为IO有不好的保证)。
- Make the process have the highest (soft) realtime priority.
- 使进程具有最高(软)实时优先级。
- Disable HyperThreading (you don't want to share)
- 禁用超线程(您不想共享)
- pre-allocate the memory you need, and mlock() the memory.
- 预分配你需要的内存,以及mlock()内存。
- Isolate the devices you use. Start by allocating a dedicated IRQ to the device (move the other devices to another IRQ, or remove other devices/drivers).
- 隔离您使用的设备。首先为设备分配专用IRQ(将其他设备移动到另一个IRQ,或删除其他设备/驱动程序)。
- Isolate the IO you use.
- 隔离您使用的IO。
Reduce activity of rest of system:
减少系统其余部分的活动:
- only start processes you really really need.
- 只启动你真正需要的流程。
- remove hardware you don't need like disks and other hardware.
- 删除不需要的硬件,如磁盘和其他硬件。
- disable swapping.
- 禁用交换。
- don't use Linux kernel modules or load them up front. The init of modules is unpredictable.
- 不要使用Linux内核模块或预先加载它们。模块的init是不可预测的。
- preferably remove the user also :)
- 最好删除用户:)
Make it stable and reproducable:
使其稳定和可重复:
- disable all energy savings. You want the same performance all of the time.
- 禁用所有节能。您希望始终保持相同的性能。
- review all BIOS settings, and remove all 'eventing' and 'sharing' from them. So no fancy speedsteps, thermal management etc. Choose low latency, don't choose things with 'burst' in the name since that generally trades throughput for worse performance.
- 检查所有BIOS设置,并从中删除所有“事件”和“共享”。所以没有花哨的速度步骤,热管理等。选择低延迟,不要选择名称中带有“突发”的东西,因为这通常会影响吞吐量以降低性能。
- review Linux driver settings, and lower latencies (if applicable).
- 查看Linux驱动程序设置,并降低延迟(如果适用)。
- use a recent kernel which tries to look like a realtime kernel each day somewhat more.
- 使用最近的内核,它每天尝试看起来像一个实时内核。
And then benchmark, using stress testing and leaving the machine on for days while recording max. latencies.
然后进行基准测试,使用压力测试并将机器打开数天,同时记录最大值。延迟。
So: good luck :)
所以:祝你好运:)
#4
1
The biggest problem is, many systems where real-time tasking is most useful do not have the fundamental hardware requirements to even allow these patches to work, namely a high resolution timer peripheral.
最大的问题是,许多实时任务最有用的系统没有基本的硬件要求甚至不允许这些补丁工作,即高分辨率定时器外设。
I strongly disagree: The biggest problem is that you might be blocked or pre-empted for an arbitrary amount of time with no warning. It hardly matters if you can sleep with 1us accuracy if you might occasionally go to sleep for 500ms. Realtime computing is about guaranteed worst case times, not precision sleep intervals. If you want to program an I2C EEPROM you could benefit from a high-resolution timer that would let you meet the setup/hold times as closely as possible without wasting any time. An occasional random delay of 500ms wouldn't matter because the EEPROM would just sit there waiting. That's not a realtime application, though. If you are implementing a control loop with a 1us update to drive a servo, that 500ms delay will cause a huge position disruption while the system runs uncontrolled.
我强烈不同意:最大的问题是你可能会在没有任何警告的情况下被阻止或抢占任意时间。如果你可能偶尔睡觉500毫秒,你可以以1us的准确度睡觉并不重要。实时计算是关于保证最坏情况的时间,而不是精确的睡眠间隔。如果您想对I2C EEPROM进行编程,您可以从高分辨率定时器中受益,该定时器可以让您尽可能地满足建立/保持时间,而不会浪费任何时间。偶尔随机延迟500ms并不重要,因为EEPROM只会坐在那里等待。但这不是一个实时应用程序。如果您正在实施一个带有1us更新的控制回路来驱动伺服系统,那么500ms的延迟将导致系统在系统不受控制地运行时发生巨大的位置中断。
You can't do anything in your application to work around the fact that your disk driver may spend hundreds of milliseconds processing IO completions in an interrupt context. The patches that make the driver friendlier to RT apps are what make an RT kernel.
您无法在应用程序中执行任何操作来解决磁盘驱动程序在中断上下文中花费数百毫秒处理IO完成的事实。使驱动程序对RT应用程序更友好的补丁是构成RT内核的补丁。