Re: Is Threading Going Away?
Since this style of "parallellizing" execution is really about performing vector oeprations I doubt we'll be seeing the demise of conventional threading soon.
Optimizing vector operations this way may be nice, but they don't apply to most classes of problems. Usually where they're beneficial is "inside" some componentized facility: a DBMS engine, a sort/merge engine, an encryption engine, image processing engine, etc.
Of course people doing simulation and modeling or things similar to that will have a lot more use for ad hoc vector optimization.
Re: Is Threading Going Away?
Parallelism is only useful in cases where you can have two things operating in parallel... for what I suspect is a great deal of us, it's not very useful.
I don't see how that impacts threading. I don't think the days of Threading details are numbered. I think threading has already been trivialized - especially in VB. It's easier than before to spin up a thread and let it do its thing. More often than not, when people get into trouble with it, is when they cross-thread while trying to update their UI. That's something you do once or twice, learn your lesson and you remember where you "did that once before and have the solution."
-tg
Re: Is Threading Going Away?
An example of what I was getting at was sorting using a divide and conquer approach.
Sometimes a huge list could be broken into one shorter list per execution unit (processor, core, hyperthread, etc.). Then each sublist could be sorted separately, and finally after that is complete the sublists can be merged back into a final complete sorted list.
This can be much faster than just sorting the list "in one go" and many sorting algorthims do sort/merge kinds of things anyway - we just get to use (up?) the other processors to get things done quicker.
Re: Is Threading Going Away?
I agree with the earlier points. When I have used threading, it has been to perform a different process that would run for a potentially long time. Parallelism has no real bearing to that. If I was running several of those processes in a loop, then they would lend themselves to parallelism, but most of the things I thread don't run in a loop of that nature.
As one example, I have a UDP class that runs a thread which listens for an incoming packet. Once a packet is received, the thread decodes the packet, places it in a queue, and exits. Its very last act is to spawn a new instance of itself, which means that a new thread is now listening for a packet on that socket. How could parallelism help in this case? I can't have more than one listener on the socket (I could, but it would be silly, pointless, and error prone), nor can I do without threading at all, since the listening blocks the thread it is on, so it can't be in the UI thread.
Re: Is Threading Going Away?
Massive parallelism has several potential benefits, but I still think for the most part programs are going to be very serialized for the time being. I agree that loops are the biggest thing that can take advantage of parallelism though and will in the short-term help immensely.
I agree though, I see a time where the compiler and the OS will manage all parallelism without any forethought from the developer. You won't even need anything like .AsParallel() if the compiler becomes smart enough to figure it out for you and just do it.
Re: Is Threading Going Away?
The concepts of parallelism and threading, and the challenges they present, have been around for a long time. Both of these concepts, will IMHO be around in some form for a long time. Over the years more of the details of the mechanism(s) gets hidden.
When I first started writing VB .Net programs and doing threading I had a hard time understanding cross-threading errors. Because of my background I would never conceive of having two threads, parallel or otherwise, touch the same piece of memory without controlling it. It is still frustrating at times to have all UI updates controlled by forcing those updates into one thread. But they aren't writing .Net for me.
Re: Is Threading Going Away?
Quote:
Originally Posted by
Jenner
I agree though, I see a time where the compiler and the OS will manage all parallelism without any forethought from the developer. You won't even need anything like .AsParallel() if the compiler becomes smart enough to figure it out for you and just do it.
It would have to be REALLY smart. Many loops that I run (it feels like about half, but I have never done a quantitative study, nor shall I now) are sequential with the option of leaving the loop early if a certain condition has been met. It would be difficult to perform that in parallel, and hard to determine whether there was any benefit.
Re: Is Threading Going Away?
I can think of one example that parallelism would've helped me. In writing a program to calculate factorials I used prime factorization, and to get the primes I created a Sieve of Eratosthenes. It would, I think, be easy to make that several parallel processes.
Another place it would seem to make sense is somewhere you were doing a lot of IO to various different sources.