首页
新闻
会员
周边
捐助
园子
·
关注
·
粉丝
·
会员
·
随便看看
·
消息
欢迎,请先
登录
或者
注册
。
登录
/
注册
闪存
博客
发言
小组
投递
新闻
提问
博问
添加
收藏
文库
问题反馈
问题列表
我关注的
我的博问
博问标签
为什么cpu的暂用率不是百分之百
0
[已关闭问题]
<DIV class=cnblogs_code><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #0000ff">using</SPAN><SPAN style="COLOR: #000000"> System;<BR><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">using</SPAN><SPAN style="COLOR: #000000"> System.Collections.Generic;<BR><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">using</SPAN><SPAN style="COLOR: #000000"> System.Linq;<BR><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">using</SPAN><SPAN style="COLOR: #000000"> System.Text;<BR><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">using</SPAN><SPAN style="COLOR: #000000"> System.Threading;<BR><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">namespace</SPAN><SPAN style="COLOR: #000000"> test<BR><IMG id=Codehighlighter1_126_604_Open_Image onclick="this.style.display='none'; document.getElementById('Codehighlighter1_126_604_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_126_604_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_126_604_Closed_Text').style.display='inline';" src="http://space.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_126_604_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_126_604_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_126_604_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_126_604_Open_Text').style.display='inline';" src="http://space.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></SPAN><SPAN id=Codehighlighter1_126_604_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://space.cnblogs.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_126_604_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> </SPAN><SPAN style="COLOR: #0000ff">class</SPAN><SPAN style="COLOR: #000000"> Program3<BR><IMG id=Codehighlighter1_151_602_Open_Image onclick="this.style.display='none'; document.getElementById('Codehighlighter1_151_602_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_151_602_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_151_602_Closed_Text').style.display='inline';" src="http://space.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_151_602_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_151_602_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_151_602_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_151_602_Open_Text').style.display='inline';" src="http://space.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top> </SPAN><SPAN id=Codehighlighter1_151_602_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://space.cnblogs.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_151_602_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> </SPAN><SPAN style="COLOR: #0000ff">static</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000"> Main(</SPAN><SPAN style="COLOR: #0000ff">string</SPAN><SPAN style="COLOR: #000000">[] args)<BR><IMG id=Codehighlighter1_201_365_Open_Image onclick="this.style.display='none'; document.getElementById('Codehighlighter1_201_365_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_201_365_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_201_365_Closed_Text').style.display='inline';" src="http://space.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_201_365_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_201_365_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_201_365_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_201_365_Open_Text').style.display='inline';" src="http://space.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top> </SPAN><SPAN id=Codehighlighter1_201_365_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://space.cnblogs.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_201_365_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Thread thd</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000"> Thread(</SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000"> ThreadStart(test));<BR><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> thd.IsBackground </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">false</SPAN><SPAN style="COLOR: #000000">;<BR><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> thd.Start();<BR><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Console.ReadLine();<BR><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top> }</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> </SPAN><SPAN style="COLOR: #0000ff">private</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">static</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000"> test()<BR><IMG id=Codehighlighter1_410_596_Open_Image onclick="this.style.display='none'; document.getElementById('Codehighlighter1_410_596_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_410_596_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_410_596_Closed_Text').style.display='inline';" src="http://space.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_410_596_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_410_596_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_410_596_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_410_596_Open_Text').style.display='inline';" src="http://space.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top> </SPAN><SPAN id=Codehighlighter1_410_596_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://space.cnblogs.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_410_596_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Console.WriteLine(</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #800000">exec back thread<IMG src="http://space.cnblogs.com/images/dot.gif">.</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #000000">);<BR><IMG id=Codehighlighter1_490_586_Open_Image onclick="this.style.display='none'; document.getElementById('Codehighlighter1_490_586_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_490_586_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_490_586_Closed_Text').style.display='inline';" src="http://space.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_490_586_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_490_586_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_490_586_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_490_586_Open_Text').style.display='inline';" src="http://space.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top> </SPAN><SPAN style="COLOR: #0000ff">while</SPAN><SPAN style="COLOR: #000000">(</SPAN><SPAN style="COLOR: #0000ff">true</SPAN><SPAN style="COLOR: #000000">)</SPAN><SPAN id=Codehighlighter1_490_586_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://space.cnblogs.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_490_586_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> </SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">Console.WriteLine("aaaa");</SPAN><SPAN style="COLOR: #008000"><BR><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top></SPAN><SPAN style="COLOR: #000000"> Thread.Sleep(</SPAN><SPAN style="COLOR: #800080">1000</SPAN><SPAN style="COLOR: #000000">);<BR><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top> }</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top> }</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top> }</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/None.gif" align=top>我写了一个死循环,同时测了线程是backgroud和front的情况,但是cpu使用率还是很低,怎么回事啊</SPAN></DIV>
.NET技术
C#
lexus
|
初学一级
|
园豆:
0
提问于:2008-07-25 22:41
显示帮助
使用"Ctrl+Enter"可进行快捷提交,评论支持部分 Markdown 语法:[link](http://example.com) _italic_ **bold** `code`。
<
>
分享
分享您的问题
其他回答(3)
0
你在里面点东西比如做点乘法试试~~~
沙加
|
园豆:3680
(老鸟四级)
|
2008-07-26 09:19
编辑文本
预览
上传图片
Ctrl+Enter键快速提交
0
设为后台线程与非后台线程的主要区别是:如果是后台线程,调用线程结束,后台线程也结束(不管有没有执行完成),如果不是后台线程,调用线程结束,它并不结束,直到它执行完成后才结束. 另外:不管是不是后台线程它们都不是同一个线程,它们是父子关系. 一个程序中可以有多个后台线程.
侯垒
|
园豆:3435
(老鸟四级)
|
2008-07-26 11:24
编辑文本
预览
上传图片
Ctrl+Enter键快速提交
0
去掉这一句: Thread.Sleep(1000); 你去睡觉了,还能占着CPU?
deerchao
|
园豆:8367
(大侠五级)
|
2008-07-26 17:47
编辑文本
预览
上传图片
Ctrl+Enter键快速提交
0
Thread.Sleep(1000); 会让出CPU时间片, 可以随便做点什么 东西 (什么都不做的话,应该也会很费CPU) 另外,一个问题,就是, 如果你是双核或以上的CPU, 你永远不可能100% 最多是1/CPU 内核个数 ---- 看到你说了你是双核 那你肯定不会是100% 了 建议你不要看那个百分比 去看那个人物管理器里的 CPU使用率 图标 或者找找第三方工具试试 如果你非要让CPU100%,的话 1,你开2个程序实例 2,使用 并行化计算类库, 处理
G yc {Son of VB.NET}
|
园豆:2006
(老鸟四级)
|
2008-07-26 18:06
编辑文本
预览
上传图片
Ctrl+Enter键快速提交
清除回答草稿
您需要
登录
以后才能回答,未注册用户请先
注册
。