核心i7中的多线程优势优于多线程 [英] Advantage Multicore over Multithread in core i7

查看:208
本文介绍了核心i7中的多线程优势优于多线程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
在阅读了有关多核处理器的并行编程之后,我有一些疑问.

Hi All,
After reading about parallel programming by multicore processor,I have some doubts.

  1. 无疑是X-Box游戏台的最佳主意[因为它们有很多核心]
    但是,对于在Windows 7 64位操作系统中运行8个并行进程然后运行100个线程的核心i7来说,它是否有效?
  2. 如果有人设法通过较少的关键资源设法使所有进程并行运行,那么它将如何?
  3. 如果没有,那么它可以提供更好的性能?
  4. 在这种情况下,我可以看到多核编程[我正在使用Open MP尝试VC ++]在i7,win 7 [64位]中赢得了多线程, 4GB内存?
  1. Its undoubtedly best idea for play stations,X-Box [as they have soo... many cores]
    But will it prove to be effective for core i7 running 8 parallel process then running 100 thread in Windows 7 64 bit?
  2. If some how its managed to make all the process running parallel with less critical resource to then will it give better performance over 100 thread?
  3. If not then in which case I can see multicore programming[I am trying VC++ with Open MP] winning over multi thread in my i7,win 7[64 bit] ,4GB ram?



如果我可以用C ++或JAVA的代码在我的机器上运行以比较正在运行的相同任务,那将是很好的

  • 平行
  • 序列
  • 线程


  • It will be great If I can get a code in C++ or JAVA to run in my machine to compare same task running

    • parallel
    • sequence
    • thread
    • 推荐答案

      更多核心只是意味着您可以随时执行更多操作.大多数核心还支持线程化.处理器使用称为执行执行周期的东西工作.此周期有4个阶段,并且每个单独的线程都存在于访存执行周期的每个阶段中,因此有可能使4个单独的线程在单个处理器中工作.

      编程中有效的多线程不是一门科学,而是一种艺术形式.完成大量的多线程编程并观看它运作良好,使我感到自己像交响乐的指挥.您关于8核i7能否运行100个线程的所有问题取决于线程的编程方式.这是一个抽象问题,无法给出确切答案.

      我的建议是编写一个基准性能测试(尽管我确定您可以下载多线程基准测试).我不写JAVA或C ++,所以无法为您提供代码,但是我已经用c#编写了类似的测试.

      从2个线程开始,测量CPU使用率以及完成分配给该线程的任务所需的时间.然后向进程中添加越来越多的线程,直到CPU使用率达到峰值,并且进程时间变得更长.
      More cores quite simply means you can do more at any one time. Most cores also support threading. Processors work using something called the fetch execute cycle. This cycle has 4 stages and it''s possible for 4 separate threads to work within a single processor as each one exists within each stage of the fetch execute cycle.

      Effective multi-threading in programming is less of a science and more of an art form. Completing a good bit of multi-threaded programming and watching it work well makes me feel like the conductor of a symphony. All your questions about can an 8 core i7 run 100 threads depends on how the threads are programmed. It''s an abstract question to which no definite answer can be given.

      My advice would be to write a test to bench mark performance (Although I''m sure you can download multi threading bench mark tests). I don''t write JAVA or C++ so can''t help you with the code but I''ve written similar tests in c#.

      Start with 2 threads, measure CPU usage and how long it takes to complete the task you''ve assigned to the thread. Then add more and more threads to the process until the CPU usages peaks and the process times becomes longer.


      Gday,我不确定我是否理解您的每个观点和您的问题-尽管我会尽力解决这些问题.

      Gday, I''m not so sure I understand each of your points and your questions - though I''ll do what I can to address them.


      1. XBox,PS3实际上只有几个核心,例如PC.
        • PS3-8用于单元,在PS3变体中实现6.
        • Xbox360-3用于PowerPC Xenon

      1. XBox, PS3 actually only have a couple of cores, like PCs.
        • PS3 - 8 for the cell, 6 as implemented in ps3 variants.
        • Xbox360 - 3 for the PowerPC Xenon



      游戏中Point3的一个例子-当我创建一个应用程序以同时下载rss feed时,线程数可能会从1增加到大约15.我要做的就是生成新线程.这些线程在我的i3的2个物理核心和所有4个逻辑处理器上均执行,而没有我的任何指示.所以我的意思是,在i7中,只要有多线程就绪,就几乎可以肯定(或可以肯定?)采用多核处理.

      由于主内存现在以GB为单位进行度量,因此缓存内存仍仅以个位数MB进行度量-缓存通常是最常占用资源的资源.我的理解是,多个进程将比多线程更快地吞噬缓存.就闲置cpu周期而言,缓存丢失通常非常昂贵,因此要努力减少缓存丢失. -现代cpus经常具有以cpu速度运行的缓存,而主内存甚至从未接近此数字.

      真正广泛而有趣的研究主题.



      An example of point3 in play - when I create an app to perform simultaneous download of rss feeds, the number of threads may go from 1 to about 15. All I do is spawn new threads. These threads execute on both of the 2 the physical cores in my i3, and all 4 of the logical processors without any direction from me. So my point is, in the i7 whenever you''ve got multi-threading in place, you''re almost certainly (or certainly?) employing multi-core processing.

      Because the main memory is now measured in GB, yet the cache memory is still only measured in single-digit MBs - the resource that will be most often taxed is the cache. It''s my understanding that multiple processes will eat-up the cache much faster than multiple threads. Cache-misses are generally very expensive in terms of idle cpu-cycles, hence the effort taken to reduce them. - Modern cpus often have cache memory that runs at cpu speed, while main memory is never even close to this figure.

      Truly broad and interesting topic for study.


      这篇关于核心i7中的多线程优势优于多线程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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