Some questions about RT-preempt
2016-07-22 09:32
399 查看
A realtime preemption overview:http://lwn.net/Articles/146861/
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.
Which architectures does the CONFIG_PREEMPT_RT patch support?
There are systems representing the x86, x86_64, ARM, MIPS, and Power architectures using the CONFIG_PREEMPT_RT patch. However, in many ways this is the wrong question. Support for real-time is not just about the instruction setarchitecture, but also about supporting the high resolution timer provided by the CPU and/or CPU support chipset, the device drivers for the system being well behaved, etc. So just because an ARM system from company A may work quite well with the -rt patchset,
it does not guarantee that another ARM system from Company B will work as well; it might have some longer latency problems or it might not work at all. It is true that overall design and architecture of the -rt patch tends to avoid the need for device-driver
specific changes, but there are always software bugs as well as hardware design bugs.
What are important things to keep in mind while writing realtime applications?
Taking care of the following during the initial startup phase:Call mlockall() as soon as possible from main().
Create all threads at startup time of the application, and touch each page of the entire stack of each thread. Never start threads dynamically during RT show time, this will ruin RT behavior.
Never use system calls that are known to generate page faults, such as fopen(). (Opening of files does the mmap() system call, which generates a page-fault).
If you use 'compile time global variables' and/or 'compile time global arrays', then use mlockall() to prevent page faults when accessing them.
more information: HOWTO:
Build an RT-application
相关文章推荐
- confluent 版本比较 3.0.0 vs 2.0.0
- hdu-1242 Rescue DFS解法
- Android 6.0 通话UI设计模式分析(MVC\MVP\MVVM)
- Android编译系统详解(一)——build/envsetup.sh
- @RequestBody获取Json请求数据
- easyUI datagrid 取选中行id
- 文章标题POJ 2785:4 Values whose Sum is 0?(二分)
- Android官方开发文档Training系列课程中文版:管理系统UI之变暗系统条
- 秒懂设计模式(一): Builder模式
- 通讯录之手动型Segue和自动型Segue
- [leetcode] 375. Guess Number Higher or Lower II 解题报告
- Expression Tree Build
- LeetCode 376. Wiggle Subsequence(摇摆子序列)
- [leetcode] 376. Wiggle Subsequence 解题报告
- 解决SurfaceView调用setZOrderOnTop(true)遮挡其他控件的问题
- LeetCode 232. Implement Queue using Stacks
- LeetCode 62. Unique Paths
- LeetCode 225. Implement Stack using Queues
- Android适配——采用Values-dpi-wSize X hSize 模式,并分析原理
- LeetCode 303. Range Sum Query – Immutable