Results 1 to 4 of 4

Thread: Multicore

  1. #1
    Legendary Member NecroDOME's Avatar
    Join Date
    Mar 2004
    Location
    The Netherlands, Eindhoven
    Posts
    1,059

    Multicore

    So now we have a discussion on multi core/threaded stuff, I want to get a little more into the details.

    My engine currently has support for more than one thread.

    No my question is: how do I set my threads to a different core and how can I schedule everything? For multi threading I currently use critical sections.
    My threads also need to switch from core at runtime. Is that possible or should I just define one thread per core?
    NecroSOFT - End of line -

  2. #2

    Multicore

    You can use the windows API.

    SetAffinity
    GetAffinity

    to set which CPU Core a thread will run on. The following article will give you a good idea on how to do this.

    http://www.delphi3000.com/articles/a....asp?SK=thread

    Linux and Mac OS X are difference, currently Free Pascal does not have the affinity calls defined I'm working on it for my own Engine but it's a long job as most of the required header files have not been converted.
    <A HREF="http://www.myhpf.co.uk/banner.asp?friend=139328">
    <br /><IMG SRC="http://www.myhpf.co.uk/banners/60x468.gif" BORDER="0">
    <br /></A>

  3. #3

    Multicore

    My understanding is that it's better to use SetThreadIdealProcessor to suggest the os which core the thread should run on. Masking the affinity might lead to the thread being locked on a processor which is active with something else. The os will try to balance the load. And as long as the process affinity mask is set to all processors then it'll automatically spread the threads across all free processors
    Peregrinus, expectavi pedes meos in cymbalis
    Nullus norvegicorum sole urinat

  4. #4
    Legendary Member NecroDOME's Avatar
    Join Date
    Mar 2004
    Location
    The Netherlands, Eindhoven
    Posts
    1,059

    Multicore

    Thnx JSoftware, thats what I was looking for
    NecroSOFT - End of line -

Bookmarks

Posting Permissions

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