免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3973 | 回复: 1
打印 上一主题 下一主题

smp系统中, global timer和local timer的作用,请教 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2012-04-06 16:59 |只看该作者 |倒序浏览
在smp系统中,都要分别打开system timer和各个cpu的local timer,请教大侠们分别有什么作用?
谢谢。

论坛徽章:
0
2 [报告]
发表于 2012-04-07 23:15 |只看该作者
这个问题是这样的,我们知道,linux中的计时是靠timer来提供的,timer每1/HZ个时间来一次中断,这个1/HZ个时间就叫做tick,而从系统开机走过了多少个tick,是通过jiffies来表明的,通过不断的来timer就可以消耗时间片,驱使系统进行schedule。那么timer如何保证是每1/HZ个时间就来一个interrupt呢?这就需要人为的告诉linux每个不同的platform上timer的clock是多少,然后就计算出timer中的reload value是多少,而local timer的reload value是如何计算的呢,其实有两种办法,一种是,人为标明local timer的clock是多少,然后和global timer一样,计算出reload value, 第二种办法是,让local timer先free run(reload value设为0xfffffff),然后delay 1/HZ,在读出reload value,两个相减就是local timer中 1/HZ的时间的reload value了

至于他们的作用
In a multiprocessor system, all general activities (such as handling of software timers) are triggered by the interrupts raised by the global timer, while CPU-specific activities (such as monitoring the execution time of the currently running process) are triggered by the interrupts raised by the local APIC timer

其实如果说他们到底是怎么区分的,也没有一个明确的答案,就是2个timer嘛,至于到底怎么用,就是user自己的问题了。。。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP