Title

Comments

  1. Hm, I always heard you should limit it to roughly twice the core count, never 64.

    ReplyDelete
  2. 64 threads ought to be enough for anybody.
      /s

    ReplyDelete
  3. Johan Bontes Well you'd think. Except soon we'll have 32 cores and what then...

    ReplyDelete
  4. Well sometimes I use pipelines with many threads. Each stage has a special amount of threads depending on the used resources inside the stage.

    Example:
    - Download data from web (10 threads)
    - Some calculation on data (one thread per cpu core)
    - Write calculated data to SQlite DB (1 thread)

    The used threads for downloading depends on the bandwidth, expected data size, server limits, ...

    ReplyDelete
  5. Asbjørn Heid Johan Bontes was making a joke at Bill Gates expense: http://www.computerworld.com/article/2534312/operating-systems/the--640k--quote-won-t-go-away----but-did-gates-really-say-it-.html

    As for, we'll soon have 32 cores, that time came years ago. My clients have been running on >64 core machines for years now. And it's not easy to support. There are no Delphi libraries/tools that can help with NUMA memory, processor groups etc., so you have to do it for yourself.

    ReplyDelete
  6. David Heffernan Yes I know, and I was too quick, I meant 32 core single socket cpu's.

    That made me curious though, what kind of hardware are your customers running? Eight sockets, more? I've only been using clusters with a fairly regular 4 socket 8 core nodes or similar, using MPI.

    ReplyDelete
  7. "To wait on more than MAXIMUM_WAIT_OBJECTS handles, use one of the following methods:
    - Create a thread to wait on MAXIMUM_WAIT_OBJECTS handles, then wait on that thread plus the other handles. Use this technique to break the handles into groups of MAXIMUM_WAIT_OBJECTS.
    - Call RegisterWaitForSingleObject to wait on each handle. A wait thread from the thread pool waits on MAXIMUM_WAIT_OBJECTS registered objects and assigns a worker thread after the object is signaled or the time-out interval expires." - from MSDN

    ReplyDelete
  8. Thanks! The first suggestion (grouping) is a bit too complicated for my taste. The second I don't fully understand, to be honest - I've never used RegisterWaitForSingleObject and I'm not sure what the implications are (is it really a good idea to create a new wait thread to terminate worker threads?). For the purpose of shutting down the thread pool I prefer my solution - it's sufficient, as far as I know, and simple.

    ReplyDelete

Post a Comment