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. The Lounge
  3. Thread Pooling Concepts ( No Code / Just an Idea )

Thread Pooling Concepts ( No Code / Just an Idea )

Scheduled Pinned Locked Moved The Lounge
helpquestion
8 Posts 4 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
    John Aldrich
    wrote on last edited by
    #1

    Kinda skirting the line here, but since I'm not posting code, I figured there wasn't a problem. it's more of an opinion gathering thing. I was thinking that since windows 98 doesn't 'directly' support thread pooling to my knowledge, that it might be possible to 'simulate' a thread pool by starting up a preset number of threads in a suspended state and then pass data ( such as incoming socket connection handles ) along with a call to ResumeThread() I believe it's called. Would this be a goos idea, or would it be prone to problems?


    It's good to see kids turning their minds to wholesum activities such as programming, instead of wasting their lives in the hedonistic disciplines of Sex, Drugs, & Rock & Roll... or Sex with Drugs, or Sex with Rocks while Rolling in Drugs, or whatever new-fangled perversions you little monsters have thought up now... [Shog9 on Kid Programmers]

    T K Richard DeemingR 3 Replies Last reply
    0
    • J John Aldrich

      Kinda skirting the line here, but since I'm not posting code, I figured there wasn't a problem. it's more of an opinion gathering thing. I was thinking that since windows 98 doesn't 'directly' support thread pooling to my knowledge, that it might be possible to 'simulate' a thread pool by starting up a preset number of threads in a suspended state and then pass data ( such as incoming socket connection handles ) along with a call to ResumeThread() I believe it's called. Would this be a goos idea, or would it be prone to problems?


      It's good to see kids turning their minds to wholesum activities such as programming, instead of wasting their lives in the hedonistic disciplines of Sex, Drugs, & Rock & Roll... or Sex with Drugs, or Sex with Rocks while Rolling in Drugs, or whatever new-fangled perversions you little monsters have thought up now... [Shog9 on Kid Programmers]

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

      No need to use suspend/resume. A simple mutex/event/queue system (yes, they do work just fine as long as you are careful), works great. If you want to do your work queue in *nix way (and somewhat safer, but you are trading one type of bug for another), use condition variables. The pthreads implementation should work great. There is also the version in Boost that works great. If you are willing to go the extra mile, condition variables are the way to go. But they aren't idiot proof so you still have to watch yourself. Tim Smith "Programmers are always surrounded by complexity; we can not avoid it... If our basic tool, the language in which we design and code our programs, is also complicated, the language itself becomes part of the problem rather that part of the solution." Hoare - 1980 ACM Turing Award Lecture

      J 1 Reply Last reply
      0
      • T Tim Smith

        No need to use suspend/resume. A simple mutex/event/queue system (yes, they do work just fine as long as you are careful), works great. If you want to do your work queue in *nix way (and somewhat safer, but you are trading one type of bug for another), use condition variables. The pthreads implementation should work great. There is also the version in Boost that works great. If you are willing to go the extra mile, condition variables are the way to go. But they aren't idiot proof so you still have to watch yourself. Tim Smith "Programmers are always surrounded by complexity; we can not avoid it... If our basic tool, the language in which we design and code our programs, is also complicated, the language itself becomes part of the problem rather that part of the solution." Hoare - 1980 ACM Turing Award Lecture

        J Offline
        J Offline
        John Aldrich
        wrote on last edited by
        #3

        I was thinking along the lines of implementing the queue in such a way that when the thread gets created initially that a pointer to the thread handle gets stuck in an queue array and then as the program needs threads it just cycles thru the queue. As it finishes with a thread it would cycle the handle ( after some cleaning ) back into the queue at the ending position reuse.


        It's good to see kids turning their minds to wholesum activities such as programming, instead of wasting their lives in the hedonistic disciplines of Sex, Drugs, & Rock & Roll... or Sex with Drugs, or Sex with Rocks while Rolling in Drugs, or whatever new-fangled perversions you little monsters have thought up now... [Shog9 on Kid Programmers]

        1 Reply Last reply
        0
        • J John Aldrich

          Kinda skirting the line here, but since I'm not posting code, I figured there wasn't a problem. it's more of an opinion gathering thing. I was thinking that since windows 98 doesn't 'directly' support thread pooling to my knowledge, that it might be possible to 'simulate' a thread pool by starting up a preset number of threads in a suspended state and then pass data ( such as incoming socket connection handles ) along with a call to ResumeThread() I believe it's called. Would this be a goos idea, or would it be prone to problems?


          It's good to see kids turning their minds to wholesum activities such as programming, instead of wasting their lives in the hedonistic disciplines of Sex, Drugs, & Rock & Roll... or Sex with Drugs, or Sex with Rocks while Rolling in Drugs, or whatever new-fangled perversions you little monsters have thought up now... [Shog9 on Kid Programmers]

          K Offline
          K Offline
          Kannan Kalyanaraman
          wrote on last edited by
          #4

          If you are not specific to supporting W9x stuff, probably you might consider using IO Completion Ports. I just came across this[^] article. Cheers, Kannan

          J 1 Reply Last reply
          0
          • J John Aldrich

            Kinda skirting the line here, but since I'm not posting code, I figured there wasn't a problem. it's more of an opinion gathering thing. I was thinking that since windows 98 doesn't 'directly' support thread pooling to my knowledge, that it might be possible to 'simulate' a thread pool by starting up a preset number of threads in a suspended state and then pass data ( such as incoming socket connection handles ) along with a call to ResumeThread() I believe it's called. Would this be a goos idea, or would it be prone to problems?


            It's good to see kids turning their minds to wholesum activities such as programming, instead of wasting their lives in the hedonistic disciplines of Sex, Drugs, & Rock & Roll... or Sex with Drugs, or Sex with Rocks while Rolling in Drugs, or whatever new-fangled perversions you little monsters have thought up now... [Shog9 on Kid Programmers]

            Richard DeemingR Offline
            Richard DeemingR Offline
            Richard Deeming
            wrote on last edited by
            #5

            It's already been done! :-) http://www.gotdotnet.com/userarea/filedetails.aspx?filename=ManagedThreadPool.zip[^]

            "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

            T 1 Reply Last reply
            0
            • Richard DeemingR Richard Deeming

              It's already been done! :-) http://www.gotdotnet.com/userarea/filedetails.aspx?filename=ManagedThreadPool.zip[^]

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

              C#? ewww Tim Smith "Programmers are always surrounded by complexity; we can not avoid it... If our basic tool, the language in which we design and code our programs, is also complicated, the language itself becomes part of the problem rather that part of the solution." Hoare - 1980 ACM Turing Award Lecture

              J 1 Reply Last reply
              0
              • T Tim Smith

                C#? ewww Tim Smith "Programmers are always surrounded by complexity; we can not avoid it... If our basic tool, the language in which we design and code our programs, is also complicated, the language itself becomes part of the problem rather that part of the solution." Hoare - 1980 ACM Turing Award Lecture

                J Offline
                J Offline
                John Aldrich
                wrote on last edited by
                #7

                When it comes to C# I'm a bit flat. It's good to see kids turning their minds to wholesum activities such as programming, instead of wasting their lives in the hedonistic disciplines of Sex, Drugs, & Rock & Roll... or Sex with Drugs, or Sex with Rocks while Rolling in Drugs, or whatever new-fangled perversions you little monsters have thought up now... [Shog9 on Kid Programmers]

                1 Reply Last reply
                0
                • K Kannan Kalyanaraman

                  If you are not specific to supporting W9x stuff, probably you might consider using IO Completion Ports. I just came across this[^] article. Cheers, Kannan

                  J Offline
                  J Offline
                  John Aldrich
                  wrote on last edited by
                  #8

                  Unfortunately, i can't support 2000, as I have no way to test this except on 9x. But none the less, that is something to look at. Thanks for the info It's good to see kids turning their minds to wholesum activities such as programming, instead of wasting their lives in the hedonistic disciplines of Sex, Drugs, & Rock & Roll... or Sex with Drugs, or Sex with Rocks while Rolling in Drugs, or whatever new-fangled perversions you little monsters have thought up now... [Shog9 on Kid Programmers]

                  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