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. Multiple thread pool

Multiple thread pool

Scheduled Pinned Locked Moved C / C++ / MFC
tutorial
10 Posts 5 Posters 0 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.
  • J Offline
    J Offline
    Jhony george
    wrote on last edited by
    #1

    hai, i am working in IOCP Socket programming..in this i want to craete multiple thread pools, which means 5 thread pools and each contains 100 threads... like this...how to create this,,, If u Knows,reply me... Mani

    Born to win...!

    M C M 4 Replies Last reply
    0
    • J Jhony george

      hai, i am working in IOCP Socket programming..in this i want to craete multiple thread pools, which means 5 thread pools and each contains 100 threads... like this...how to create this,,, If u Knows,reply me... Mani

      Born to win...!

      M Offline
      M Offline
      manish patel
      wrote on last edited by
      #2

      Visit this Links:: http://www.codeproject.com/internet/jbsocketserver1.asp[^] http://www.codeproject.com/internet/jbsocketserver1.asp[^]

      Thanks and Regards, Manish Patel. B.E. - Information Technology.

      C 1 Reply Last reply
      0
      • J Jhony george

        hai, i am working in IOCP Socket programming..in this i want to craete multiple thread pools, which means 5 thread pools and each contains 100 threads... like this...how to create this,,, If u Knows,reply me... Mani

        Born to win...!

        C Offline
        C Offline
        Cedric Moonen
        wrote on last edited by
        #3

        You mean you want to have 500 threads for your application ? Wow, that's a lot ! You'll probably spend more time switching between the different threads than doing usefull stuff. Why do you need so much threads ?


        Cédric Moonen Software developer
        Charting control [v1.2]

        J 1 Reply Last reply
        0
        • M manish patel

          Visit this Links:: http://www.codeproject.com/internet/jbsocketserver1.asp[^] http://www.codeproject.com/internet/jbsocketserver1.asp[^]

          Thanks and Regards, Manish Patel. B.E. - Information Technology.

          C Offline
          C Offline
          Cedric Moonen
          wrote on last edited by
          #4

          What does it have to do with a thread pool ?


          Cédric Moonen Software developer
          Charting control [v1.2]

          1 Reply Last reply
          0
          • C Cedric Moonen

            You mean you want to have 500 threads for your application ? Wow, that's a lot ! You'll probably spend more time switching between the different threads than doing usefull stuff. Why do you need so much threads ?


            Cédric Moonen Software developer
            Charting control [v1.2]

            J Offline
            J Offline
            Jhony george
            wrote on last edited by
            #5

            hai, thanx for ur reply,actually the main task is banking transactions..so none of the request should not get failed... thats why my requirement is 500 threads...is there any problem,...? to handle this...

            Born to win...!

            C 1 Reply Last reply
            0
            • J Jhony george

              hai, thanx for ur reply,actually the main task is banking transactions..so none of the request should not get failed... thats why my requirement is 500 threads...is there any problem,...? to handle this...

              Born to win...!

              C Offline
              C Offline
              Cedric Moonen
              wrote on last edited by
              #6

              Why do you need one thread per request ? You could simply have one thread to queue the requests and one thread (or more) to process them.


              Cédric Moonen Software developer
              Charting control [v1.2]

              J 1 Reply Last reply
              0
              • C Cedric Moonen

                Why do you need one thread per request ? You could simply have one thread to queue the requests and one thread (or more) to process them.


                Cédric Moonen Software developer
                Charting control [v1.2]

                J Offline
                J Offline
                Jhony george
                wrote on last edited by
                #7

                i am having 100 threads in my server IOCP.. and it is listening for incoming connections.ok.. in client side i am using 500 threads, to send connection request to the server..! why 500 threads i am using is, 500 simultanous user trying to access server at a time.... now only 400 client requests are processed(accepted)...remaining 100 error ocurred... what to do for this..?

                Born to win...!

                L 1 Reply Last reply
                0
                • J Jhony george

                  i am having 100 threads in my server IOCP.. and it is listening for incoming connections.ok.. in client side i am using 500 threads, to send connection request to the server..! why 500 threads i am using is, 500 simultanous user trying to access server at a time.... now only 400 client requests are processed(accepted)...remaining 100 error ocurred... what to do for this..?

                  Born to win...!

                  L Offline
                  L Offline
                  led mike
                  wrote on last edited by
                  #8

                  D.Mani wrote:

                  what to do for this..?

                  Try using Overlapped IO. In most cases it has proven to be more scalable than hand built threading schemes. Based on the description you provided it will likely be an improvement. What bank is this for? I want to make sure an never use it.

                  1 Reply Last reply
                  0
                  • J Jhony george

                    hai, i am working in IOCP Socket programming..in this i want to craete multiple thread pools, which means 5 thread pools and each contains 100 threads... like this...how to create this,,, If u Knows,reply me... Mani

                    Born to win...!

                    M Offline
                    M Offline
                    Mark Salsbery
                    wrote on last edited by
                    #9

                    How many processors does your server have? 500 threads is a huge waste of resources on a machine with say, 4 processors. See Tip #2 here: INFO: Design Issues When Using IOCP in a Winsock Server[^] You should be able to handle thousands of connections with at most, a couple threads per CPU. Regardless, IOCPs don't have multiple thread pools.  The thread pool size is determined by how many threads you have waiting on GetQueuedCompletionStatus(). Mark

                    Mark Salsbery Microsoft MVP - Visual C++ :java:

                    1 Reply Last reply
                    0
                    • J Jhony george

                      hai, i am working in IOCP Socket programming..in this i want to craete multiple thread pools, which means 5 thread pools and each contains 100 threads... like this...how to create this,,, If u Knows,reply me... Mani

                      Born to win...!

                      M Offline
                      M Offline
                      Mark Salsbery
                      wrote on last edited by
                      #10

                      The idea of using an IOCP is to eliminate the need to have a thread for every connection. The server is only capable of simultaneously running one thread per processor, so any more threads than that is a waste of memory, handles, and other system resources. These articles helped me when I first used IOCPs... Writing Windows NT Server Applications in MFC Using I/O Completion Ports[^] Windows Sockets 2.0: Write Scalable Winsock Apps Using Completion Ports[^] Mark

                      Mark Salsbery Microsoft MVP - Visual C++ :java:

                      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