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. Threads Handling

Threads Handling

Scheduled Pinned Locked Moved C / C++ / MFC
question
28 Posts 18 Posters 2 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.
  • U Offline
    U Offline
    User 4113829
    wrote on last edited by
    #1

    Hi, Can anyone let me know how many threads can be run at a given point of time? Ranjini

    modified on Monday, February 04, 2008 7:56:19 AM

    M C R R S 11 Replies Last reply
    0
    • U User 4113829

      Hi, Can anyone let me know how many threads can be run at a given point of time? Ranjini

      modified on Monday, February 04, 2008 7:56:19 AM

      M Offline
      M Offline
      mejax
      wrote on last edited by
      #2

      Wrong place to post ! http://www.albahari.com/threading/[^]

      1 Reply Last reply
      0
      • U User 4113829

        Hi, Can anyone let me know how many threads can be run at a given point of time? Ranjini

        modified on Monday, February 04, 2008 7:56:19 AM

        C Offline
        C Offline
        Chris Buckett
        wrote on last edited by
        #3

        42

        ChrisB

        1 Reply Last reply
        0
        • U User 4113829

          Hi, Can anyone let me know how many threads can be run at a given point of time? Ranjini

          modified on Monday, February 04, 2008 7:56:19 AM

          R Offline
          R Offline
          Rajesh R Subramanian
          wrote on last edited by
          #4

          Member 4116875 wrote:

          how many threads can be run at a given point of time?

          Well, that solely depends on time. Intel processors are known to run more threads well in the early morning, whereas AMD processors can run an enormous number of threads after sunset. That's why I run a dual processor machine (one AMD and one intel) with "hot-swap processor slot". I just plug in the faster processor and remove the slower one during morning and evening. :cool: *blows smoke away*

          Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP

          D V 2 Replies Last reply
          0
          • U User 4113829

            Hi, Can anyone let me know how many threads can be run at a given point of time? Ranjini

            modified on Monday, February 04, 2008 7:56:19 AM

            R Offline
            R Offline
            R Giskard Reventlov
            wrote on last edited by
            #5

            How many do you want to be able to handle at any given point in time?

            bin the spin home

            1 Reply Last reply
            0
            • R Rajesh R Subramanian

              Member 4116875 wrote:

              how many threads can be run at a given point of time?

              Well, that solely depends on time. Intel processors are known to run more threads well in the early morning, whereas AMD processors can run an enormous number of threads after sunset. That's why I run a dual processor machine (one AMD and one intel) with "hot-swap processor slot". I just plug in the faster processor and remove the slower one during morning and evening. :cool: *blows smoke away*

              Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP

              D Offline
              D Offline
              Dalek Dave
              wrote on last edited by
              #6

              I also believe that more threads can be run today than say, 15 years ago. Perhaps wiser counsel could explain why this should be so. I suspect that in 20 or 30 years time, more threads could be run. Enough perhaps to spin a suit that could be worn for a job interview where Reading is not required.

              ------------------------------------ I try to appear cooler, by calling him Euler.

              1 Reply Last reply
              0
              • U User 4113829

                Hi, Can anyone let me know how many threads can be run at a given point of time? Ranjini

                modified on Monday, February 04, 2008 7:56:19 AM

                S Offline
                S Offline
                Simon Capewell
                wrote on last edited by
                #7

                50,000 assuming 8 years of 20 threads a day.

                1 Reply Last reply
                0
                • U User 4113829

                  Hi, Can anyone let me know how many threads can be run at a given point of time? Ranjini

                  modified on Monday, February 04, 2008 7:56:19 AM

                  P Offline
                  P Offline
                  Pete OHanlon
                  wrote on last edited by
                  #8

                  Member 4116875 wrote:

                  how many threads can be run at a given point of time?

                  It depends how fit they are, how many leads you've got and how many races you've entered them in.

                  Deja View - the feeling that you've seen this post before.

                  My blog | My articles

                  1 Reply Last reply
                  0
                  • R Rajesh R Subramanian

                    Member 4116875 wrote:

                    how many threads can be run at a given point of time?

                    Well, that solely depends on time. Intel processors are known to run more threads well in the early morning, whereas AMD processors can run an enormous number of threads after sunset. That's why I run a dual processor machine (one AMD and one intel) with "hot-swap processor slot". I just plug in the faster processor and remove the slower one during morning and evening. :cool: *blows smoke away*

                    Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP

                    V Offline
                    V Offline
                    Vikram A Punathambekar
                    wrote on last edited by
                    #9

                    Hilarious! Any more visits down South?

                    Cheers, Vikram.


                    "I will put my new found knolage to good use" - Captain See Sharp. "Every time Lotus Notes starts up, somewhere a puppy, a kitten, a lamb, and a baby seal are killed." - Gary Wheeler.

                    R 1 Reply Last reply
                    0
                    • U User 4113829

                      Hi, Can anyone let me know how many threads can be run at a given point of time? Ranjini

                      modified on Monday, February 04, 2008 7:56:19 AM

                      M Offline
                      M Offline
                      Mike Diack
                      wrote on last edited by
                      #10

                      In the name of a serious answer - it's a very large number, basically limited by physical/virtual memory, depending on the threads size (don't forget that by default, many threads often have a 1Mbyte stack allocation in Win32!) But if you have a ridiculously high number of active unblocked threads, expect very poor performance... Mike

                      G 1 Reply Last reply
                      0
                      • V Vikram A Punathambekar

                        Hilarious! Any more visits down South?

                        Cheers, Vikram.


                        "I will put my new found knolage to good use" - Captain See Sharp. "Every time Lotus Notes starts up, somewhere a puppy, a kitten, a lamb, and a baby seal are killed." - Gary Wheeler.

                        R Offline
                        R Offline
                        Rajesh R Subramanian
                        wrote on last edited by
                        #11

                        Vikram A Punathambekar wrote:

                        Any more visits down South?

                        Probably there will be a quarterly general body meeting during sometime between the end of this month and the middle of March. I'll be there if they ask me to give a presentation on the new features and progress of our current project. There's a load of work to be done before that and I really wish they postpone that meeting, or else I'd have nothing to present to the chair persons. :doh:

                        Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP

                        1 Reply Last reply
                        0
                        • M Mike Diack

                          In the name of a serious answer - it's a very large number, basically limited by physical/virtual memory, depending on the threads size (don't forget that by default, many threads often have a 1Mbyte stack allocation in Win32!) But if you have a ridiculously high number of active unblocked threads, expect very poor performance... Mike

                          G Offline
                          G Offline
                          Gary Wheeler
                          wrote on last edited by
                          #12

                          Mike Diack wrote:

                          In the name of a serious answer - it's a very large number

                          The practical limit on the number of threads of execution has little to do with the 'size' of a thread (code size? data size?). It has far more to do with the kernel's ability to switch context between threads and still leave a useful amount of CPU time for all threads to execute.

                          Mike Diack wrote:

                          many threads often have a 1Mbyte stack allocation in Win32

                          The stack doesn't get allocated into the process working set until it's used.

                          Software Zen: delete this;

                          1 Reply Last reply
                          0
                          • U User 4113829

                            Hi, Can anyone let me know how many threads can be run at a given point of time? Ranjini

                            modified on Monday, February 04, 2008 7:56:19 AM

                            N Offline
                            N Offline
                            NormDroid
                            wrote on last edited by
                            #13

                            Fibers, you should be using fibers and a stint of gardening to put things into perspective.

                            WPF - Imagineers Wanted Follow your nose using DoubleAnimationUsingPath

                            1 Reply Last reply
                            0
                            • U User 4113829

                              Hi, Can anyone let me know how many threads can be run at a given point of time? Ranjini

                              modified on Monday, February 04, 2008 7:56:19 AM

                              J Offline
                              J Offline
                              James R Twine
                              wrote on last edited by
                              #14

                              Meaning the total number of threads that the OS can support, or the total number of threads that your app can launch successfully? I believe that the former is limited by the amount of resources available to the OS (having 4GB installed means nothing if only 256MB are used internally by the OS).    The latter is limited much the same, except that it also gains a limitation from the application itself.  Since a thread's stack space comes from the address space of the process, you can create enough threads that you run out of available thread space.  You can do the same thing by creating threads without cleaning them up (or closing their handles) - the address space used by the thread will not get recovered, and even though you have memory available, you have "no place to put it."    Peace!

                              -=- James
                              Please rate this message - let me know if I helped or not! * * * If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong!
                              Remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
                              See DeleteFXPFiles

                              U 1 Reply Last reply
                              0
                              • U User 4113829

                                Hi, Can anyone let me know how many threads can be run at a given point of time? Ranjini

                                modified on Monday, February 04, 2008 7:56:19 AM

                                R Offline
                                R Offline
                                Rajkumar R
                                wrote on last edited by
                                #15

                                And also it cannot cross one more limit, the numbers that can uniquely represented by the Value of HANDLE, Say HANDLE is a 32 bit value, then 2 power 32 is the limit as each thread is represented by a HANDLE. :)

                                C L 2 Replies Last reply
                                0
                                • R Rajkumar R

                                  And also it cannot cross one more limit, the numbers that can uniquely represented by the Value of HANDLE, Say HANDLE is a 32 bit value, then 2 power 32 is the limit as each thread is represented by a HANDLE. :)

                                  C Offline
                                  C Offline
                                  CPallini
                                  wrote on last edited by
                                  #16

                                  Are you kidding?

                                  If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                                  [my articles]

                                  R 1 Reply Last reply
                                  0
                                  • C CPallini

                                    Are you kidding?

                                    If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                                    [my articles]

                                    R Offline
                                    R Offline
                                    Rajkumar R
                                    wrote on last edited by
                                    #17

                                    I was, I am not sure, but since thread is represented by HANDLE, the number of threads also depends on this data Isn't it? I agree hardware resource will retrict. but assume if infinite hardware, then comment on the above

                                    C 1 Reply Last reply
                                    0
                                    • R Rajkumar R

                                      I was, I am not sure, but since thread is represented by HANDLE, the number of threads also depends on this data Isn't it? I agree hardware resource will retrict. but assume if infinite hardware, then comment on the above

                                      C Offline
                                      C Offline
                                      CPallini
                                      wrote on last edited by
                                      #18

                                      Rajkumar R wrote:

                                      I am not sure, but since thread is represented by HANDLE, the number of threads also depends on this data Isn't it?

                                      Of course.

                                      Rajkumar R wrote:

                                      I agree hardware resource will retrict. but assume if infinite hardware, then comment on the above

                                      Assuming infinite hardware, you may have even a bigger number of thread, since HANDLE definition is

                                      typedef PVOID HANDLE;

                                      i.e. architecture dependent. :)

                                      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                                      [my articles]

                                      R 1 Reply Last reply
                                      0
                                      • C CPallini

                                        Rajkumar R wrote:

                                        I am not sure, but since thread is represented by HANDLE, the number of threads also depends on this data Isn't it?

                                        Of course.

                                        Rajkumar R wrote:

                                        I agree hardware resource will retrict. but assume if infinite hardware, then comment on the above

                                        Assuming infinite hardware, you may have even a bigger number of thread, since HANDLE definition is

                                        typedef PVOID HANDLE;

                                        i.e. architecture dependent. :)

                                        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                                        [my articles]

                                        R Offline
                                        R Offline
                                        Rajkumar R
                                        wrote on last edited by
                                        #19

                                        Yes, I mean even if we have enough h/w resource (not infinite) that can run more than 2 power 32 threads (I think this is possible, what do you say?) on machine in which PVOID is 32 bit, the HANDLE is restricting isn't? :)

                                        C 1 Reply Last reply
                                        0
                                        • R Rajkumar R

                                          Yes, I mean even if we have enough h/w resource (not infinite) that can run more than 2 power 32 threads (I think this is possible, what do you say?) on machine in which PVOID is 32 bit, the HANDLE is restricting isn't? :)

                                          C Offline
                                          C Offline
                                          CPallini
                                          wrote on last edited by
                                          #20

                                          Well, on such a machine, a kind of thread-handle-bank-switching will be required! (i.e. the revenge of the INTEL 16 bit architecture) :laugh:

                                          If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                                          [my articles]

                                          R 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