Thread Pooling Concepts ( No Code / Just an Idea )
-
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]
-
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]
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
-
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
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]
-
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]
-
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]
It's already been done! :-) http://www.gotdotnet.com/userarea/filedetails.aspx?filename=ManagedThreadPool.zip[^]
-
It's already been done! :-) http://www.gotdotnet.com/userarea/filedetails.aspx?filename=ManagedThreadPool.zip[^]
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
-
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
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]
-
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]