LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1000|回复: 5

linux的实时性讨论

[复制链接]
发表于 2005-9-27 15:20:05 | 显示全部楼层 |阅读模式
今天看linux的任务调度发现内核已经考虑了实时性的进程,但是常常听说linux的实时性太差,不知道大家对实时性的时间要求如何?还有就是linux对实时进程的最大最小反映时限如何从理论上计算?
一下是任务调度的两个注意点供参考:
注意linux的任务优先级
在v2.4.30以上的版本考虑到了实时任务和普通任务的区别
在任务调度的的时候分别处理上面的两种任务
如在schedule函数中通过
weight = goodness(p, this_cpu, prev->active_mm);计算权值的时候
对于实时任务最低为1000(weight = 1000 + p->rt_priority;)
注意普通任务的时间片,优先级nice 和权值
详情参考goodness函数
if (p->policy == SCHED_OTHER) {
                /*
                 * Give the process a first-approximation goodness value
                 * according to the number of clock-ticks it has left.
                 *
                 * Don't do any other calculations if the time slice is
                 * over..
                 */
                weight = p->counter;
                if (!weight)
                        goto out;

                        
#ifdef CONFIG_SMP
                /* Give a largish advantage to the same processor...   */
                /* (this is equivalent to penalizing other processors) */
                if (p->processor == this_cpu)
                        weight += PROC_CHANGE_PENALTY;
#endif

                /* .. and a slight advantage to the current MM */
                if (p->mm == this_mm || !p->mm)
                        weight += 1;
                weight += 20 - p->nice;
                goto out;

        }
nice的值在-20到20之间,越大则优先级越低。
发表于 2005-9-27 20:29:23 | 显示全部楼层
实时进程不能说明问题。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-9-28 16:27:36 | 显示全部楼层
能否解释的清楚一些?谢谢!!
回复 支持 反对

使用道具 举报

发表于 2005-10-13 12:19:08 | 显示全部楼层
实时性更多的体现在何时调度,而不是优先级的高低.你优先级再高,我不调度(即不执行schedule),你也没折

我觉得在.2.6引入了内核抢占后,linux实时性才有了质的变化.
Rober Love 提到: The 2.6 Linux kernel is capable of meeting very stringent timing requirements.
回复 支持 反对

使用道具 举报

发表于 2005-10-20 18:25:09 | 显示全部楼层
实时性不是说的这个吧,是指每个操作所用的时间都可以精确计算吧
回复 支持 反对

使用道具 举报

发表于 2005-10-21 09:50:00 | 显示全部楼层
Realtime in operating systems: the ability of the operating system to provide a required level of service in a bounded response time"

A real-time system is one in which the correctness of the computations not only depends upon the logical correctness of the computation but also upon the time at which the result is produced. If the timing constraints of the system are not met, system failure is said to have occurred."

偶觉的象linux这样的general purpose OS的实时性很难根一些专用OS比。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表