Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. increasing maximum threads per process

increasing maximum threads per process

Scheduled Pinned Locked Moved C / C++ / MFC
c++question
4 Posts 4 Posters 9 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    scott sanders
    wrote on last edited by
    #1

    I'm writing an application to utilize 30 external processors, and I would like to have 2 threads open for each chip (monitoring and control). The program is an MFC app, and I'm using AfxBeginThread to launch each thread. This works great up to 56 threads, but after that Windows won't create any more (I get NULL returned from AfxBeginThread). Including the 5 other threads in my program, Task Manager correctly reports that 61 threads are in use. I need 65. Can I exceed this number in Windows 2000? Is there actually a limit on 61 threads per process? Thank you srs

    A T A 3 Replies Last reply
    0
    • S scott sanders

      I'm writing an application to utilize 30 external processors, and I would like to have 2 threads open for each chip (monitoring and control). The program is an MFC app, and I'm using AfxBeginThread to launch each thread. This works great up to 56 threads, but after that Windows won't create any more (I get NULL returned from AfxBeginThread). Including the 5 other threads in my program, Task Manager correctly reports that 61 threads are in use. I need 65. Can I exceed this number in Windows 2000? Is there actually a limit on 61 threads per process? Thank you srs

      A Offline
      A Offline
      Anders Molin
      wrote on last edited by
      #2

      I don't know with AfxBeginThread(), but I always use _beginthreadex() and have created more than 60 threads per processor... - Anders Money talks, but all mine ever says is "Goodbye!"

      1 Reply Last reply
      0
      • S scott sanders

        I'm writing an application to utilize 30 external processors, and I would like to have 2 threads open for each chip (monitoring and control). The program is an MFC app, and I'm using AfxBeginThread to launch each thread. This works great up to 56 threads, but after that Windows won't create any more (I get NULL returned from AfxBeginThread). Including the 5 other threads in my program, Task Manager correctly reports that 61 threads are in use. I need 65. Can I exceed this number in Windows 2000? Is there actually a limit on 61 threads per process? Thank you srs

        T Offline
        T Offline
        Tim Smith
        wrote on last edited by
        #3

        Something else is going on. The theoretical limit is 2048 using default stack size. I would step into the MFC code and see what the problem is. Tim Smith I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?

        1 Reply Last reply
        0
        • S scott sanders

          I'm writing an application to utilize 30 external processors, and I would like to have 2 threads open for each chip (monitoring and control). The program is an MFC app, and I'm using AfxBeginThread to launch each thread. This works great up to 56 threads, but after that Windows won't create any more (I get NULL returned from AfxBeginThread). Including the 5 other threads in my program, Task Manager correctly reports that 61 threads are in use. I need 65. Can I exceed this number in Windows 2000? Is there actually a limit on 61 threads per process? Thank you srs

          A Offline
          A Offline
          Andrew Hafen
          wrote on last edited by
          #4

          The number of threads is limited by the amount of available virtual memory. By default each thread has one megabyte of stack space. This means that you can create at most 2028 threads. To obtain more threads you need to increase your virtual memory or reduce the stack size for each thread. See the CreateThread documentation for addition information.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups