博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
rtlinux
阅读量:4191 次
发布时间:2019-05-26

本文共 1486 字,大约阅读时间需要 4 分钟。

rtlinux 原理

摘抄自: https://rt.wiki.kernel.org/index.php/Frequently_Asked_Questions

How does the CONFIG_PREEMPT_RT patch work?The RT-Preempt patch converts Linux into a fully preemptible kernel. The magic is done with:Making in-kernel locking-primitives (using spinlocks) preemptible though reimplementation with rtmutexes.Critical sections protected by i.e. spinlock_t and rwlock_t are now preemptible. The creation of non-preemptible sections (in kernel) is still possible with raw_spinlock_t (same APIs like spinlock_t).Implementing priority inheritance for in-kernel spinlocks and semaphores. For more information on priority inversion and priority inheritance please consult Introduction to Priority Inversion.Converting interrupt handlers into preemptible kernel threads: The RT-Preempt patch treats soft interrupt handlers in kernel thread context, which is represented by a task_struct like a common user space process. However it is also possible to register an IRQ in kernel context.Converting the old Linux timer API into separate infrastructures for high resolution kernel timers plus one for timeouts, leading to user space POSIX timers with high resolution.

总结:

减少linux的关抢占时间,让高优先级任务能够更快的被调度到运行

  1. 将会关抢占的spinlock改成rtmutext, spinlock变成可抢占
  2. 将中断内核线程化。软中断改成内核线程
  3. 增加优先级继承,解决优先级反锁问题

原生linux 内核抢占选项

  1. CONFIG_PREEMPT_VOLUNTARY
    在内核函数流程中布置了cond_schedule 函数, 即内核里布满了检查是否有高优先级任务可以抢占当前任务的情况
  2. CONFIG_PREEMPT
    — 增加中断在内核态返回以及 抢占打开时的任务抢占切换检查

参考资料

https://blog.csdn.net/rikeyone/article/details/94555165

你可能感兴趣的文章
jsp 9大内置对象
查看>>
MySQL 5.7.27 详细下载安装配置教程
查看>>
使用Git制作和提交patch
查看>>
从0开始运行主线Linux内核
查看>>
leetcode 505 迷宫2
查看>>
小孩编程积木玩具
查看>>
科学育儿书籍
查看>>
emacs 学习
查看>>
cygwin
查看>>
内核页表
查看>>
github
查看>>
sublime
查看>>
linux 内存函数
查看>>
sdcardfs
查看>>
csdn 代码拷贝编译错误解决方法
查看>>
软件开发经典书籍
查看>>
spinlock原理
查看>>
dup源码分析
查看>>
try_to_wakeup 选择其他核运行逻辑
查看>>
2021-03-28
查看>>