CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 34

Threaded View

  1. #14
    Join Date
    May 2007
    Posts
    1,546

    Re: multicore support in C#

    Quote Originally Posted by ZOverLord View Post
    This statement is completely false:

    "You won't increase performance and you run the risk that some other developer has had the same (bad) idea and then both of your programs will suffer a huge performance penalty as they fight for the same core despite having several completely free cores."
    Let me make my position clearer:

    On a standard desktop (or standard server), if you app1thread1 is forced to execute on core0 and app2thread1 is forced to execute on core0, then both of those threads will execute on core0. If you have a 10000 core box, those two threads will still execute on core0.

    Therefore both applications will have 1/2 the performance they should have as compared to letting the OS schedule the two threads onto core0 and core1 respectively.

    So yes, my statement is correct. Sure, you can employ third party software which will change the processor for active threads/processes, but then you're just substituting the OS scheduler for a third party scheduler. Sure, this can work. The third party scheduler could easily be better. But unless you employ this software, you *should not* force threads to execute on a specific core.

    EDIT:
    If you have third party software which manages which thread operates on which core, then trying to set affinity in code is a waste of time as the third party scheduler will just override that. So you've just weakened the argument for trying to set the affinity through code.

    Having properly weighted factors used to determine process/thread placement in cores for the enviornment you are in, gives you much better odds of increasing your performance, if even for a short period of time, than blind-luck does.

    It also would make it impossible to "fight for the same core despite having several completely free cores" in all cases, again, worse case being better off in the short term than long term.
    Unfortunately these properly weighted factors will not be available in usercode.
    Last edited by Mutant_Fruit; December 10th, 2008 at 12:39 PM.
    www.monotorrent.com For all your .NET bittorrent needs

    NOTE: My code snippets are just snippets. They demonstrate an idea which can be adapted by you to solve your problem. They are not 100% complete and fully functional solutions equipped with error handling.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured