免费注册 查看新帖 |

Chinaunix

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

[Tru64 UNIX] Tru64下到底能不能更改cpu时间片大小呢,给点思路也行各位大侠 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-04-21 11:33 |只看该作者 |倒序浏览
如提,困扰几天了,帮帮忙吧,我没有查到这方面的资料啊

论坛徽章:
0
2 [报告]
发表于 2007-04-29 16:32 |只看该作者
不是很清楚你修改CPU Tick的目的是什么,

如果你想改变tru64分配给process/thread的时间片, 或减少context switches的话, 可以试试修改round_robin_switch_rate

#sysconfig -q proc | grep round_robin_switch_rate

#man sys_attrs_proc

  round_robin_switch_rate
      A value that determines (per second of CPU time) the number of context
      switches that can occur between processes with the same priority and
      the timeslice allotted to each process.

      Default value: 0 (100 context switches per second)

      Minimum value: 0

      Maximum value: hz

      The system uses the following formula to compute timeslice:

      timeslice = hz / number_context_switches

      The hz value is the timer interrupt frequency (hertz) for one second of
      CPU time.  This value is dependent on hardware and is typically 1024 or
      1200. (To determine the hz value on a particular system, programmers
      can use the getsysinfo() call with GSI_CLK_TCK as the op parameter.)

      If round_robin_switch_rate is either 0 (zero) or greater than hz, the
      system uses 100 for number_context_switches. For example, if hz is
      1024, the resulting timeslice is 10 milliseconds, and if hz is 1200,
      the resulting timeslice is 12 milliseconds:

      timeslice = 1024 / 100 = 10

      timeslice = 1200 / 100 = 12

      If round_robin_switch_rate is greater than zero and less than or equal
      to hz, then number_context_switches is set to round_robin_switch_rate.
      For example, changing round_robin_switch_rate from 0 to 20 decreases
      the number of context switches and increases timeslice by a factor of
      five:

      timeslice = 1024 / 20 = 51

      timeslice = 1200 / 20 = 60

      Context switching carries a certain amount of CPU overhead. If a CPU
      consistently handles many large jobs that do not complete quickly, a
      larger timeslice (and fewer context switches) may improve throughput.
      However, the tradeoff is reduced response time for any interactive
      processes that the CPU handles.

Decrements the current thread’s quantum.  If this exhausts the thread’s quantum,
a new thread may get scheduled.  Can invoke the update_priority() routine to update the thread’s priority.

The quantum defaults to 1/100 of a second.  Its actual calculation is done in src/kernel/kern/sched_prim.c:

if ((round_robin_switch_rate > 0) && (round_robin_switch_rate <= hz))
                  min_quantum = hz / round_robin_switch_rate;
else
                  min_quantum = hz / 100;

            where hz (hertz) is a global value representing the number of CPU ticks per second and round_robin_switch_rate is configurable via /etc/sysconfigtab.

论坛徽章:
0
3 [报告]
发表于 2007-04-29 16:36 |只看该作者
Source code:
src/kernel/bsd/kern_clock.c
src/kernel/kern/sched_prim.c:

if ((round_robin_switch_rate > 0) && (round_robin_switch_rate <= hz))
                  min_quantum = hz / round_robin_switch_rate;
else
                  min_quantum = hz / 100;

论坛徽章:
0
4 [报告]
发表于 2007-04-29 20:51 |只看该作者
你级别是新手,可是为什么这么强!!!!

论坛徽章:
0
5 [报告]
发表于 2007-04-29 22:38 |只看该作者
确实强!!!!!!!
哪来的源代码???

论坛徽章:
0
6 [报告]
发表于 2007-05-31 11:27 |只看该作者
好长时间没来了,感谢fish_man!!

论坛徽章:
0
7 [报告]
发表于 2007-05-31 16:22 |只看该作者
前面的明白,下面这一段不太明白,再请教,谢谢!!
Decrements the current thread’s quantum.  If this exhausts the thread’s quantum,
a new thread may get scheduled.  Can invoke the update_priority() routine to update the thread’s priority.

The quantum defaults to 1/100 of a second.  Its actual calculation is done in src/kernel/kern/sched_prim.c:

[ 本帖最后由 wenzhang005 于 2007-5-31 16:26 编辑 ]
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP