将CPU分配给我的程序 [英] Assign the CPU to my program

查看:118
本文介绍了将CPU分配给我的程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,所有朋友
如何使用代码在C#中为我的程序分配CPU.
请帮我这对我来说很重要.

我用C#编写了一个程序,该程序比较了与数据库一起工作的数据模式.然后画一个图
显示插入到数据库中的记录数及其时间.
现在,当我运行该程序并绘制一个图时,它的波形非常起伏,这意味着这些图不相等.

对不起所有朋友,因为我的英语说得不好.

谢谢大家

Hi all friends
how to assign CPU to my program in C# with code.
please help me it''s very important for me.

i write a program with C# that compares the Data Patterns which work with databases. and then draw a diagram
that show the number of records that inserted in the database and its time.
now, when i run the program, and draw a diagram it has very undulate, means the diagrams not equal.

Sorry all friends because i can''t speak english well.

thanks all

god be with you.

推荐答案

如果您想学习并行编程,
http://www.microsoft.com/downloads/zh-CN/details.aspx?FamilyID = 86b3d32b-ad26-4bb8-a3ae-c1637026c3ee& displaylang = zh_CN [
If you are trying to learn parallel programing,
http://www.microsoft.com/downloads/en/details.aspx?FamilyID=86b3d32b-ad26-4bb8-a3ae-c1637026c3ee&displaylang=en[^]

assign CPU to my program
What do you mean by this? Assigning priority or affinity?


请在这里查看我的详细答案:
如何对多核进行编程 [
Please see my detailed answer here:
How to program multicore[^].

With .NET, you can use System.Threading.Thread.BeginThreadAffinity/EndThreadAffinity, for compact Framework — System.Threading.Thread.SetProcessorAffinity.

Again, you can do it if your absolutely sure what are you doing. It can make more hard than good.

Good luck,
—SA


这篇关于将CPU分配给我的程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆