Slashdot Mirror


Is Parallel Programming Just Too Hard?

pcause writes "There has been a lot of talk recently about the need for programmers to shift paradigms and begin building more parallel applications and systems. The need to do this and the hardware and systems to support it have been around for a while, but we haven't seen a lot of progress. The article says that gaming systems have made progress, but MMOGs are typically years late and I'll bet part of the problem is trying to be more parallel/distributed. Since this discussion has been going on for over three decades with little progress in terms of widespread change, one has to ask: is parallel programming just too difficult for most programmers? Are the tools inadequate or perhaps is it that it is very difficult to think about parallel systems? Maybe it is a fundamental human limit. Will we really see progress in the next 10 years that matches the progress of the silicon?"

680 comments

  1. Nope. by Anonymous Coward · · Score: 2, Insightful

    Parallel programming isn't all that hard, what is difficult is justifying it.

    What's hard, is trying to write multi-threaded java applications that work on my VT-100 terminal. :-)

    1. Re:Nope. by lmpeters · · Score: 5, Interesting

      It is not difficult to justify parallel programming. Ten years ago, it was difficult to justify because most computers had a single processor. Today, dual-core systems are increasingly common, and 8-core PC's are not unheard of. And software developers are already complaining because it's "too hard" to write parallel programs.

      Since Intel is already developing processors with around 80 cores, I think that multi-core (i.e. multi-processor) processors are only going to become more common. If software developers intend to write software that can take advantage of current and future processors, they're going to have to deal with parallel programming.

      I think that what's most likely to happen is we'll see the emergence of a new programming model, which allows us to specify an algorithm in a form resembling a Hasse diagram, where each point represent a step and each edge represents a dependency, so that a compiler can recognize what can and cannot be done in parallel and set up multiple threads of execution (or some similar construct) according to that.

    2. Re:Nope. by __aaclcg7560 · · Score: 1

      Didn't "time slicing" take care of the VT-100 terminal problem?

    3. Re:Nope. by dch24 · · Score: 3, Funny

      Parallel programming isn't all that hard
      Then why is it that (as of right now) all the up-modded posts are laid out sequentially down the comment tree?
    4. Re:Nope. by poopdeville · · Score: 5, Interesting

      I think that what's most likely to happen is we'll see the emergence of a new programming model, which allows us to specify an algorithm in a form resembling a Hasse diagram, where each point represent a step and each edge represents a dependency, so that a compiler can recognize what can and cannot be done in parallel and set up multiple threads of execution (or some similar construct) according to that.

      This is more-or-less how functional programming works. You write your program using an XML-like tree syntax. The compiler utilizes the tree to figure out dependencies. See http://mitpress.mit.edu/sicp/full-text/book/book-Z -H-10.html#%25_sec_1.1.5. More parallelism can be drawn out if the interpreter "compiles" as yet unused functions while evaluating others. See the following section.

      --
      After all, I am strangely colored.
    5. Re:Nope. by Lost+Engineer · · Score: 5, Interesting

      It is still difficult to justify if you can more easily write more efficient single-threaded apps. What consumer-level apps out there really need more processing power than a single core of a modern CPU can provide? I already understand the enterprise need. In fact, multi-threaded solutions for enterprise and scientific apps are already prevalent, that market having had SMP for a long time.

    6. Re:Nope. by Gorshkov · · Score: 4, Insightful

      Then why is it that (as of right now) all the up-modded posts are laid out sequentially down the comment tree?
      Because one of the things TFM neglects to mention is that parallel programming, like any other programming method, is suitable for some things and not for others .... and the hard reality is, is that most application programmes you see on the desktop are basically serial, simply because of the way PEOPLE process tasks & information

      There is a very real limit as to how much you can parallelize standard office tasks.
    7. Re:Nope. by lmpeters · · Score: 3, Insightful

      What consumer-level apps out there really need more processing power than a single core of a modern CPU can provide?

      The iLife suite. Especially iMovie. And let's not forget the various consumer and professional incarnations of Photoshop--none of them support more than two cores.

    8. Re:Nope. by Anonymous Coward · · Score: 4, Informative

      Functional programming is no harder than procedural/OO programming. A good functional interpreter can already draw this kind of parallelism out of a program. And yes, there are compiled functional languages with parallelizing compilers. (Erlang and OCaml come to mind)

    9. Re:Nope. by Durandal64 · · Score: 3, Informative

      Multi-threaded programming is very difficult. But some things just shouldn't be done on multiple threads either. Multi-threading is a trade-off to get (generally) better efficiency and performance in exchange for vastly more complex control logic in many cases. This greater complexity means that the program is much more difficult to debug and maintain. Sometimes multi-threading a program is just a matter of replacing a function call with a call to pthread_create(...). But sometimes a program just can't be multi-threaded without introducing unacceptable complexity. A lot of the complaints of difficulty in multi-threading comes from people trying to multi-thread programs that can't be easily changed.

    10. Re:Nope. by mpe · · Score: 1

      Ten years ago, it was difficult to justify because most computers had a single processor.

      Plenty of multi processor computers around 10 years ago. Even quite a few 20 years ago. e.g. The Sequent Symmetry

    11. Re:Nope. by Anonymous Coward · · Score: 1, Insightful

      Even if applications don't need additional CPU power, many of them still need to be much more responsive. Good old single-threaded GUI applications can be significantly improved if the GUI is run in a separate thread or threads and leaves the heavy-lifting to a background thread (or threads, depending on the dataset).

    12. Re:Nope. by lmpeters · · Score: 1

      The point I was trying to make is that multi-processor computers are being used today on a scale far greater than in the past. There may have been multi-processor computers around 10 years ago, but they were rare and expensive. Today, multi-processor systems are everywhere and affordable.

    13. Re:Nope. by RzUpAnmsCwrds · · Score: 3, Insightful

      Functional programming is no harder than procedural/OO programming.


      That's difficult to say because true functional programming is so vastly different. We have so much time and energy invested in imperative algorithms that it's difficult to know whether or not functional methods are easier or more difficult to design.

      In a sense, it's like saying that Hybrid Synergy Drive is simpler than a traditional transmission. It's true on a conceptual level, but Toyota hasn't tried to put HSD everywhere it has put a traditional transmission and therefore we may not fully understand the complexities of trying to extrapolate the results to the entire problem space.

      So, I think the bottom line is, functional programming probably wouldn't be any harder if it existed in a world where it was dominant.

      Remember, a large part of being an effective programmer is understanding how (and if) your problem has been solved before. It may be far from optimal, but CPUs are largely designed to look like they are executing sequential instructions. Multicore and multithreaded designs are changing that model, but it's not a change that happens overnight.
    14. Re:Nope. by chocobot · · Score: 2

      Parallel programming does not have to be hard. All that stuff you learn in programming basics about deadlocks and semaphores and stuff really is hard, but there are easier ways of parallel programming.
      Check out the communicating event loops of the E language or the actors of Scala. Asynchronous message passing removes the deadlock problem and makes relatively easy to understand programs.

    15. Re:Nope. by EvanED · · Score: 5, Insightful

      Yes, but that's an easy sort of parallelism. Heck, I wrote a fractal generator that did the generation in a separate thread in 11th grade after writing my first Win32 program 4 or 5 months previous. It was also my first experience with threads. I'm not even sure I really knew what they were before that. This isn't *really* paralleling the application in the sense TFA means.

      Closer is this: After some more work and a rewrite (for other reasons), I had "Fracked" running n threads, each rendering 1/n of the display. Data parallelism == easy parallelism.

      But a lot of problems don't fit these models, and need a LOT of thought put into how to parallelize them. It's likely that some problems in P are not efficiently parallelizable.

    16. Re:Nope. by Anonymous Coward · · Score: 0

      I think that what's most likely to happen is we'll see the emergence of a new programming model, which allows us to specify an algorithm in a form resembling a Hasse diagram, where each point represent a step and each edge represents a dependency, so that a compiler can recognize what can and cannot be done in parallel and set up multiple threads of execution (or some similar construct) according to that.

      Over 10 years ago, I was using a "visual programming language" created by National Instruments called LabView. HP had a similar visual programming language, but was less flashy than LabView. Both used diagrams to describe objects and data flows. These created multi-threaded, parallel processing applications. http://www.ni.com/labview/.

      The problem was, spaghetti code ended up actually looking like spaghetti

    17. Re:Nope. by Anonymous Coward · · Score: 2, Insightful

      Puppies are cute. You shouldn't use poison on everything. Fast food is convenient but makes you fat. More fat means you look fatter. Some things are easy. Some things are hard. Screen doors on submarines are unpopular.

    18. Re:Nope. by gnalre · · Score: 2, Insightful

      Most of the problems of parallel programming were solved decades ago. Unfortunately the industry can be very conservative with new programming methods and tends to shoe horn the tried and trusted on to new problems.

      The truth is languages such as C/C++ and Java(to lesser extent) are not good languages to write parallel code in. They do not have the constructs built in such as process communication links, mutexes, semaphores that parallel programs rely on. You end up writing aracne code to get this sort of functionality.

      The other problem is that the debugging tools make montoring multiple parallel programs difficult.

      20 years ago I was using a language called Occam that made writing multiple parallel programs a breeze, 10 years ago I was using erlang which again allowed us to easily generate thousands of lightweight threads.

      Today I am still struggling to write the same things in C++ using the standard windows process constructs.

      --
      Choose your allies carefully, it is highly unlikely you will be held accountable for the actions of your enemies
    19. Re:Nope. by Novus · · Score: 2, Informative

      Asynchronous message passing removes the deadlock problem
      Could you elaborate on your reasoning behind that? You can just as easily have processes deadlocked waiting for messages from each other as for semaphores or locks to be released (and I've seen hundreds of examples as a TA on a concurrent programming course).
    20. Re:Nope. by Anonymous Coward · · Score: 1, Insightful

      Can't talk about OCaml, but I am pretty sure that you have to make the parralelism explicit in erlang. The runtime allows for multiple communicating processes on multiple cpus or machines, but the compiler doesn't parallelise for you.

      Having said that, erlang is a very nice language to learn. I use it to control message passing between bits of number crunching code on different machines, as it is easier than writing boilerplate in c++.

    21. Re:Nope. by hoover · · Score: 1

      Um, the Amiga system comes to mind here, too, with the blitter and copper being separate cpu-like entities which could be programmed out of band alongside the CPU; same goes for the C64 and its 1541 floppy "co-processor", if I recall correctly ;-)

      --
      Ever wondered whats wrong with the world? http://www.ishmael.org/
    22. Re:Nope. by Anonymous Coward · · Score: 0

      Erlang isn't implicitly parallel, but for example Fortress is.

    23. Re:Nope. by Anonymous Coward · · Score: 2, Interesting

      Don't forget that the makers of applications like that will probably see a multi-core version as something they can sell at a premium.
      So they first sell versions for a single CPU, then when the market for multi-core versions is sufficiently large they start selling new versions and upgrades.
      It is good to keep the clients waiting for some time, because they will feel that their special needs have been catered for. When they would put out two different boxes at a time almost nobody is interested yet, the negative feelings around "why does the multi-core version cost more" will hit them too much.

    24. Re:Nope. by Anonymous Coward · · Score: 1, Informative

      Sure, it's not "parallel programming" but this discussion has clearly degenerated into a anti-threading discussion which is so common on Slashdot. The GP simply stated that it is hard to justify anything other than a single-thread for consumer software, and I'm pointing out that clearly isn't the case.

    25. Re:Nope. by smallfries · · Score: 1

      Ok, but to be fair you must have worked in Kent...

      --
      Slashdot: where don knuth is an idiot because he cant grasp the awesome power of php
    26. Re:Nope. by Jartan · · Score: 1

      It is not difficult to justify parallel programming. Ten years ago, it was difficult to justify because most computers had a single processor. Today, dual-core systems are increasingly common, and 8-core PC's are not unheard of. And software developers are already complaining because it's "too hard" to write parallel programs.


      He didn't mean that kind of justification. There seems to be a misconception among non programmers that parallel programming is something that merely has to be implemented and then suddenly those crazy 4 core PC's will be ultra powerful.

      That can work for some things but for many uses the overhead created by using multiple cores makes speeding up the parts that matter impossible.
    27. Re:Nope. by Gordonjcp · · Score: 1

      Atari 800 and the ANTIC chip, too...

    28. Re:Nope. by XchristX · · Score: 1

      Asynchronous message passing removes the deadlock problem I don't understand, you could just as easily deadlock a proggie in MPI point-to-point communication using asynchronous mode as follows

      if(pid==x)
      {
      MPI_bIRecv(some data tagged 1); /*Unblocked bufferred mode i.e asynch*/
      MPI_Wait(Until request struct matches data);
      MPI_bISend(some data tagged 2);
      }

      if(pid==y)
      {
      MPI_bIRecv(some data tagged 2); /*Unblocked bufferred mode i.e asynch*/
      MPI_Wait(Until request struct matches data);
      MPI_bISend(some data tagged 1);
      }
      You'll have to move the MPI_Wait() below the MPI_bISend to remove the deadlock. In Synch mode the deadlock can also be removed by alternating the Send() and Recv() in alternating processes. The deadlocks are not due to synchronization issues, they are due to blocking issues.
      --
      l'Homme n'est Rien l'Oeuvre Tout: Gustave Flaubert to George Sand
    29. Re:Nope. by nschubach · · Score: 1

      That's already happening... Have you ever prices MS SQL server on a per processor level?

      --
      Every time I start to have faith in humanity, I ruin it by driving to work between 7 and 8 am.
    30. Re:Nope. by Phil+John · · Score: 1

      Almost...

      IIRC, Microsoft licenses Sql Server per "slot" and not per core, so if you have a fancy Core Quad (or whatever it's called) in your DB server it's still counted as 1 processor.

      --
      I am NaN
    31. Re:Nope. by chocobot · · Score: 2

      for me, deadlock is a situation where several objects compete for acquisition to a set of resources. AFAIK this can't happen if asynchronous message sending is used, as requests don't block the requesting party. What you describe is data lock, where two objects/threads/whatever wait for each other to answer before they can continue themselves. This situation is much more difficult to create than deadlocks, also the complete process should not grind to a halt, only the waits should accumulate. Also, live lock problems are consistent, reproducible, and therefore fixable, unlike the deadlocks that appear mysteriously when some incredibly arcane race condition occurs

    32. Re:Nope. by Tim+Browse · · Score: 1

      If you're counting that, then the PS2 is an example of an extremely widely-used parallel system. I think the topic is referring to SMP though.

    33. Re:Nope. by XchristX · · Score: 2, Insightful

      for me, deadlock is a situation where several objects compete for acquisition to a set of resources Well the wikipedia article certainly alludes to that definition (http://en.wikipedia.org/wiki/Deadlock) but the article may be general and not pertain to parallel computing (there is no mention of parallel computing in that article). I thought what you're describing fell into "race condition". The IBM Redbook on MPI (Page 26 of http://www.redbooks.ibm.com/abstracts/sg245380.htm l) explains deadlock as follows (pages 26, 27, 28):

      When two processes need to exchange data with each other, you have to be careful about deadlocks. When a deadlock occurs, processes involved in the deadlock will not proceed any further. Deadlocks can take place either due to incorrect order of send and receive... which is what I said in the last post

      ...,or due to the limited size of the system buffer The first pseudocode on page 27 basically shows what you called a "datalock", right? Also, see Michael Quinn "Parallel Computing in C with MPI and OpenMP" page 148 section 6.5.3 first para

      A Process is in a deadlock state if it is blocked waiting for a condition that will never become true Which seems to not cover your case... Maybe we're talking about different subsets of the same thing, not sure. I'm till rather new to parallel computing.
      --
      l'Homme n'est Rien l'Oeuvre Tout: Gustave Flaubert to George Sand
    34. Re:Nope. by stony3k · · Score: 3, Informative

      The truth is languages such as C/C++ and Java(to lesser extent) are not good languages to write parallel code in.
      To a certain extent Java is trying to correct that with the java.util.concurrent library. Unfortunately, not many people seem to have started using it yet.
      --
      Freedom is not worth having if it does not include the freedom to make mistakes. - Mahatma Gandhi
    35. Re: Nope. by Dolda2000 · · Score: 3, Informative
      It is definitely hard to justify parallel programming, even though many computers are gaining SMP capabilities. The thing isn't necessarily that it is particularly hard to write multi-threaded applications -- the thing is that it is a lot harder to write a multi-threaded program than to write a single-threaded program. Suddenly, you have to introduce locks in all shared data structures and ensure proper locking in all parts of the program. That kind of thing just adds a significant part to the complexity of a program, and it requires a lot more testing as well. Therefore, justification is definitely needed.

      The real question then, is: Is it justified? To be honest, for most programs, the answer is no. Most interactive programs have a CPU-time/real-time ratio of a lot less than 1% during their lifetime (and very likely far less than 10% during normal, active use), so any difference brought by parallelizing them won't even be noticed. Other programs, like compilers, don't need to be parallelized, since you can just run "make -j8" to use all of your 8 cores at once. I would also believe that there are indeed certain programs that are rather hard to parallelize, like games. I haven't written a game in a quite a long time now, and I don't know the advances that the industry has made as of late, but a game engine's step cycle usually involves a lot of small steps, where the execution of the next depends on the result of the previous one. You can't even coherently draw a scene before you know that the state of all game objects has been calculated in full. Not that I'm saying that it isn't parallelizable, but I would think it is, indeed, rather hard.

      So where does that leave us? I, for one, don't really see a great segment of programs that really need parallelizing. There may be a few interactive programs, like movie editors, where the program logic is heavy enough for it to warrant a separate UI thread to maintain interactive responsiveness, but I'd argue that segment is rather small. A single CPU core is often fast enough not to warrant parellelizing even many CPU-heavy programs. There definitely is a category of programs that do benefit from parellelization (e.g. database engines which serve multiple clients), but they are often parellelized already. For everyone else, there just isn't incentive enough.

    36. Re:Nope. by fitten · · Score: 1

      There are different models of parallel computing... what you describe is not much different from threadpools and worker threads... reasonably coarse grained computing. What happens to your model when events have to communicate to each other in a reasonable way? Hint: you end up with all the same problems you claim they avoid.

      The first step of parallel programming is to realize that there is no One Solution that works for all problems. There are a number of patterns that work well for certain classes of problems. When you get down to some of the stuff done in HPC. for example, you need parallel solvers, not course grained task farms and those are two different beasts.

    37. Re:Nope. by Anonymous Coward · · Score: 1, Interesting

      Check out programming models offered in Terracotta (www.terracottatech.com) and Hiperware (www.hiperware.com). Both showed up at JavaOne. They're offering Java based programming models that allow developers to do this. Terracotta's model transports Java messages across CPUs/ computers by transpatently making changes to bytecode. Hiperware provides a programming interface to programmers that allows object information to transparently flow across objects assigned on different CPUs/ computers.

    38. Re:Nope. by uzytkownik · · Score: 1

      The main problem with mulithreading is synchronisation. Ie. how to menage with two threads/applications which want to have access to the same resource.
      Parallel running could be done by cheap processes which are synchronised by system (pipes for example: cat file | grep ... | sed ... | awk ... | uniq | sort -n) which gives us possibility of not thinking of it.

      Also the compiler could optimise program to run parallely.

      IMHO the main problem is low level API of pp. We have to think of what resources do we use (and libraries which are used by our program).

      --
      I've probably left my head... somewhere. Please wait untill I find it.
      Homepage: http://blog.piechotka.com.pl/
    39. Re:Nope. by seaturnip · · Score: 1

      The moderators of your comment get a third!

    40. Re:Nope. by Nefarious+Wheel · · Score: 1

      Oooo you've got a VT100 do ye? I ha'e a Heathkit clone of a ADM 3A VT52 clone I built and loooved it!! Built it myself and it only took a little while to get used to typing with the keyboard on the top (fools built the CRT upside down). AND I had to use real solder too, none of this poncy ROHS compliant stuff.

      --
      Do not mock my vision of impractical footwear
    41. Re:Nope. by nuzak · · Score: 1

      > MPI_Wait(Until request struct matches data);

      That is synchronous message passing. Async would involve setting a callback and continuing.

      It's still possible to deadlock if your whole program's dataflow deadlocks, i.e. all your callbacks are circularly dependent and nothing else produces data, but async removes deadlock that happens for silly reasons like order of executing just a couple of ops.

      --
      Done with slashdot, done with nerds, getting a life.
    42. Re:Nope. by Nefarious+Wheel · · Score: 1
      It is not difficult to justify parallel programming.

      True, very true. As long as you have as many threads & processes as you do processors & a half-decent interrupt return on IO complete (listening, REI?) you'll use those cores. The techniques for ASMP, spinlocks etc. were all well refined 10 years ago. But if you're thinking of decomposing some very large data crunch (i.e. parallelising a large monolithic problem such as weather vectors) then yes, you do have to think a bit and use the specialised parallel languages such as Occam, Parallel Fortran and whatever else is out there by now.

      A long, long time ago I joked I wanted a Cray-I on a chip. That was a very, very long time ago, and it's amazing how far my vision fell short of the reality. Geez today's machines are hot.

      --
      Do not mock my vision of impractical footwear
    43. Re:Nope. by LurkerXXX · · Score: 1

      It is not difficult to justify parallel programming. Ten years ago, it was difficult to justify because most computers had a single processor.

      Most computers *STILL* have a single processor. If I recall right, AMD only began selling dual cores in 2005. That's only 2 years ago, and AMD and Intel have still sold a lot (mostly) of single core chips since then. It's only been the last several months that dual-cores are becoming more the norm in new machines.

      I've been building/using SMP machines for over a decade, but until the last couple of years most folks couldn't get one at a decent price. It's hardly surprising that since most folks up until that time didn't have ready access to multiple processors that they didn't bother thinking about or working on coding to take advantage of them. Expect a big change in that over the next several years as we get programmers going through school working on them the whole time, and for everyone else to gear up as well now that they will start to finally become commonplace.

    44. Re:Nope. by bcrowell · · Score: 2, Insightful

      It is still difficult to justify if you can more easily write more efficient single-threaded apps. What consumer-level apps out there really need more processing power than a single core of a modern CPU can provide?
      Agreed. I just replaced my old machine with a dual-core machine a few months ago, and I find that I basically always have one cpu idle. When things are slow, they're usually slow because they're waiting on I/O. At one point I thought I had a killer app, which was ripping MP3s from CDs. I would run cdparanoia from the command line to rip, and then when that was done, I would have 01.wav, 02.wav, 03.wav, etc. I wrote little one-liner scripts that would then run the MP3 encoder so that one cpu would be doing all the odd-numbered tracks, the other cpu all the evens. Worked great. But then I decided to automate the whole thing a little more, so I wrote a fancy perl script that would start three sub-processes, one for ripping and two for encoding the tracks as soon as they were done being written to disk. Well it turned out that a single cpu was almost always capable of keeping up with the speed of my cd drive, so I still ended up with one idle cpu after all. You might think, "Hey, you can use that other cpu to run your gui apps." Actually, the linux scheduler is good enough that as long as I run the MP3 encoder with "nice," it has zero impact on interactive jobs, even when they're sharing a cpu. Typing characters into a word-processor just isn't a very cpu-intensive application.

    45. Re:Nope. by smellotron · · Score: 4, Insightful

      But a lot of problems don't fit these models, and need a LOT of thought put into how to parallelize them. It's likely that some problems in P are not efficiently parallelizable.
      I would venture a guess that most problems would benefit from parallelizing basic data structure tasks:
      • anything (comparable) can be sorted using divide-and-conquer mergesort
      • scanning through an array-based collection (*not* a linked list) can be divided among processors—this is frequently done in hardware, e.g. for CPU cache hashtable lookups
      Further, there's a few other obvious ways to parallelize:
      • Split program into a chain of filters between producers and consumers, and give each filter its own thread/process. For example, create an event receiver thread, a "do-stuff" thread, and a display thread. At the very least, this will reduce UI response latency.
      • Split program processing into "1 event dispatcher + N worker threads", like Apache or Squid. This by itself would be a good way to reduce blocking in most applications. Why should the interface be locked up when expensive processing is happening in a program? Maybe while Photoshop/GIMP runs some filter on my image, I'd like to browse the help documents or scroll around the viewport.
      • Re-evaluate any processing as a dependency tree, and code it in something like Twisted, where every piece of code executes nonblocking snippets, and a reactor thread dispatches between them (this is basically like light-light-weight threads)

      The reason the problems don't fit these models is moreso that we're used to thinking about algorithms as an ordered list of steps, rather than a set of workers on an assembly line (operating as fast as the slowest individual worker).

    46. Re:Nope. by POWRSURG · · Score: 1
      The MPI_Wait statement does not prevent it from being asynchronous (in fact, I don't even think it'd even compile if a synchronous send/receive call was used here). The example that was given merely simulated a synchronous call by calling having MPI wait for the send to complete before continuing. A better example would have been:

      if(pid==x)
      {
      MPI_bISend(z[0]);
      MPI_bISend(z[n-1]);
      /* some computation that only needs z[1] through z[n-2] */
      MPI_Wait(Until request struct matches data);
      MPI_bIRecv(a); /* a = z[0] from pid = y */
      MPI_bIRecv(b); /* b = z[n-1] from pid = y */
      /* some computation that needs a and b */
      }

      if(pid==y)
      {
      MPI_bISend(z[0]);
      MPI_bISend(z[n-1]);
      /* some computation that only needs z[1] through z[n-2] */
      MPI_Wait(Until request struct matches data);
      MPI_bIRecv(a); /* a = z[0] from pid = x */
      MPI_bIRecv(b); /* b = z[n-1] from pid = x */
      /* some computation that needs a and b */
      }
      I think that people here are confusing parallel programming with concurrent programming. Parallel = multiple processors, concurrent = multiple processes. When apache forks a new child to handle requests that is an example of concurrent programming. When p2-pNumproc sends data from p1 in a hypercube in order to compute a standard deviation then that is an example of concurrent programming.
    47. Re:Nope. by cbreaker · · Score: 1

      Almost everyone is selling CPU-based licenses based on the number of sockets, not cores. If you have a single-socket, quad-core CPU, it will only cost you one license.

      The reason for this is because CPU's aren't getting all that much faster anymore. There's little steps here and there but they're small steps. The multi-core CPU's are an attempt to increase speed via parallelism, because it's relatively easy to multiply the number of CPU units in each package compared to getting a 10% speed increase with a single CPU. So rather then punish the consumer because they can't upgrade CPU's to double performance anymore, software vendors charge per-socket so you still can - with multi-core.

      --
      - It's not the Macs I hate. It's Digg users. -
    48. Re:Nope. by Anonymous Coward · · Score: 0

      "And software developers are already complaining because it's "too hard" to write parallel programs." - by lmpeters (892805) on Tuesday May 29, @12:49AM (#19305295)

      Some tasks don't lend themselves to parallel programming very well. Consider this:

      EXAMPLE #1 (fine-grained multithreading attempt & why NOT to try it):

      Result = Sum1 + Sum2
      EndResult = Result x 2

      (I.E.-> I can't get to "EndResult", without computing "Result", first. No point in putting the 1st calculation into it's own CreateThread routine, & then putting the 2nd calculation into another CreateThread routine, because EndResult has to wait on Result, first).

      Granted, that on my part, this is a pretty poor example of "Fine Grained Multithreading", but the point IS there, illustrated, when you are working on data that has dependencies on another set of data calculations (in a linear manner).

      EXAMPLE #2 (coarse multithreading attempt & why it works, and why to try it):

      You CAN attempt to do "Coarse Multithreading" though, working on processes that do NOT share data/results of data calculations (such as separating game networking onto its own thread, & then say game animation on another, sound processing on another thread... OR, allowing a user to recalculate a spreadsheet on 1 thread, while allowing for them doing data input on another worksheet in another thread)...

      These types of thread-use CAN help take advantage of SMP/Multi-Core/HyperThreaded arrangements to some degree as well, but the hardest part is my first example (finding tasks that definitely lend themselves to parallelism).

      Trick is, finding out, what lends itself in a process of any kind to this type of work (especially on the fine-grained multithreaded design work in the 1st example).

      APK

      P.S.=> This is speaking strictly from the use of multiple thread design though, NOT "explicitly SMP applications" design (programs that control threadwork & processor detection + scheduling of threads themselves)...

      Fact is, I have found the OS' of today handle this pretty well in their kernel/core scheduler components, saving me time in designing them myself, so I just use CreateThread type API calls instead & allow multiple thread designed apps to perform any parallelism, by letting the OS handle that much for me... apk

    49. Re:Nope. by smellotron · · Score: 1

      What consumer-level apps out there really need more processing power than a single core of a modern CPU can provide?
      Anything that spends more than 100ms processing a user's request (disclaimer: that number mostly pulled out of my ass). User interfaces more and more need to be separated out from back-end processing on consumer applications. I hear OS X's Finder still has UI problems with blocking because of thumbnail generation. Some obvious examples that come to mind:
      • Word-processors or other "office productivity" applications could do nonblocking saves (create a snapshot of the data, then save the snapshot in a different process/thread). Of course, this would also require alternative feedback mechanisms, since most users are (rightly) accustomed to waiting for these operations to complete.
      • Digital content-creation applications usually do some fairly heavy (and "embarassingly parallelizable") work. This includes audio, video, and image editing,as well as mesh or CAD modeling.
      • Media players require a certain amount of synchronization, but I'd really love it if my mp3 visualization ran in a different process that could be niced down to a lower priority. Splitting something like this into a different process/thread allows much better control over system resources.
      • Web browsers should be rendering all page content in separate threads or processes. Just yesterday, YouTube had my dad's firefox segfaulting. If the page rendering and plugin activation was in a separate process, I would have only lost the one tab, instead of the entire program. Again, process segregation allows better customization of processes (imagine configuring Firefox to restrict CPU usage per-tab or per-domain).
      • Email clients can (and do) download new messages without blocking the UI.

      That right there is a large majority of the use for computers. Every task I've outlined has wonderful benefits from a UI perspective for essentially becoming nonblocking, and you can see that some of them have already moved in that direction. UI latency is a huge issue in making a computer feel snappy, and every modern kernel scheduler is tuned to deal with GUIs, so why not harness real parallelism for that goal?

    50. Re:Nope. by jedidiah · · Score: 1

      Why exactly does iMovie require parallel programming?

      PC's have been doing parallel rendering for decades.

      --
      A Pirate and a Puritan look the same on a balance sheet.
    51. Re:Nope. by jedidiah · · Score: 1

      ...perhaps because as anyone comes up with a "killer app" for threading someone else comes along and points out how to do that without threads at all.

      Nevermind threading. Programmers need to just get to the point where they can adequately decompose the problems their working on.

      --
      A Pirate and a Puritan look the same on a balance sheet.
    52. Re:Nope. by RoboJ1M · · Score: 1

      I agree.

      I write industrial application for rugged WinCE devices and I have several threads. One for the GUI and several doing async background tasks like retrieving data over GPRS and compressing/uncompressing files.

      J1M.

    53. Re:Nope. by Penguin's+Advocate · · Score: 1

      "What consumer-level apps out there really need more processing power than a single core of a modern CPU can provide?"

      Are you serious? Until EVERYTHING happens instantly, computers aren't fast enough. For some people, that won't even be fast enough. My dear mother is a prime example. She was a sys admin in the early 80's when I was growing up, and I would always hear her complaining "this thing is so fucking slow." Later on she had a 486, a Pentium, a Pentium MMX, an Athlon, an Athlon XP, an Athlon64, and she now has a dual core Athlon64 X2 5600 with 4GB of ram. What hasn't changed in all that time? "This thing is so fucking slow." (Note, the computer does most things near-instantly). I don't think computers will ever have "enough" processing power. People will just continue to demand more forever and ever. Faster disk IO would help too.

      As for the topic at hand, parallel programming isn't that hard, stop wasting time complaining and just do it.

      --
      Frag 'em all...
    54. Re:Nope. by rbanffy · · Score: 1

      Writing programs in something that resembles XML should be considered cruel and unusual punishment. ;-)

      I like the Hasse diagram thing as a visualization tool. Yet, resisting the idea of defining dependencies in a graphical environment ie necessary as dependencies should have syntactic support and be expressed into the source code in the simplest way possible - maybe like:

      foo.someotherthing() provides thing1
      foo.myMethod(arg) depends thing1 provides thing2
      bar.myMethod2(otherArg) depends (thing1 || otherstuff) provides thing3

      which may be an utterly horrible solution as I dedicated only about 10 seconds of thought to this problem.

    55. Re:Nope. by XchristX · · Score: 1

      That is synchronous message passing. Async would involve setting a callback and continuing. Hold on there, the library call explicitly says "bufferred" ie not-synch, the MPI_Wait() is simply a blocking call to make sure that the data has been sent completely before continuing. It will be operationally different from synchronous mode because the implementation is different, at least that's what my prof said in class.

      but async removes deadlock that happens for silly reasons like order of executing just a couple of ops. Ah, but then how do you know that the data received is complete or reliable? If the data is being sent over the distributed network by Remote Direct Memory Access then we don't know if the transfer was complete before the instructions following the receive were posted in the local pipeline.
      --
      l'Homme n'est Rien l'Oeuvre Tout: Gustave Flaubert to George Sand
    56. Re:Nope. by Mattintosh · · Score: 1

      Split program processing into "1 event dispatcher + N worker threads", like Apache or Squid. This by itself would be a good way to reduce blocking in most applications. Why should the interface be locked up when expensive processing is happening in a program? Maybe while Photoshop/GIMP runs some filter on my image, I'd like to browse the help documents or scroll around the viewport.

      This is probably the simplest way to parallelize your code. I wrote a bulk emailer in Java once (for messages generated by the system I was building, not for spam!) and it was only sending about 2 emails a second because the SMTP server was running on an overburdened box. This "emailer" was also capable of building PDF's and sending them to a networked printer to be snail-mailed. So I built an "EmailThread" object and a "PrintThread" object (each implementing Thread) and had the main program instantiate thousands of these at a time. Each object was responsible for updating its status in the database (the DB server was alone on its box, so performance wasn't an issue), performing its "send" operation, and terminating. Probably 50 lines of code in total. The controller spawned an object, set some data in it, and called the threaded object's Run(). Thus the emailer could operate at the speed the SMTP server was capable of, yet not get tangled in itself (the controller was cronned to run every 5 minutes), and not destroy the message queue in the database.

      I had never used any sort of parallel programming tactics before, and this was easy enough even for me to understand without any help (nobody else that worked on that project had any clue about multithreading either, since you don't use it much in webapps).

    57. Re:Nope. by stonecypher · · Score: 1

      The language you're describing has been around for a long time, under various names. I recommend you look into either erlang or mozart-oz.

      --
      StoneCypher is Full of BS
    58. Re:Nope. by stonecypher · · Score: 1

      Asynchronous message passing does not fix deadlocks. Deadlocks are a design flaw, not a ramification of language design. A simple case is between three processes, A waiting on B, B waiting on C and C waiting on A. Any experienced message passing language programmer will tell you that the problems they heard got magically solved just got harder to make. In the case of asynchronous message passing, Erlang is about the only language I can think of that's been around long enough to have genuinely experienced programmers, but hey, one's good enough.

      --
      StoneCypher is Full of BS
    59. Re:Nope. by jamsessionjay · · Score: 1

      For people more interested in the difficulties of parallelizing certain problems, check out http://en.wikipedia.org/wiki/NC_(complexity)

    60. Re:Nope. by Anonymous Coward · · Score: 0

      What you need is 3-5 more CD readers, and to get them going concurrently, preferably with a little robotic arm to load them.

    61. Re: Nope. by stonecypher · · Score: 1

      It is definitely hard to justify parallel programming
      It's hard to justify any programming technique. This is tautological. The implication you're making - that it's harder to use parallel implementations for a given project than single-path (my god, if one more person calls that imperative...) seems fundamentally broken. The suggestion seems to be that you have to qualify fundamental aspects of your design to someone who is unable to grasp them. If that's the case, the problem isn't the difficulty of justification, but rather the person to whom you're forced to justify.

      The thing isn't necessarily that it is particularly hard to write multi-threaded applications -- the thing is that it is a lot harder to write a multi-threaded program than to write a single-threaded program.
      ... in some languages, at certain levels of experience, yes. However, as many other programmers in this story have pointed out, the threaded exchange of control is frequently far simpler than the non-threaded exchange of control. The vast bulk of problems about threading come from naive programmers attempting to make interdependant threads and then screwing up the connection logic. Believe it or not, some of us don't make that mistake. Threading doesn't have to be a minefield.

      Suddenly, you have to introduce locks in all shared data structures and ensure proper locking in all parts of the program.
      Only if you're naive enough to introduce data structures that are available to several threads.

      That kind of thing just adds a significant part to the complexity of a program, and it requires a lot more testing as well. Therefore, justification is definitely needed.
      With all due respect, I think you're confusing what the basis of that need is. The problem there isn't parallelism at all. The problem there is a novice's view of threading. I mean, the very first thing you said after discussing the impact of threading was to bring up the single most important thing you should not do.

      There are lots of people who found life becoming far easier once they embraced the principles of modularization, typically through object orientation. OO seems to be the de rigeur thing to teach these days. As such, a lot of people can lean back and say to themselves "oh yeah, I remember how much harder life was before I learned to divide tasks into discrete pieces."

      Are you open to the possibility that there are other such things you have yet to learn, particularly in the area of parallelism?
      --
      StoneCypher is Full of BS
    62. Re:Nope. by stonecypher · · Score: 1

      Green threads are too heavy, and their design precludes that ever being fixed. I retain my doubts that Java will survive the transition to massive parallelism. If you look into my crystal ball, you see a future dominated by erlang, concurrent c, fortress, twisted python, and mozart-oz.

      --
      StoneCypher is Full of BS
    63. Re:Nope. by datavirtue · · Score: 1

      Threaded doesn't mean Parallel. But Parallel programs contain threads. Parallel programs do not care where and when a thread is executed. so yes parallel is "hard" when you try to apply it to every problem domain. Some tasks or applications are not parallel candidastes at all. Database server, yes, client front end, no. The server begs for parallel performance the client simply doesn't.

      The key is to create simple parallel ready threads that can exist in extremely complex situations. Many times though they will be specific to certain contexts. This requires design from the ground up, trying to change a non-parallel program into one is called re-write.

      If an application needs parallel processing then it WILL NEED IT. With servers the problems are almost obviously in need of a parallel system. Some do not realize that the "gate keeper" (Memory Controller, SRI?) is jumbling their code amongst processors in no guaranteed order, so a threaded app that runs great on a single processor can fail (eventually) on multi-core systems. nice Huh? Over the years we've seen the required level of expertise continue to rise as computing became more prevelant; for instance, years ago you had many hobby computing enthusiasts programming business applications in BASIC, this level of knowledge is inadequate for small businesses today. The coming years will see a need for extremely focused talented people to maintain our computing systems. As in scientific research the cadidates will be few and far between.

      Sean

      --
      I object to power without constructive purpose. --Spock
    64. Re:Nope. by Anonymous Coward · · Score: 0

      That is in a market that has already learned to accept licensing fees based on the number of processors.
      It will take a while before desktop users accept the same pricing scheme.

    65. Re:Nope. by EricTheRed · · Score: 2, Insightful

      That is true. Over the last six months I've been doing interviews for a single developer position, and the one common question I've asked as about java.util.concurrent. In some 20 interviewees, only one had a vague idea what it was.

      Here we use it quite extensively because it's the best way to handle parallel code and shared data structures.

      It's probably the most useful things in Java 5 & 6, and the least used.

      --
      Java gaming nut - http://www.retep.org/ or for the rail http://uktra.in/
    66. Re: Nope. by Dolda2000 · · Score: 1

      Only if you're naive enough to introduce data structures that are available to several threads.
      If you don't share data between threads, why would you want threads to begin with? If you have nothing to gain from sharing the same memory, why wouldn't you just fork instead?
    67. Re:Nope. by vhogemann · · Score: 1

      What's hard, is trying to write multi-threaded java applications that work on my VT-100 terminal. :-)

      http://www.pitman.co.za/projects/charva/
      --
      ---- You know how some doctors have the Messiah complex - they need to save the world? You've got the "Rubik's" complex
    68. Re:Nope. by poopdeville · · Score: 3, Informative

      Well, Lisp doesn't look like XML. But its s-expressions are able to deal with tree like structures just as easily. If you have some free time, I suggest reading http://www.defmacro.org/ramblings/lisp.html.

      --
      After all, I am strangely colored.
    69. Re:Nope. by tepples · · Score: 1

      That is in a market that has already learned to accept licensing fees based on the number of processors. Console game publishers are likely to price the Wii version of a game at $50 and the Xbox 360 version of the same game at $60. You are paying more for a version that runs on a 3-core PowerPC with ATI graphics rather than a 1-core PowerPC with ATI graphics. Same with PC vs. PS3 versions of a game: Core 2 vs. Cell, $40 vs. $60.
    70. Re:Nope. by KarmaMB84 · · Score: 1

      There's already POSIX Threads and Win32 Threads. You can even use a subset of pthreads on Win32. IIRC the next revision of the C++ standard will have threading constructs built-in.

    71. Re:Nope. by rbanffy · · Score: 1

      I like Lisp and find it an invaluable educational tool (you see what would be a parse tree for a C programmer), but I don't feel comfortable with s-expressions.

      I am also not sure how a call-modifier like the ones I suggested would be implemented in Lisp.

      But I admit my programmer learning path was disrupted very early. After being exposed to Smalltalk-ish languages (first Smalltalk/V, then Actor), it took me several years (and lots of complaining) to even touch C++.

    72. Re: Nope. by stonecypher · · Score: 1

      You're the one suggesting threads, not me, not the article. Confusing threading with parallelism is problematic. You'll notice for example that the language I'm suggesting the use of - Erlang - doesn't use threads. They're distinct processes, and *don't* have access to each other's memory.

      As far as why not to use fork, well, it's just too heavy. Fork becomes problematic around a few dozen invokations. Parallel programming, depending on approach, may lead into the millions of concurrent active processes, in languages which aren't dependant on OS implementations (erlang isn't alone in this, either: mozart-oz, twisted python, some ML dialects, and suddenly Java wrt: green threads are starting to catch on to the extremely lightweight process model.)

      --
      StoneCypher is Full of BS
    73. Re:Nope. by Doctor+Faustus · · Score: 1

      And yes, there are compiled functional languages with parallelizing compilers. (Erlang and OCaml come to mind)
      If we're all about to have extra cores to throw around, I don't know that compiled vs. interpreted will matter much, anymore.

    74. Re:Nope. by jgrahn · · Score: 1

      It is not difficult to justify parallel programming. Ten years ago, it was difficult to justify because most computers had a single processor. Today, dual-core systems are increasingly common, and 8-core PC's are not unheard of. And software developers are already complaining because it's "too hard" to write parallel programs.

      A common argument, but it doesn't make sense to me. To justify it, you must identify a need. What you mentioned (SMP machines in widespread use) is just something that makes it possible. It doesn't justify anything.

      It's almost as if people think there is a moral need for every program to use up all processing power in any machine. There isn't. (Fortunately, because we'd need very fast disks and networking for that vast majority of programs which are I/O bound).

    75. Re:Nope. by Anonymous Coward · · Score: 0

      I *highly* recommend Chris Okasaki's book 'Purely functional data-structures'. Great book, even if you're not a lambda-lover.

    76. Re:Nope. by EdelFactor19 · · Score: 1

      RTFA and READ parallel programming

      Not only does your post seem to be incorrect, I think you missed a large point of the purpose and whole concept of parallel programming, and a parallel processing in general. If there are lots and lots of large applications running that aren't parallelized or parallelizable, eventually you are going to run into a load problem when you start trying to run some other apps that are parallelized. Sure app X doesn't need more than 2 ghz for itself, but if it runs and takes up about 1.5 ghz, that doesn't leave anything for your parallel app to use so that it can take advantage of parallel processing.

      my analogy would be to the problem of confidentiality / anonymity. If no one other than yourself is anonymous, you won't be very anonymous for long.

      There are motivations other than for pure computing power for parallelism. For starters power consumption can be greatly enhanced. the footprint and heat produced by a 4 400 MHZ SMP is less than 70% of that produced by a 1.6GHZ single processor counterpart.

      Secondly most applications you use are NOT single threaded. Does it have a GUI? yeah not single threaded. Your web browser is multi threaded. any music player you have? multi threaded. Unless by consumer apps you refer to unix /linux scripts I can't even think of a single app for windows that I use that isn't multi threaded. I'm not really sure how anyone found your post informative, when I find it be more inaccurate then anything else.

      I think that you are also significantly mixing up your terms as. Multithreading does not require multiple cores or multiple processors. They have nothing to do with one another. The only relation is that multithreaded apps easily lend themselves to being parallelized across a cluster, an SMP system or across different cores rather easily.

      The purpose of proper architectural design in regards to this is also so that your application is scalable, and can be utilized by the more and more parallel systems out there.

      As a related note its not the singular app that is a problem these days. It is the multi tasking problem, and the time wasted on locks and context switches that can plague the system. When you run itunes, a windows office component, firefox, etc etc you notice that your processor usage starts to get higher and higher, especially if you are trying to do file manipulation as well. Instead of having all your apps hanging around waiting for one of them to finish using processor time, you have another processor available to work with. Even if the combined speed (in Mhz) is lower than the original processor you are going to get better performance for your I/O heavy applications with two cores or two processors.

      Sure maybe it isn't absolutely neccessary, but neither is windows Vista, XP, mac OS X, extra memory, a faster processor, a bmw, etc.
      But with the parallel architectures sweeping through to consumers you probably want to take your target audiences architecture into consideration.

      --
      "Jazz isn't dead, it just smells funny" ~Frank Zappa
      EdelFactor
    77. Re:Nope. by EdelFactor19 · · Score: 1

      just a quick aside, there is lots more to parallel computing than multi cores.
      There are systems significantly larger already in dev and for sale. A ton of companies have been blowing that number out of the water for decades. Multi core is just the current hotspot for consumer targets. go to top500.org, lots of sites with 1000+ (usually multiple thousands or higher). granted these arent exactly consumer oriented but who says that everything parallel is and needs to be.

      --
      "Jazz isn't dead, it just smells funny" ~Frank Zappa
      EdelFactor
    78. Re:Nope. by pivo · · Score: 2, Interesting

      How much time have you spent writing Lisp? I ask because I was initially uncomfortable with s-expressions (as are many people) but after a certain amount of time something in my brain flipped, and now I'm much *more* comfortable with them. Part of it had to do with the fact that I'm drawn to writing code in the functional style (imperative code in Lisp *is* uncomfortable) and part was just getting my brain to see the structure in the parens.

    79. Re:Nope. by KDR_11k · · Score: 1

      However, PC vs. Wii is still 40€ for the game that runs on a Core2Duo while it's 60€ for the Wii game. Or 40€ for a game for the DS (which I think has two processors) compared to the 60€ for the Wii.

      --
      Justice is the sheep getting arrested while an impartial judge declares the vote void.
    80. Re:Nope. by Anonymous Coward · · Score: 0

      "If we're all about to have extra cores to throw around, I don't know that compiled vs. interpreted will matter much, anymore."

      HINT: Cache sizes.

    81. Re:Nope. by Anonymous Coward · · Score: 0, Flamebait

      Functional programming is no harder than procedural/OO programming.

      That's difficult to say because true functional programming is so vastly different.

      Bollocks.

      Functional programming is way easier than procedural programming, it is just less hyped.

      But the tide is changing. Functional programs are trivially multithreaded and now there is a market need. In 10 years Java programmers will go the way of the COBOL programmers.
    82. Re: Nope. by Anonymous Coward · · Score: 0

      EJB has the best threading model: No explicit threads, no static variables, no locks, every EJB is an implicit thread.

      The result is a lighting fast implementation (using local EJBs) and no race conditions, no deadlocks, no starvation, no convoy formations (contention), etc.

      Ignoring the cumbersome EJB lookup mechanism (Spring already solved this), Stateless Session Beans are a great development model for both painless multithreading and painless distributed software.

    83. Re:Nope. by Anonymous Coward · · Score: 0

      when I was growing up, and I would always hear her complaining "this thing is so fucking slow." A lovely lady, your mother, to be sure.

      What hasn't changed in all that time? "This thing is so fucking slow." Yes, your mother's grace and social skills are unabated, but I'm sure we'd also find her software continues to be Microsoft software.
    84. Re:Nope. by Raenex · · Score: 1

      If you look into my crystal ball, you see a future dominated by erlang, concurrent c, fortress, twisted python, and mozart-oz. +1 Funny
    85. Re:Nope. by rbanffy · · Score: 1

      Not much, actually, What I really need is a good excuse to abandon my comfort-zones (Zope/Python/Plone, Java/JSP/JSF) for some time and do something "for real" in Lisp.

      Since I collect interesting computers, even a Lisp Machine emulator that could fit my 800x1440 screen would be great to spend a couple days playing with ;-)

      And I am still looking forward toward someone implementing one as an FPGA.

    86. Re:Nope. by tc9 · · Score: 1

      As long as there are the current almost religious wars between advocates of REST instead of message based WS that allow for long running business processes, then the chief problems will remain cultural. So many programmers think straight line, develop straight line, model straight line, that parallelism (which to my mind includes multi-coore, grid computing, and widely distributed virtual systems) seems a long way away.

    87. Re:Nope. by Anonymous Coward · · Score: 0

      And yes, there are compiled functional languages with parallelizing compilers. (Erlang and OCaml come to mind)
      Um, Erlang is VM-based (it is technically compiled, but not to machine code, which is what most people assume "compiled" means). And the only sophisticated thing about the OCaml compiler is the type system - it does not even optimize code, let alone parallelize it.
    88. Re:Nope. by mi · · Score: 1

      foo.someotherthing() provides thing1
      foo.myMethod(arg) depends thing1 provides thing2
      bar.myMethod2(otherArg) depends (thing1 || otherstuff) provides thing3

      Is it just me, or does the above look like Prolog?..

      It taketh me back...

      --
      In Soviet Washington the swamp drains you.
  2. our brains aren't wired to think in parallel by rritterson · · Score: 5, Insightful

    I can't speak for the rest of the world, or even the programming community. That disclaimer spoken, however, I can say that parallel programming is indeed hard. The trivial examples, like simply running many processes in parallel that are doing the same thing (as in, for example, Monte Carlo sampling) are easy, but the more difficult examples of parallelized mathematical algorithms I've seen, such as those in linear algebra are difficult to conceptualize, let alone program. Trying to manage multiple threads and process communication in an efficient way when actually implementing it adds an additional level of complexity.

    I think the biggest reason why it is difficult is that people tend to process information in a linear fashion. I break large projects into a series of chronologically ordered steps and complete one at a time. Sometimes if I am working on multiple projects, I will multitask and do them in parallel, but that is really an example of trivial parallelization.

    Ironically, the best parallel programmers may be those good managers, who have to break exceptionally large projects into parallel units for their employees to simultaneously complete. Unfortunately, trying to explain any sort of technical algorithm to my managers usually exacts a look of panic and confusion.

    --
    -Ryan
    AUWYHSTOT (Acronyms are Useless When You Have to Spell Them Out Too)
    1. Re:our brains aren't wired to think in parallel by Anonymous Coward · · Score: 0

      our brains aren't wired to think in parallel

      Very ironic, since they are so good at it.

      I would also wonder if most programmers are just too left-brained, since non-linear big-picture stuff is more the domain of the right brain (at least in common knowledge...feel free to correct me with updated technical information).

    2. Re:our brains aren't wired to think in parallel by Anonymous Coward · · Score: 5, Informative

      I do a lot of multithreaded programming, this is my bread and butter really. It is not easy - it takes a specific mindset, though I would disagree that it has much to do with management. I am not a manager, never was one and never will be. It requires discipline and careful planning.

      That said, parallel processing is hardly a holy grail. On one hand, everything is parallel processing (you are reading this message in parallel with others, aren't you?). On the other, when we are talking about a single computer running a specific program, parallel usually means "serialized but switched really fast". At most there is a handful of processing units. That means, that whatever it is you are splitting among these units has to give itself well to splitting this number of ways. Do more - and you are overloading one of them, do less - and you are underutilizing resources. In the end, it would be easier often to do processing serially. Potential performance advantage is not always very high (I know, I get paid to squeeze this last bit), and is usually more than offset by difficulty in maintenance.

    3. Re:our brains aren't wired to think in parallel by catchblue22 · · Score: 1

      I wonder if one day there will be higher level tools to help programmers accomplish this. Programmers seldom work in assembler code, because such low level tasks are taken care of by the compiler. Why can we not have similar tools for optimizing parallel programming? It seems to me that this kind of complexity is best handled by a computer.

      --
      This and no other is the root from which a tyrant springs; when first he appears as a protector - Plato (423 to 327 BC)
    4. Re:our brains aren't wired to think in parallel by Organic+Brain+Damage · · Score: 2, Interesting

      People may or may not process information in a linear fashion, but human brains are, apparently, massively parallel computational devices.

      Addressing architecture for Brain-like Massively Parallel Computers

      or from a brain-science perspective

      Natural and Artificial Parallel Computation

      The common tools (Java, C#, C++, Visual Basic) are still primitive for parallel programming. Not much more than semaphores and some basic multi-threading code (start/stop/pause/communicate from one thread to another via common variables). I've made programs, specifically, spiders, that can run 200-1,000 simultaneous threads usefully on a PC. They work ok, as long as the inter-thread coupling is minimized. Until we get enough exposure to parallel systems that we develop new languages to express the solutions, parallel programming will remain accessible to the few, the proud, the geeks. But I don't think it's because of our brains architecture.

    5. Re:our brains aren't wired to think in parallel by ubernostrum · · Score: 4, Insightful

      You may want to look into Erlang, which does two things that will interest you:

      • Concurrency is handled by lightweight thread-like pseudo-processes passing messages to one another, and supported directly in the language.
      • Shared state between these processes is absolutely forbidden.

      There are still concurrent problems which are hard, but generally it boils down to the problem being hard instead of the language making the problem harder to express.

    6. Re:our brains aren't wired to think in parallel by bladesjester · · Score: 2, Insightful

      you are reading this message in parallel with others, aren't you?

      I don't know about the rest of Slashdot, but I read comments in a linear fashion - one comment, then the next comment, etc. Most people that I have known read in a linear fashion.

      Walking and chewing gum is a parallel process. Reading is generally linear.

      --
      Everything I need to know I learned by killing smart people and eating their brains.
    7. Re:our brains aren't wired to think in parallel by Anonymous Coward · · Score: 2, Interesting

      In my exp it's not really that hard and it really doesn't come down to thinking in parallel except in cases where you are going for really fine-grained parallelism. Coarse grained parallelism is really easy and can give HUGE benefits to users... a simple example of this is creating a background thread to handle incremental saves... suddenly the app stays responsive as it's GUI thread is no longer being stalled by factors beyond it's control (ie: network load).

      Under C++ I use the boost threading libraries and they are excellent, allowing me to write once and run on all required platforms and when my Java hat is on it's a snap too because of the superb libraries available.... moral, it is hard if you don't use the right tools or try to split the task along poorly chosen boundaries.

      Granted that tasks like large matrix solves and the like are a brute to multi-thread... but fortunately people that are way smarter than me have already done it and I can handle plugging in a library.

    8. Re:our brains aren't wired to think in parallel by bloosqr · · Score: 3, Interesting

      Back when i was in graduate school we used to joke .. in the future everything will be monte carlo :)

      While everything perhaps can't be solved using monte carlo type integration tricks .. there is more that can be done w/ 'variations of the theme' than is perhaps obvious .. (or perhaps you can rephrase the problem and ask the same question a different way) .. perhaps if you are dreaming like .. what happens if i have a 100,000 processors at my disposal etc

    9. Re:our brains aren't wired to think in parallel by Anonymous Coward · · Score: 0

      Unfortunately, trying to explain any sort of technical algorithm to my managers usually exacts a look of panic and confusion.

      Perhaps you are not as good at explaining technical issues to non-technical people as you think you are? You need to step back, think in the person's shoes, and try to see it through their eyes. Because they haven't spent days thinking of the problem like you have, and you are trying to cram a lot of information into a few minutes. Duh! Of course it will sound foreign.

    10. Re:our brains aren't wired to think in parallel by buswolley · · Score: 4, Insightful

      Our brains are massively parallel, but we do not consciously attend to more than a couple of things at a time.

      --

      A Good Troll is better than a Bad Human.

    11. Re:our brains aren't wired to think in parallel by jd · · Score: 5, Insightful
      Parallel programming is indeed hard. The standard approach these days is to decompose the parallel problem into a definite set of serial problems. The serial problems (applets) can then be coded more-or-less as normal, usually using message-passing rather than direct calls to communicate with other applets. Making sure that everything is scheduled correctly does indeed take managerial skills. The same techniques used to schedule projects (critical path analysis) can be used to minimize time overheads. The same techniques used to minimize the use of physical resources (SIMPLEX aka Operational Research) works just as well on software for physical resources there.

      The first problem is that people who make good managers make lousy coders. The second problem is that people who make good coders make lousy managers. The third problem is that plenty of upper management types (unfortunately, I regard the names I could mention as genuinely dangerous and unpredictable) simply have no understanding of programming in general, never mind the intricacies of parallelism.

      However, resource management and coding is not enough. These sorts of problems are typically either CPU-bound and not heavy on the networks, or light on the CPU but are network-killers. (Look at any HPC paper on cascading network errors for an example.) Typically, you get hardware which isn't ideally suited to either extreme, so the problem must be transformed into one that is functionally identical but within the limits of what equipment there is. (There is no such thing as a generic parallel app for a generic parallel architecture. There are headaches and there are high-velocity exploding neurons, but that's the range of choices.)

      --
      It's a small world and it smells funny; I'd buy another if it wasn't for the money; Take back what I paid (SoM)
    12. Re:our brains aren't wired to think in parallel by buswolley · · Score: 2, Insightful

      Our brains may be massively parallel, but this doesn't not mean we can effectively attend to multiple problem domains at once. Especially, our conscious attentional processes tend to be able to focus on at most a couple of things at once, albeit at a high level of organizational description.

      --

      A Good Troll is better than a Bad Human.

    13. Re:our brains aren't wired to think in parallel by Anonymous Coward · · Score: 0

      If it involves message passing, it isn't lightweight. 'Nuff said.

    14. Re:our brains aren't wired to think in parallel by Anonymous Coward · · Score: 0

      This is an average RTL designer's task, every single day. All parallel tasks are still broken down into linearly executed tasks that are recombined at some point. I think the biggest hurdle is the attempt of modern languages to abstract far too much and this prevents the designer from creating an effective design. I also don't think a language-only approch is enough. The hardware itself needs to support a means of inter-process handshaking as that's exactly how we do it when we design custom parallel hardware.

    15. Re:our brains aren't wired to think in parallel by Eivind · · Score: 1
      True. Infact it is very hard to do even stuff in parallell that is *far* away from our abilities.

      Moving your left foot in a circle is trivial to do. Drawing a square on a piece of paper is trivial to do (aslong as neither needs to be perfect), now try doing both simultaneously.

    16. Re:our brains aren't wired to think in parallel by poopdeville · · Score: 5, Insightful

      That's debatable. You don't look at text one letter at a time to try to decipher the meaning, do you? You probably look at several letters, or even words, at a time. Understanding how the letters or words relate (spatially, syntactically, semantically) is a parallel process. Unless you're a very slow reader, your eyes have probably moved on from the words you're interpreting before you've understood their meaning. This is normal. This is how you establish a context for a particular word or phrase -- by looking at the surrounding words. Another parallel process.

      Every process is serial from a broad enough perspective. Eight hypothetical modems can send 8 bits per second. Or are they actually sending a single byte?

      --
      After all, I am strangely colored.
    17. Re:our brains aren't wired to think in parallel by bladesjester · · Score: 2, Insightful

      If you want to make that argument, you might as well make the argument that a computer doing the simple addition of two numbers is doing parallel processing.

      It could also be stated in a twisted manner of your view - looked at narrowly enough, anything can be considered to be parallel. However, realistically, we know that isn't really the case.

      --
      Everything I need to know I learned by killing smart people and eating their brains.
    18. Re:our brains aren't wired to think in parallel by Anonymous Coward · · Score: 5, Funny

      Our brains are massively parallel, but we do not consciously attend to more than a couple of things at a time.
      Speak for yourself, I forget to breathe whenever I'm doing someth...
    19. Re:our brains aren't wired to think in parallel by daVinci1980 · · Score: 1

      You've got to be kidding, or else you really are hard-wired to think in serial.

      He meant that you and other readers are reading these messages at the same time, hence you and the other readers are using a parallel system.

      --
      I currently have no clever signature witicism to add here.
    20. Re:our brains aren't wired to think in parallel by mpe · · Score: 1

      Infact it is very hard to do even stuff in parallell that is *far* away from our abilities.
      Moving your left foot in a circle is trivial to do. Drawing a square on a piece of paper is trivial to do (aslong as neither needs to be perfect), now try doing both simultaneously.


      On the other hand most people can walk and eat at the same time or make hand gestures whilst talking. Since these are examples of parallelism which were useful in helping our ancestors survive. Being able to draw different geometic shapes with different limbs at the same time, however, is of little practical use. If it were then people would learn to do it, in the same way that people can learn to drive cars or fly helicopters.

    21. Re:our brains aren't wired to think in parallel by poopdeville · · Score: 1

      If you want to make that argument, you might as well make the argument that a computer doing the simple addition of two numbers is doing parallel processing.

      Indeed it is, especially with modern processors. You don't even have to get down to the transistor level to find parallelism in a processor. Especially if you consider adding things like vectors. Are the summands single vectors, or are they collections of numbers?

      It could also be stated in a twisted manner of your view - looked at narrowly enough, anything can be considered to be parallel. However, realistically, we know that isn't really the case.

      Your sense of realism is lacking in reality.

      (Do you need to write "realistically ... isn't really the case"? Sounds redundant to me.)

      --
      After all, I am strangely colored.
    22. Re:our brains aren't wired to think in parallel by JAlexoi · · Score: 1

      >> Our brains are massively parallel, but we do not consciously attend to more than a couple of things at a time. I can eat, talk and think at the same time, all are pretty conscious actions. And BTW, most of our brains parallelism is wasted on sensing, try to see if you pinch yourself in two different places, will you only feel one of them?

    23. Re:our brains aren't wired to think in parallel by mpe · · Score: 1

      Our brains are massively parallel, but we do not consciously attend to more than a couple of things at a time.

      That's probably because the massively parallel functionality actually evolved to control a complex body.

    24. Re:our brains aren't wired to think in parallel by buswolley · · Score: 1

      The body can't run two different directions. One course of action must be made in times of danger. Ok here it is: Massively parallel to solve the hard problems efficiently, and at a higher level of description, a unified picture is created as a synthesis of all the result of the parallel processes.

      --

      A Good Troll is better than a Bad Human.

    25. Re:our brains aren't wired to think in parallel by crayz · · Score: 1

      Great, so 2 + 2 being "parallel" helps us write code for an 8-core system how?

    26. Re:our brains aren't wired to think in parallel by buswolley · · Score: 1

      You might consciously decide where you are walking to, but are you consciously moving each leg? Of course are brains do multiple things at once, but that is not the argument.

      --

      A Good Troll is better than a Bad Human.

    27. Re:our brains aren't wired to think in parallel by prockcore · · Score: 1

      He meant that you and other readers are reading these messages at the same time, hence you and the other readers are using a parallel system.


      Well then, what's the problem? My browser and other browsers are downloading this exact same page.. look it's parallel programming and no one had to do anything special.
    28. Re:our brains aren't wired to think in parallel by Surt · · Score: 1

      The body can't run in two directions, but it can throw two punches and two kicks at up to four different opponents at once, and if you know how to do this, times of danger turn out to be few and far between.

      --
      "Who is the Journal of Quantum Physics going to believe?" --Stephen Hawking
    29. Re:our brains aren't wired to think in parallel by martin-boundary · · Score: 1

      Mathematical parallelization is not as hard as you think, if you take the frame bundle point of view, but make sure your manifold is Hausdorff to start with. Just define an affine connection (I like to use the natural one induced by a Whitney imbedding in Euclidean space, but YMMV). Then pick your favourite 1-form basis and compute the Cartan matrix coefficients by exterior differentiation, and you can deduce the components of the Christoffel symbols. Then you're halfway there: Just pick a curve that looks like it knows where it's going, and transport your favourite tensor field (this will be application specific) by setting the covariant derivative to zero along the tangent vector field of the curve. Voila: instant parallelization for any application! I wouldn't program this in VB though, as Microsoft COM is the wrong category of objects...

    30. Re:our brains aren't wired to think in parallel by poopdeville · · Score: 1

      8 cores can be programmed using the same techniques Intel/AMD use to implement the x86 instruction set in their current cores. (The microcode is far more parallel than 8 concurrent threads, with respect to their relative levels of abstraction). You do realize microcode is programmed into these processors, right? The methods are already there, and have been for decades.

      Intelligent synchronization. Orthogonal instructions. Avoiding (or atleast encapsulating) state unless necessary. Very simple stuff.

      --
      After all, I am strangely colored.
    31. Re:our brains aren't wired to think in parallel by mwvdlee · · Score: 2, Informative

      You can eat and talk at the same time?
      Didn't your mother ever teach you not to?

      On a serious note; how conscious are you when you talk? Do you consciously trigger all required muscle movement or does you brain queue a "say 'word'" command which is then processed unconsciously? Probably neither, but the latter is likely closer to reality. There is actually VERY little that we do consciously.

      --
      Slashdot social media options: AIM, ICQ, Yahoo, Jabber and Mobile Text. Why no MySpace?
    32. Re:our brains aren't wired to think in parallel by jlarocco · · Score: 1

      I've made programs, specifically, spiders, that can run 200-1,000 simultaneous threads usefully on a PC. They work ok, as long as the inter-thread coupling is minimized.

      That's exactly what makes parrallel programming so hard. It's not easy to split most tasks into independent sub-sections with minimal coupling.

      Writing a massively parrallel web spider is conceptually very easy. You can fetch 1000 web pages in parrallel and process them at the same time because each thread has its own set of data. But most intensive calculations aren't cases of doing the same thing with different data a whole bunch of times. For example, inverting a large matrix, parsing a large input file, or laying out a large document. I'm sure there are parrallel algorithms for them, but they're far less obvious than web spidering.

    33. Re:our brains aren't wired to think in parallel by eldaria · · Score: 1, Insightful

      On a serious note; how conscious are you when you talk? Do you consciously trigger all required muscle movement or does you brain queue a "say 'word'" command which is then processed unconsciously? Probably neither, but the latter is likely closer to reality. There is actually VERY little that we do consciously. So we have a couple of options, we evolve into a state where our brain can consciously process every single action in a parallel fascion. This will probably take some generations but if we train hard on it, we might succeed. Then we use this new ability when programming. Or, we continue applying the way our brain works today think today, and build a compiler/programming language that can take our current way of thinking and apply all the stuff behind automaticaly, we think we want to say "hello", our Brain process this, and turns it into various face muscels, lung contractions, Vocal band stretching, etc... Or Women will be the majority of future programmers, everyone knows that Women are better at multitasking than Men, it's an evolutionary thing(Kids screameing / Food cooking / Dorbell ringning / Talking on the Telephone, and all at once). :-)
    34. Re:our brains aren't wired to think in parallel by EvanED · · Score: 5, Interesting

      I can eat, talk and think at the same time, all are pretty conscious actions

      True, but can you talk (perhaps reciting something from memory) at the same time you are listening to something? Even if it's not a volume issue; you're wearing headphones say.

      Feynman has a chapter in "What do you care what other people think" where he talks about some informal experimentation he did where he tried to figure out what he could do at the same time as accurately timing out a minute. Essentially, the same time as counting. He found that (1) he could be very consistent about timing out a given time, and that (2) he could do most things while counting. But what he couldn't do is talk. On discussion with other people in his dorm/frat/house/whatever, there was another person who could talk, but couldn't read while timing things out. Turns out that the reason it differed was because they counted differently; Feynman was hearing "one, two, three, ..." while this other guy was watching the numbers pass in front of his eyes.

      Activities are localized in the brain; it seems that these areas are largely independent, but try two tasks that use the same area and you're SOL.

    35. Re:our brains aren't wired to think in parallel by Petersson · · Score: 1

      Well, the human brain can process thinks in parallel: the primary task (reading slashdot) plus secondary tasks (thinking about sex and having taste for beer).

      --
      I'm not insane. My mother had me tested.
    36. Re:our brains aren't wired to think in parallel by EvanED · · Score: 1

      I've made programs, specifically, spiders, that can run 200-1,000 simultaneous threads usefully on a PC. They work ok, as long as the inter-thread coupling is minimized

      That's data parallelism. That's easy. I posted in another comment about how in 11th grade I had a (not well working) data parallel fractal generator (n threads, each rendering 1/n of the view) within six months of my first Win32 program, a couple months after learning about threads, and after a mostly-rewrite of the program. (The first version wasn't really parallelized; the worker thread ran separate from the GUI thread, but there was only one worker. That's not why I rewrote it.)

      But there are a lot of programs that would be nice to parallelize, but aren't trivially parallel problems. For instance, my research involves static analysis of programs. The algorithms used in program analysis are very possibly not parallelizable. Formally, they probably don't belong to the NC complexity class, which is probably a proper subset of P.

    37. Re:our brains aren't wired to think in parallel by Lars512 · · Score: 2, Funny

      I think the biggest reason why it is difficult is that people tend to process information in a linear fashion. I break large projects into a series of chronologically ordered steps and complete one at a time. Sometimes if I am working on multiple projects, I will multitask and do them in parallel, but that is really an example of trivial parallelization.

      That's because you have a global interpreter lock.

    38. Re:our brains aren't wired to think in parallel by Bastard+of+Subhumani · · Score: 1

      but it can throw two punches and two kicks at up to four different opponents at once
      Wouldn't you fall over if you did that?
      --
      Only three things are certain; death, taxes, and apocryphal quotations - Ben Franklin.
    39. Re:our brains aren't wired to think in parallel by smallfries · · Score: 1

      It's odd, from the insightful mod and the people answering you, it would appear that you refuted his comment. But he said that we read comments sequentially. Are you saying that you skim from some letters in the words in this comment onto another comment and then back? Even if the actual reading is a parallel process, it is sequentialised when we turn the squiggles into concepts. Much like your later argument about addition, sure it's parallel at the bit-level but it is still sequential when you try and combine those word-level operations together.

      --
      Slashdot: where don knuth is an idiot because he cant grasp the awesome power of php
    40. Re:our brains aren't wired to think in parallel by smallfries · · Score: 1

      Cough... Occam.

      --
      Slashdot: where don knuth is an idiot because he cant grasp the awesome power of php
    41. Re:our brains aren't wired to think in parallel by Anonymous Coward · · Score: 0

      You basically posted the classic "think about your breathing" troll and got modded +5 for it. Nice.

    42. Re:our brains aren't wired to think in parallel by Jartan · · Score: 1

      Lots of comments about how our current languages are too "primitive" for parallel programming but I don't buy that. The whole reason people still like to use C in the first place is specifically because it's primitive.

      What's really missing are better libraries and compilers. Those of you hoping parallel programming will bring some sort of second coming for functional languages should keep dreaming probably. If the people that like C can't use C they'll probably use assembler before they use one of those "dirty" functional languages that aren't close to the metal.

    43. Re:our brains aren't wired to think in parallel by Eivind · · Score: 2, Interesting

      Sure. Short-term we could learn to do a lot of simple tasks better in parallell. Drawing the circle and square at the same time is hard, but it gets a lot easier even with just a few hours of practice.

      Longer term, we'd *evolve* better handling of parallellism if it gave us significant survival-benefits (well, really reproductive-benefits, but you get the idea)

      When we *do* manage many things at a time it is mostly by practicing them to the point where as much as possible about them become automatic, "muscle memory" (which isn't really, but atleast it's subconscious)

      A trained driver can;

      • Change gears (manual)
      • Operate blinkers
      • Turn wheel
      • Adjust speed (gas or brake)
      • Check mirrors
      • Judge intentions, speed, curve of other trafficants
      • Observe yield-signs
      More or less all simultaneously. But that is only possible because so much of it is automatic.

      The newbie-driver thinks "I'm in second, third is *there*, revs are high, better shift, clutch in, gas out, shift, touch of gas, declutch", he may even be able to do it smoothly without the car jumping after a few tries. But he *won't* be able to have his full attention elsewhere while doing it.

      The trained driver thinks at most "shift", oftentimes not even that. He is rarely consciously even aware of what gear he is running, the entire sequence of steps required to smoothly shift has been internalised as a single action, and even the invoking of that actions is on semi-automatic. (I realize many americans drive an automatic, I'm assuming a driver used to manual here)

      What I'm saying is that, drawing a (rough!) circle is very easy for an adult. Drawing a rough rectangle is very easy too. So you'd expect to be able to do both *without* having to train it. Certainly any one of them taxes much less than half your mental capacity. Only that ain't so.

    44. Re:our brains aren't wired to think in parallel by nschubach · · Score: 1

      Maybe we are thinking about it too hard then. Not everything has to be parallel. A parallel task can be in the form of copying multiple files, downloading multiple files, opening each file and processing each independently instead of waiting for its time in the list for your one process. There are processes that can be paralleled for mathematics and computations (like calculating PI), but it would require rethinking Mathematics, not logic flow in a program.

      [Your sitting in class. Your teacher asks you to pick two classmates. You are to give both these people a task in order to solve your original question without giving them the question itself. The teacher tells you to solve the equation: 22/7. What do you have your two classmates solve?]

      Let's look at another scenario:
      [Your in the same class, with the same classmates. Each classmate is to help you solve your problem as before. The teacher asks you (with the help of your classmates) to go around the class and describe each student. He hands you one sheet of paper.

      Should your two classmates tear their piece of paper in thirds and grab two more classmates to have them help? Would that be too much complexity? Would you get it done quicker by having each classmate choose two classmates (tear their sheets in thirds) until all classmates are chosen and have a sheet of paper to which they will describe themselves and pass it back to the student that picked them?

      Some tasks are fairly easy to multi-task and those are the ones that should be simple. Unfortunately, the common programming languages make those tasks harder than they should be. Pure brute force might be faster than trying to figure what to do, how to do it, and which classmate to assign it to. Will one write faster and get more students done then the other? Does that matter?
      Multi-tasking in a program can be as simple as one thread redrawing the list of items on the screen while another tracks and updates the position of the scroll bar. Right now, all those happen sequentially. Not because the programmer is "too lazy" to break it off asynchronously, but because the languages in use don't make it easy. (That was probably a bad example. Those tasks are minor and probably best handled sequentially today. But it's the idea that matters.)

      --
      Every time I start to have faith in humanity, I ruin it by driving to work between 7 and 8 am.
    45. Re:our brains aren't wired to think in parallel by WilliamSChips · · Score: 1

      I disagree!

      --
      Please, for the good of Humanity, vote Obama.
    46. Re:our brains aren't wired to think in parallel by gladish · · Score: 1

      I've noticed that people are using the term "parallel programming" pretty losely here. Multi-threaded programs are not necessarily what some people call "parallel programming". There are many apps that have lots of threads doing several disjoint tasks concurrently or in "parallel" if the hardware permits (>1 core). But the term "parallel programming" is usually a term reserved for high performance computing apps. This is generally a bunch of threads or forked processes all working on the same task. Very big difference from the former. I would not referr to your typical producer/consumer application as "parallel programming". You're web-browser usually has multiple threads pulling content down in "parallel", but I'm sure the microsoft developers who work on IE don't consider themselves parallel programmers. Point being. Parallel programming and multi-threaded programming aren't necessarily the same thing. Don't use the terms interchangeable. http://en.wikipedia.org/wiki/Parallel_computing http://en.wikipedia.org/wiki/Multithreading

    47. Re:our brains aren't wired to think in parallel by mwvdlee · · Score: 1

      Autcllay, it tnrus out taht our mnid can pterty elsaiy raed txet if olny the frist and lsat lreetts of it are in oderr. I gesus taht is knid of evendcie as to how plealral the mnid rllaey wokrs; lertets don't eevn need to be in precfet scuenqee as lnog as it has a plerropy dieenfd srtat and end.

      --
      Slashdot social media options: AIM, ICQ, Yahoo, Jabber and Mobile Text. Why no MySpace?
    48. Re:our brains aren't wired to think in parallel by Vulcann · · Score: 1

      I sorta disagree.

      Parallel programming is just a different paradigm. Moving from sequential to parallel programming has about as much difference as moving from procedural to OO programming. That said, it IS hard to be a good OO programmer. I have had the good fortune of working quite a bit in massively parallel systems (try an app split up into 8 processes each with custom threading inside them for size), as well as large sequential OO systems and the thing I've learned to appreciate is, each paradigm has its spoken and unspoken rules:

      Parallel programs work best when the independent execution units are regularly busy and the messaging overhead between the parallel units is kept small compared to the processing time taken. This demands the problem be sensibly broken up such that compute power is utilized most effectively. [It also depends on the problem of course, like GUIs use parallel processing merely to indicate status in a statusbar - a purely usability driven implementation.]

      Similarly OO requires you to break up the problem in terms of abstracted entities which "talk" to one another. Its about managing complexity thinking in self contained "meta" terms of real life entities.

      Going to generic programming has its own set of do's and donts to use it effectively which are also reasonably difficult to get right.

      There are lots of people who claim to be great OO programmers when all they're code is totally procedural and there are a lot of programmers who claim they can write good parallel code while in reality they have not designed a solution for handling parallel execution.

      No one seems to handle a paradigm shift easily. That isnt so much because parallel programming is hard, its more because people don't unlearn old habits.

    49. Re:our brains aren't wired to think in parallel by hey! · · Score: 2, Insightful

      Our brains may be parallel, but is our consciousness parallel? I don't think so.

      The problem isn't that our brains our consciousness is unable to do this, however. All programming involves interactions between details that potentially is too much for us to handle. Good programming is limiting interactions to a small number of well defined interfaces, and very good programming reduces the amount of context you have to consider to what you can visually scan in a few seconds.

      The problem is that the paradigms for interacting parts are not familiar.

      I've been through this several times in my career. When I started most programs were of a filter-ish nature; they started at the top and fell to the bottom, with a number of abstracted side trips via subroutine calls. Then came the GUI, and even basic programs became systems like operating systems, in that they ran for an indeterminate length of time, orchestrating responses to a stream of events of unpredictable, potentially unlimited length. This was a massive shift for programmers; many thought it was impossibly difficult for a typical programmer to work on this kind of system.

      Same thing happened when web applications came along. We supposedly couldn't use the "simple" model of a single process working in a common address space anymore as applications started to take on a distributed flavor, distributed not across address spaces, but application hosts: browser based javascript, web application container, web services hosts, database hosts etc.

      Parallel programming isn't the last new paradigm programmers will be asked to absorb. People will do it, then move on to complain about the next big thing.

      --
      Post may contain irony: discontinue use if experiencing mood swings, nausea or elevated blood pressure.
    50. Re:our brains aren't wired to think in parallel by Nevynxxx · · Score: 1

      Well, I can listen to something, to the point of singling along (i.e. talking, with timing, and adjusting to make up for my mistakes), whilst reading. Not easy, and not often, but I sometimes find myself doing it.

    51. Re:our brains aren't wired to think in parallel by Sir+Codelot · · Score: 1

      but can you talk (perhaps reciting something from memory) at the same time you are listening to something?
      That's what interpreters do all the time.
      --
      I have a truly marvelous proof of the Riemann hypothesis which this sig is too short to contain...
    52. Re:our brains aren't wired to think in parallel by Anonymous Coward · · Score: 0

      This comment is factually false. A typical human can literally walk and chew gum at the same time. The human mind is capable of a fair amount of multi-tasking and can even be trained to improve it in certain areas. A vast field of study revolving around pilots in the aerospace industry confirms this. Pilots simultaneously monitor many gauges, operate aircraft controls, and converse with the tower.

      It is true that certain things are more difficult for humans to do, such as reading and listening at the same time (assuming you must comprehend both modes of communication completely).

      None of this, however, should translate to a limit on the complexity of a computer's software. Such software is not developed by a single person. Each person on a (non-trivial) software development project has tasks to perform and actually develop the code in parallel (showing that even non-technical project planners can think in parallel). Part of the issue is that schools do not typically teach software engineers and computer scientists the techniques and skills for parallel computing. Some of these skills are taught to electrical engineers. There is a significant electrical engineering presence in the software world, quite possible because of these reasons.

    53. Re:our brains aren't wired to think in parallel by lejerdemayn · · Score: 1

      Activities are localized in the brain; it seems that these areas are largely independent, but try two tasks that use the same area and you're SOL. maybe the brain has something like ..

      lock(this) {
      // i'm in my mutual exclusive zone
      }


      ^^
    54. Re:our brains aren't wired to think in parallel by CastrTroy · · Score: 1

      I also think that a lot of people here saying that parallel programming is easy have never done any actual parallel programming. They take their serial algorithms, and run them in a bunch of threads. That's not real parallel programming. I took a parallel programming course in university, and although I wouldn't say that makes me a master, it gave me enough of an idea of what real parallel programming was, and how well it can actually increase the speed of a program. However I think (or hope) that the apps that would really benefit from parallel programming such as databases, are already parallelized to some degree. Your word processor doesn't really need true parallelization. However, if you reprogrammed some key libraries so that the everyday developer wouldn't have to think about doing the parallelization themselves, I think that we could make our computers a little snappier.

      --

      Anthropic principle: We see the universe the way it is because if it were different we would not be here to see it.
    55. Re:our brains aren't wired to think in parallel by Anonymous Coward · · Score: 0

      I can read books for my children while I'm thinking of something else. Afterwards I have no idea about the contents. This is a skill I developed during my studies years ago. Not so practical back then.

    56. Re:our brains aren't wired to think in parallel by Organic+Brain+Damage · · Score: 1

      "Writing a massively parrallel web spider is conceptually very easy."

      Honest curiousity here, not argument...

      Can you think (serially or in parallel, it doesn't matter to me) of an example where a programming technique is the right one for the problem but conceptually very difficult?

      Recursive tree traversal seem conceptually very easy to me, binary searches through sorted data, much of SQL, XML, Web Services, etc... When some technique is complicated and "difficult" it usually means we (the larger we) have not figured out the good solution. Once we get the good solution, elegance and simplicity tend to emerge as characteristics of the solution.

      P.S. For examples of humans who think naturally about many things at one time, just look at women. I had to leave my parents' basement to find one, but sure enough, they think about many things at once, and they do it all the time. How interesting.

    57. Re:our brains aren't wired to think in parallel by PinkPanther · · Score: 1

      My browser and other browsers are downloading this exact same page.. look it's parallel programming and no one had to do anything special.

      I'm gonna bet there are a lot of groups and developers that completely disagree with that statement. I'm thinking of the Apache Group, MySQL developers, Perl developers, Slashcode developers, Linux developers, etc...

      --
      It's a simple matter of complex programming.
    58. Re:our brains aren't wired to think in parallel by Anonymous Coward · · Score: 0

      Can you think (serially or in parallel, it doesn't matter to me) of an example where a programming technique is the right one for the problem but conceptually very difficult?

      A lot of advanced digital signal processing is frighteningly unintuitive, but gets the job done better than any naive approach.

    59. Re:our brains aren't wired to think in parallel by Ex-MislTech · · Score: 1

      Correct me if I am wrong here, most parallel programming needs are
      greatly alleviated by this project => http://www.mosix.org/txt_about.html

      --
      google "32 trillion offshore needs IRS attention"
    60. Re:our brains aren't wired to think in parallel by jj13 · · Score: 1

      Is anyone forgetting that many tasks are simply serial by nature? Without knowing the results of the previous calculation, you can't go on to the next? This is definitely not always the case, but it does occur and there's simply not much you can do about it without guessing techniques (which themselves would be expensive and reduce the accuracy of the results). disclaimer: I haven't read ALL the comments (if anyone's already said this, sorry!)

    61. Re:our brains aren't wired to think in parallel by Hoi+Polloi · · Score: 2, Funny

      Actually I parallel process when I read most Slashdot comments. Right now for instance I was reading your comment but thinking about cupcakes. Ummm, cupcakes...

      --
      It is by the juice of the coffee bean that thoughts acquire speed, the teeth acquire stains. The stains become a warning
    62. Re:our brains aren't wired to think in parallel by TheRaven64 · · Score: 1

      Passing a message is just a matter of putting a reference into a buffer. You can implement this using lockless ring buffers, and the cost is less than a function call (no register loads and saves for every message, you can just do a switch to the next process when you need to handle the threads).

      Function calls are just a special case of message passing, where the call and return both happen synchronously. In a limited number of situations, they are the most efficient. In most, they are the simplest to implement, but this does not make them the best.

      Oh, and a process in Erlang only requires the allocation of a few bytes for the local stack; spawning a process and sending it a message is cheaper than a function call in some languages...

      --
      I am TheRaven on Soylent News
    63. Re:our brains aren't wired to think in parallel by zettabyte · · Score: 1

      You don't look at text one letter at a time to try to decipher the meaning, do you? You probably look at several letters, or even words, at a time.

      Dude. I read that, and then immediately started trying to analyze how I read. Do you have any idea how much that screws you up?

      That kind of introspective analysis could lead to a complete failure of my literary skills.

      I guess I'll go cruise digg.com/videos now...

    64. Re:our brains aren't wired to think in parallel by phunctor · · Score: 1

      "If the people that like C can't use C they'll probably use assembler before they use one of those "dirty" functional languages that aren't close to the metal."

      Got to disagree. 8, 16, 32, 64... core processors will be here in the blink of an eye, and any language which forces the first level of the program to be about the *means* to exploit these resources is going to feel like coding in assembler compared to one that lets you pursue your computational *ends*.

      I've still got my first edition of K&R, but these days I'm boning up on Erlang and OCAML (and walking around Haskell saying "???". Time for some serious math retreading here...).

      --
      phunctor

    65. Re:our brains aren't wired to think in parallel by phunctor · · Score: 1

      What is this, generalized abstract nonsense?

      --
      phunctor

    66. Re:our brains aren't wired to think in parallel by BitchKapoor · · Score: 1

      Hey, now. In many case, message passing that's "too parallel" can actually be transformed by compilers into subroutine calls.

    67. Re:our brains aren't wired to think in parallel by smellsofbikes · · Score: 1

      I've played with this a bit. It's really difficult to count consistently if you're wearing a headphone that's playing back what you've said with about a one-second delay, so you're hearing 'one' when you're saying 'three'. Likewise I have a neat shirt that has lots of colors and their names written on it, like redpurple, and reading it is somewhat difficult.
      In contrast, my dad, who was a supergenius (he knew Feynman, in fact) could count, quickly, while multiplying three-digit numbers in his head. (Geek party trick.) It'd usually take him counting to about 30 or so, in fewer seconds, to complete the multiplication, and they weren't just squaring 3 digit numbers, either. Even I can square 3-dig while counting, but I absolutely can't do serious math while counting. So I think there are significant differences in people's ability to assign brain parts to what they're doing.

      --
      Nostalgia's not what it used to be.
    68. Re:our brains aren't wired to think in parallel by Surt · · Score: 1

      Nope, though you obviously have to remember to do something with your feet after the kicks to prevent that. (As a parallel, ask yourself: wouldn't you wind up standing on one leg if you kicked one opponent? Answer: no, you put your leg back down after.)

      --
      "Who is the Journal of Quantum Physics going to believe?" --Stephen Hawking
    69. Re:our brains aren't wired to think in parallel by Anonymous Coward · · Score: 0

      Parallel programming is a tool. Like any tool, it should be used where it is warranted. Just like you don't go around using a flathead screwdriver as a chisel, you should not go around and start parallelizing office apps that do not require it.

      If you can not achieve data level parallelism, you either probably don't need to parallelize your code, or if you do, you are working on very difficult problems that have no expectation to be cheap or easy to solve. IMHO, data level parallelism is not hard at all- maybe only in the sense that you have to think a little differently, but its definitely easier to transition to parallel style thinking than to OOP.

      We should really be thinking about parallelization as a chainsaw rather than a scalpel type tool, for example in a game running the AI and rendering engines on separate threads, or if we go "massively parallel" perhaps a thread per in-game object. The problems start pouring in once you start trying to pick apart say a path walking algorithm and trying to find ways to parallelize it.

    70. Re:our brains aren't wired to think in parallel by Hatta · · Score: 1

      I don't understand. Why is the onus on the programmer to write in parallel? Can't the compilers do it?

      --
      Give me Classic Slashdot or give me death!
    71. Re:our brains aren't wired to think in parallel by mrcdeckard · · Score: 1

      Every process is serial from a broad enough perspective. Eight hypothetical modems can send 8 bits per second. Or are they actually sending a single byte?


      sounds like heisenberg's uncertainty principle is in there somewhere. . . .

      mr c
      --
      "Physics is like sex. Sure, it may give some practical results, but that's not why we do it." - R. Feynman
    72. Re:our brains aren't wired to think in parallel by kbielefe · · Score: 1

      Human brains can definitely do multiple complex tasks in parallel. They just have to practice long enough to be considered one conscious task. For example, I play the organ at church. This requires several complex tasks to be done simultaneously: reading four to six notes spread across two or three lines of music, playing four to five notes with hands and one with my foot with precise timing, preparing to play the next set of notes so a smooth transition can be made, maintaining the correct volume, keeping an eye on the conductor, and keeping an ear on the congregation.

      When I first started, I plain couldn't do it in parallel. If the song wasn't simple or slow enough to serialize everything, it was impossible to play. After a while, I could do it with intense concentration. Now, my brain has one task labeled "organ playing," and with a small amount of concentration I can do other things at the same time, like carry on a conversation, think about something else, or sit back and objectively enjoy the music. Have you ever been startled to realize you haven't been consciously driving for a while? Remember how hard it was your first time behind the wheel?

      In fact, I find it difficult to work on a task if all my "concentration slots" aren't filled. For example, I get distracted very easily if I don't listen to music or conversation while working on a mundane task.

      --
      This space intentionally left blank.
    73. Re:our brains aren't wired to think in parallel by shelterpaw · · Score: 1

      Potential performance advantage is not always very high (I know, I get paid to squeeze this last bit), and is usually more than offset by difficulty in maintenance. That's fine statement for certain applications. I wouldn't see much advantage for a word processing application. When you start dealing with processor intense applications such as music and video editing the potential advantage is enormous. I know from using these tools everyday and going from a single processing machine to a machine with 2 processors and 4 cores. The difference from being able to run 2 to 4 tracks to nearly 32.
    74. Re:our brains aren't wired to think in parallel by ukemike · · Score: 1

      While reading that our brains aren't wired to think in parallel, I am sipping my tea, "playing" a song that's stuck in my head (The Wind Cries Mary), listening for the boss' footsteps so I don't get caught surfing, breathing, pumping blood, and digesting my breakfast. Don't tell me that our brains don't work in parallel.

      --
      -- QED
    75. Re:our brains aren't wired to think in parallel by Courageous · · Score: 1


      What's really missing are better libraries and compilers.


      Look here:

      http://www.rapidmind.net/

      These people are doing some very nice things with parallel compilers. Write once, run on Sony's core, GPGPU, or a traditional multicore x86. They are just now coming out of stealth mode. The compilers are free; rather they license based on deployment. The license charges are quite modest for deploying a few solutions ($1K for one deployment... scales down from there).

      Joe.

    76. Re:our brains aren't wired to think in parallel by Anonymous Coward · · Score: 0

      Lisp programmers used to say that a lot. "Let the programmer write an elegant but inefficient algorithm, and let the compiler make it efficient."
      Which is bullshit, of course. Imagine the problem from your perspective; instead of going from a problem definition to a solution, you now have to look at a finished program, figure out what it does with all possible input, and then reimplement it efficiently. That's hard even for a human.
      You can do minor improvements automatically, looking at dependancy graphs, etc., and you can design your language to make it easier for the programmer to parallelize, but you'd need a human intelligence or higher to do a real rewrite code from serial to parallel (and if your computer has that, you probably have bigger worries than poorly written code.)

    77. Re:our brains aren't wired to think in parallel by Creepy · · Score: 1

      yes - you're right, it's debatable. Do you see the word as a complete "symbol" or do you see the letters individually and build it into a word? I've read about a visual interpretation study that suggested people visually see only the first and last letter when reading normally and everything else in-between is filled in by context and to a lesser extent by word length.

      Your modem post reminded me of a another question, actually one I had when I was quite young and first started taking piano lessons - why are modems serial? If you use one tone for a 1 and another for a 0, why not just add a third and fourth in parallel for a different 1 and 0 like piano chords? Even as I think about it now, even if the waves overlap for a brief time, the sample rate should be sufficiently large enough to offset the potential error and a harmonic filter could separate the parts each 1 and 0 need. Using this same basis and applying it to the human voice, why can't I say two words at the same time and have you interpret them both in parallel like a musical chord? Human speech, despite its resonance that may give simultaneous octaves or chords still is linear in interpretation. OTOH, studies done on babies show that they can keep track of multiple simultaneous conversations spoken by several people, which is a parallel operation. It's only as we grow into adulthood that we filter the background noise out and focus on single conversations.

      Personally, I believe the brain is massively parallel, at least for lookup, but some aspects might be linearly parallel like vision (how is a scene you've seen stored? As a collection of objects? The entire scene stored in an image? Memory Pixels? I don't know).

    78. Re:our brains aren't wired to think in parallel by hpavc · · Score: 1

      I doubt a modern crawler processes anything beyond network, server responses and protocol nuisances (redirection, mime, etags, modifications, etc). Paying any attention to the data 'fetched' its actually scheduled to go fetch would be stupid. Push that stuff back for some other chain of things to take apart.

      I don't even see how parallel crawling is even worthwhile, the protocol is so thin for http that the protocol to manage the parallel cluster possibly would be thicker.

      --
      members are seeing something, your seeing an ad
    79. Re:our brains aren't wired to think in parallel by mindstrm · · Score: 1

      What you just described is losely how modems actually do work. Anything over (I think, it's been like 12 years) 1200bps is using some kind of modulation and therefore using multiple tones.. effectively moving bits in parallel. This still doesn't change the nature of the device... to YOU it's still serial, bytes go in one end and come out the other. Of course rather than something produced by Mozart it sounds like a hellish screetching of a thousand banshees... but it's the same thing.

    80. Re:our brains aren't wired to think in parallel by Anonymous Coward · · Score: 0

      Being simultaneously barefoot and pregnant? :-)

    81. Re:our brains aren't wired to think in parallel by TheDarkRogue · · Score: 1

      Not at all, programs need to be written in parallel to be able to take advantage of systems like the Mosixes. Even then in order for them to be migratable they have to take into consideration things like the impracticality of using shared memory and bottlenecks like interconnect latency. The idea is far from perfect but is making strides.

      --
      (Score:0, Interesting)
    82. Re:our brains aren't wired to think in parallel by poopdeville · · Score: 1

      This still doesn't change the nature of the device... to YOU it's still serial, bytes go in one end and come out the other.

      I chose my 8 modems example for many reasons. One of them is the parallel port standard defines "byte mode", wherein the port is capable of transmitting a single byte in unit time.

      --
      After all, I am strangely colored.
    83. Re:our brains aren't wired to think in parallel by LogicHoleFlaw · · Score: 1

      That's an interesting observation. I've noticed something like this in myself. I have a background heavy in music and video games, and lately I've been playing many rhythm games such as Guitar Hero and Donkey Konga. Mentally I count out rhythms in a vocal manner. "1-e-and-uh 2-e-and-uh 1-ta-la-ta-li-ta 1-2-3-uh-4" and so on. Despite the fact that neither of these games requires the use of the mouth or vocalizations, I am completely unable to speak while playing them. My mind is entirely occupied by the rhythm and counting involved in playing. My friends get a great laugh out of asking me questions while I'm playing. I hear and process their questions internally, but the most I'm able to respond with is a labored "yes" or "no".

      It's fascinating that you mention the person who could talk but not read while timing things. I wonder if he would have trouble say, playing music from sheet music but be able to hold a steady rhythm while singing or playing from memory.

      --
      -- Flaw
    84. Re:our brains aren't wired to think in parallel by Reivec · · Score: 2, Interesting

      By this logic, it seems like maybe we are not designing our multi-core processors effectively. It may be more effective if we designed different cores for different tasks, much like our brains. If you could describe to a programmer 4 cores on a processor and that each core was really only good at ONE type of processing, then that programmer would logically break up his design into peices for each core to do individually. Even if they had to be done in serial, each core may process its peice faster than a general CPU and thus make the whole process faster. If you were running other programs at the same time that were also serial, they may not be asking for the same cores all the time either.

      I realize this is over simplified and would probably have lots of problems in practice. However I know that there are plans to combine CPU and GPU cores for very much the same reasons, they are good in some areas and bad in others.

    85. Re:our brains aren't wired to think in parallel by h4ck7h3p14n37 · · Score: 1

      Ah, you beat me to the punch. I know a couple Erlang developers and they've only had great things to say about the language and about OTP. I've read through the first five or so chapters from the Erlang book (it's almost impossible to find in the States, but Amazon.co.uk will print it for you on-demand) but haven't done much work with it other than a few toy programs.

      In addition to the two items you mentioned, I'm always hearing about the following things:

      • Process supervisor: will monitor and automatically restart failed processes.
      • Write-once variables: once a variable has been assigned a value, it's immutable. This is supposed to reduce programmer error.
      • Mnesia database: An in-memory (and on-disk), network replicated database. You application database can span the entire Erlang cloud if you so choose.
      • Load new code on the fly: you can change code while the system's still running.

      You did mention the process mailbox and message passing; it would probably shock most C programmers at how easy it is to perform IPC in Erlang. If "X" is a PID and you want to send the tuple { 1, 2, 3} it's as easy as writing "X ! {1, 2, 3}". Where the actual processes reside is irrelevant, they could be on the same system or half-way around the World. There no need to worry about basic Berkeley-style socket programming, it's handled for you.

      Also, Erlang supports many, many more concurrent processes than any other language I've heard of. I seem to recall hearing of people running simulations with hundreds of thousands of processes. Erlang processes are much lighter weight than O.S. processes, since it's handled internally by the interpreter performing a context switch isn't very expensive.

      Finally, Erlang code is very programmer (and hardware, from what I'm told) efficient. You'll write orders of magnitude less code in Erlang than you would in a traditional language. Less code means less bugs.

      Have you seen the Erlang video yet? It's hilarious.

      By the way, do you happen to know of shops running Erlang? I've heard that Amazon is using it, but I don't know of anyone in the Chicago area using Erlang other than Orbitz.

    86. Re:our brains aren't wired to think in parallel by ubernostrum · · Score: 2, Interesting

      I've read through the first five or so chapters from the Erlang book (it's almost impossible to find in the States, but Amazon.co.uk will print it for you on-demand) but haven't done much work with it other than a few toy programs.

      Yeah, I've been doing tutorials and bought the beta PDF edition of Joe Armstrong's book, but at one point I stopped to go back and do The Little Schemer to refresh my ability to frame everything in terms of recursion on lists. Haven't gotten back to Erlang yet, but I've been keeping an eye out for something useful to do with it as a first non-trivial application. You'd think it'd be easy for a web-dev geek to come up with problems that are well-suited to the pseudo-functional concurrent style, but it's harder than it looks :)

      I've also been playing off and on with Scala, which is a pretty neat little language; it runs on the JVM (and has seamless importing of Java classes, which is quite nice), but has first-class and higher-order functions, anonymous functions, pattern matching (including pattern matching on classes, which is wicked cool), list comprehensions and the ability to use either Java's Thread API or its own Actor-based concurrency model. It's definitely worth looking at if you've been enjoying Erlang.

      By the way, do you happen to know of shops running Erlang? I've heard that Amazon is using it, but I don't know of anyone in the Chicago area using Erlang other than Orbitz.

      Not off the top of my head, but I'm also somewhat sidetracked by an ongoing effort to pull the news industry off Java and onto Python :)

    87. Re:our brains aren't wired to think in parallel by slonik · · Score: 1

      On the contrary, our brains themselves are massively parallel processing neuron networks.

    88. Re:our brains aren't wired to think in parallel by EvanED · · Score: 1

      Despite the fact that neither of these games requires the use of the mouth or vocalizations, I am completely unable to speak while playing them. My mind is entirely occupied by the rhythm and counting involved in playing.

      I'm the same way! I played cello for a number of years in the school orchestra, and if someone asked me a question while I was playing, it would get internally queued and I'd answer it a minute or two later when I was stopped. Or else I would slowly form the answer in my head (if it was short enough, like your yes/no), and say it on beat.

    89. Re:our brains aren't wired to think in parallel by Eli+Gottlieb · · Score: 1

      Function calls are just a special case of message passing, where the call and return both happen synchronously. Ah, I knew that stupid old lambda calculus would amount to nothing in the end!
    90. Re:our brains aren't wired to think in parallel by Anonymous Coward · · Score: 0

      Yep, and that's why good interpreters - who do it "on the fly" and keep up - are rare and sought after. Just speaking a foriegn language isn't enough. I'm fluent in German and English to about the same degree, but it's difficult for me to carry on a conversation in both languages at the same time, much less a running translation of one side or the other.

      Now written translation is something else. On paper I can switch back and forth much more easily.

    91. Re:our brains aren't wired to think in parallel by jc42 · · Score: 1

      Parallel programming is indeed hard. The standard approach these days is to decompose the parallel problem into a definite set of serial problems. The serial problems (applets) can then be coded more-or-less as normal, usually using message-passing rather than direct calls to communicate with other applets.

      Isn't this just a reinvention of the "unix approach" developed at Bell Labs over 30 years ago? For "applet" substitute "process", and you have unix terminology. Of course, we did have to wait a decade or so for the Berkeley people to invent an IPC method more flexible than the unix pipe. ;-)

      Making sure that everything is scheduled correctly does indeed take managerial skills.

      Of course, you can just let the kernel process scheduler handle it, if you have one that's decent. There have been discussions about possible improvements by giving processes some hooks into the scheduler, to give the scheduler "hints" about how to do its job better, but I don't see this much implemented. It does seem mainly of interest to the real-time crowd.

      In any case, this does seem to be an example of people re-inventing a problem by using different terminology, and refusing to recognize earlier (partial) solution because the words are different.

      And one might also argue that the problem isn't really the difficulty of parallel programming; we knew decades ago that this was a problem and had (partial) solutions. The main real problem is that the known solutions all involve dividing a program up into multiple "objects" (i.e., processes) that run independently and have strong barriers to prevent stomping on someone else's data. But most software developers seem to love building huge monolithic programs that do everything they can think of, and indignantly reject the suggestion that their app should be a flock of little communicating processes. This is blatant policy in the MS and Mac worlds, of course. But it has also been adopted in recent years by many unix developers who sneer at the methods of previous generations, leading to the need of multi-GB memory for what used to be doable in a few MB.

      Given all this, I don't expect rational solutions any time soon. Even if we get them, they'll be calmly ignored by most developers.

      --
      Those who do study history are doomed to stand helplessly by while everyone else repeats it.
    92. Re:our brains aren't wired to think in parallel by martin-boundary · · Score: 1

      Yup, and don't you forget it :)

    93. Re:our brains aren't wired to think in parallel by owlstead · · Score: 1

      Um, if you can parallelize many threads, you can just use a construct that tries to determine if they should be run in parallel, or just sequentially. So you can have x threads for x processors, and just schedule the tasks between them. If there are more tasks then threads, some will run sequentially. This can save quite some time, because the processor does not need to switch between threads all the time. In Java this is performed through Executors, with the ThreadPoolExecutor being one of the more sensible Executor implementations. Of course, you still have the communications to think about, but overloading does not look like much of a problem. Especially if you keep doing things sequentially; then you are overloading one of the processors for sure.

    94. Re:our brains aren't wired to think in parallel by Rimbo · · Score: 1

      Thank you for typing so eloquently my precise take on this.

      Multi-threaded programming is a lot like pointers or recursive functions. It takes programmers a while to "get" the idea, but one day, it just makes sense, and from that point forward it's easy. What makes pointers and multi-threaded apps "hard" is when someone who didn't quite get the idea yet writes something and it has to be debugged and maintained.

      It's also like both of those in the sense that while it's a powerful tool to use, it's not a tool you use whenever you want to. Calculating factorial, for example, is much faster and simpler when written iteratively than when written as a recursive function, even though that's the archetypal recursive function. Same goes for multi-threaded apps, where I've seen multi-threaded apps designed such that no more than one thread was active at any given point. Why have threads at all, then?

      Parallelization is a different thing entirely -- a solution to only a small subset of all of the computational problems. For example, you can parallelize multiple instances of a state machine, but you can't parallelize the processing of a single state machine. This is one problem with parallelization in games; the player represents an unpredictably changing state machine that forces the serialization of all other actions in response to it. You can parallelize the rendering of the scene within that context, since the algorithm for rendering one pixel is identical to the algorithm for rendering another... but you can't parallelize "the game."

    95. Re:our brains aren't wired to think in parallel by dave1g · · Score: 1

      Optimistic Parallelization techniques are promising in some areas. Basically if a problem seems like it could be parallelized but is difficult to implement the synchronization then this approach might be a win. All object methods must have inverses. Code is run and logged, if a conflict is detected then a rollback occurs. This can easily get slower than the serial code if the problem is not very parallel. As such the system should notice the high number of conflicts and resort to serial execution.

    96. Re:our brains aren't wired to think in parallel by phunctor · · Score: 1

      Unfortunately, my quip included everything I know about category theory. I want to fix that. Do you have any suggestions where to find / how to construct a self-study course suitable for retreading a 40-years-stale math BS?
      --
      phunctor
      vorticitykappa@yahoo.com

    97. Re:our brains aren't wired to think in parallel by LWATCDR · · Score: 1

      I think that Parallel programing is just two big of a lump to make statements about.
      I don't find multi-treaded code all that hard. I do it all the time and have had great success with it. Maybe I am just careful or lucky but so far so good.
      I have to admit that the tools are just not that good. One wrong mutex lock or failure to lock and you are in a world of hurt.

      --
      See my blog http://ilovecookes.blogspot.com/ for light hearted technical information.
    98. Re:our brains aren't wired to think in parallel by schwaang · · Score: 1

      There are probably many things the brain could do that we just never try to teach it.

      I had a summer job in a warehouse (the real kind, not the defuct music store). I had to pack X number of things into a box all day long for three months. And after a while the counting became very automatic. My mind could wander, I could talk to the person next to me, and my count went on flawlessly (verified by weight).

      Remember how hard it was when you first learned to drive? You couldn't keep the car going straight while keeping the speed even, etc.? And now look at you, steering with your knees while you eat a burger in one hand and work the radio pre-sets with the other, while carrying on a conversation with a passenger and eyeballing the rear-view mirror for cops.

      So we shouldn't generalize about the limits of the brain based on what seems impossible without much practice.

    99. Re:our brains aren't wired to think in parallel by martin-boundary · · Score: 1
      Sorry I missed your comment. Regarding suggestions, it depends what your original coursework was on and what topics you'd like to refresh :(

      Assuming you're looking to refresh the basics, a nice book on calculus is Spivak's Calculus or if you like discrete maths there's Kemeny, Snell, Thompson's Introduction To Finite Mathematics. For complex analysis, I would suggest Needham's Visual Complex Analysis. For geometry, Stillwell's The Four Pillars Of Geometry, and for topology, Simmons' Introduction To Topology And Modern Analysis. Maybe Fraleigh's A First Course In Abstract Algebra.

      For more advanced stuff, there's too many options to list. If you want category theory specifically, try MacLane's Categories For The Working Mathematician. But I wouldn't recommend it if you're a little rusty on the basics.

      Best of luck.

    100. Re:our brains aren't wired to think in parallel by Sobrique · · Score: 1

      No, because you're so busy concentrating on the punching and kicking, you forget about the falling part, and end up flying. An admirable way to throw yourself at the ground and miss.

  3. Two words: map-reduce by Anonymous Coward · · Score: 3, Interesting

    Implement it, add CPUs, earn billion$. Just Google it.

    1. Re:Two words: map-reduce by shannara256 · · Score: 1

      I found Joel Spolsky's article on map-reduce ("Can Your Programming Language Do This?") very enlightening, much more so than the wikipedia article. Unfortunately, a google search for map reduce ranks it ninth.

    2. Re:Two words: map-reduce by allenw · · Score: 5, Informative
      Implementing MapReduce is much easier these days: just install and contribute to the Hadoop project. This is an open source, Java-based MapReduce implementation, including a distrbuted filesystem called HDFS.

      Even though it is implemented in Java, you can use just about anything with it, using the Hadoop streaming functionality.

    3. Re:Two words: map-reduce by Anonymous Coward · · Score: 0

      Map-reduce is one of those things functional programmers do all day. (If your functions have no side effects, who cares if you run 10 at the same time?)

      Perhaps what the author meant to say (had he gone to college) is "Have we hit the point beyond which procedural/OO programming does not scale?".

    4. Re:Two words: map-reduce by coaxial · · Score: 1

      Map-Reduce is useful, but it's an incredibly simple archictecture that only works for the most trivially parallelizable problems. Which isn't surprising given the problem domain it was designed for.

    5. Re:Two words: map-reduce by LarsWestergren · · Score: 2, Insightful

      Two words: map-reduce
      (Score:4, Interesting)
      by Anonymous Coward on 07-05-29 6:29 (#19305183)
      Implement it, add CPUs, earn billion$. Just Google it.


      Wow, fantastic. Turns out parallel programming was really really easy after all. I guess we can make all future computer science courses one week then, since every problem can be solved by map-reduce! The AC has finally found the silver bullet. Bravo, mods.

      --

      Being bitter is drinking poison and hoping someone else will die

    6. Re:Two words: map-reduce by Duncan3 · · Score: 1

      *laughs* do you have any idea how OLD what Google calls map-reduce is? Well new to them I suppose, their oldest programmer is what, 25? Of course it's new!

      --
      - Adam L. Beberg - The Cosm Project - http://www.mithral.com/
    7. Re:Two words: map-reduce by pchan- · · Score: 2, Funny

      I guess we can make all future computer science courses one week then, since every problem can be solved by map-reduce!

      What do you mean? I just wrote a clone of Half-Life 2 using only Map-Reduce. It works great, but it requires 600 exabytes of pre-computed index values and data sets and about 200 high end machines to reach decent frame rates.

    8. Re:Two words: map-reduce by IceFox · · Score: 1

      And here is another map reduce implimenation, but written for C++: QtConcurrent

      --
      Do you changes clothes while making the "chee-chee-cha-cha-choh" transformation sound?
    9. Re:Two words: map-reduce by Reverend528 · · Score: 1

      This is an open source, Java-based MapReduce implementation

      It amazes me that someone would implement map-reduce in a programming language that doesn't have a built-in implementation of map or reduce.
  4. Have some friggin' patience by Corydon76 · · Score: 4, Insightful

    Oh noes! Software doesn't get churned out immediately upon the suggestion of parallel programming! Programmers might actually be debugging their own code!

    There's nothing new here: just somebody being impatient. Parallel code is getting written. It is not difficult, nor are the tools inadequate. What we have is non-programmers not understanding that it takes a while to write new code.

    If anything, that the world hasn't exploded with massive amounts of parallel code is a good thing: it means that proper engineering practice is being used to develop sound programs, and the jonny-come-lately programmers aren't able to fake their way into the marketplace with crappy code, like they did 10 years ago.

    1. Re:Have some friggin' patience by Anonymous Coward · · Score: 0

      It is not difficult, nor are the tools inadequate. What we have is non-programmers not understanding that it takes a while to write new code.

      Have you done any serious parallel programming yourself? If so, how certain are you that it's correct? I ask because I've been following programming research, and the general consensus seems to be that it is too hard with the existing tools. I haven't done anything serious requiring multiple threads, but the experience I have had suggests that it can be a very tricky thing indeed to do correctly.
    2. Re:Have some friggin' patience by QuantumG · · Score: 1

      I remember learning about model checking at university. We did some finite state analysis and looked at how people did more comprehensive, formal analysis (but never did it ourselves). This was 10 years ago. I've never used it in my career. I've never known anyone who's used it. I assume people who work on automotive or aerospace systems must though.

      --
      How we know is more important than what we know.
    3. Re:Have some friggin' patience by GileadGreene · · Score: 1

      I ask because I've been following programming research, and the general consensus seems to be that it is too hard with the existing tools. I haven't done anything serious requiring multiple threads, but the experience I have had suggests that it can be a very tricky thing indeed to do correctly.
      Yes, and then again no. Concurrency is hard. But it doesn't have too be as hard as most developers make it. Shared state and threads are horrible way to do concurrency, but it's all most developers are taught. We've had the tools to do concurrent programming in a much more manageable way for 15-20 years (Google for the occam programming language, or CSP - for a modern take, see Erlang or E). I've personally written software consisting of 1000+ interacting "threads" in a complex, dynamically changing communications topology. Concurrency bugs have generally not been a problem with that code (I spent more time debugging some of the sequential stuff) because of the design paradigm I used (occam and CSP). Granted, that toolset is not "mainstream", and there's more research dollars in selling stuff like Software Transactional Memory (which nominally lets programmers stay in their little sequential comfort zone) than there is in actually taking existing, proven solutions mainstream (again, Erlang is about the closest we've got right now).
    4. Re:Have some friggin' patience by dbIII · · Score: 1

      However we have the situation where many commodity desktop systems have more than one CPU and even a handheld computer game such as the Nintendo DS is a dual processor system. The old sparc10 that has been working as a print server for more than the last decade is a dual processor system. It should not have taken people by suprise just as moving to 64 bit should not be taking anybody by suprise.

    5. Re:Have some friggin' patience by suv4x4 · · Score: 1

      It's not just that, but some tasks can't be computed in parallel. Microsoft and Intel are working on lots of additions to their compilers/frameworks that make parallel programming transparent to the programmer. Functional programming.

      Until then, people are splitting in threads what seems to make sense to. In a game, for example, you can logically split the engine into 6-8 threads without throwing away all your serial programming skills away. You got input/input feedback, core logic (script), sound processing, physics, 3D transform and processing, AI and some more like these.

      They can run independently and only sync to the core in specified intervals/events.

      But this one more reason the next XBOX or PS won't have the same architecture, but hundred cores: there's a boundary where the extra cores simply aren't useful for anything, and the way you program needs to shift, and the evolution of the languages is a huge thing here.

      And as you said, the tool providers aren't surprised by this, they've been working hard on R&D in the area for the past 3-4 years at least, and there are actual products emerging out of it (like the parallel processing library in .NET which helps you compute things using multiple cores or your GPU without managing all the plumbing of this under the hoods).

    6. Re:Have some friggin' patience by marcosdumay · · Score: 1

      "It is not difficult, nor are the tools inadequate."

      The tools are obviously inadequate. Did you ever tried to debug a nontrivial piece of paralel code? Even code on a UMA is hard to debug.

      It is also quite hard to write today. That problem may disapear with better tool, but our tools are bad...

      But the worse problem is that paralelizing for an unknown architecture is near impossible today. That is the reason we don't see many programs taking advantaje of multicore (how many is 'multi'?) machines. It may get doable with better tools, but we aren't there yet.

    7. Re:Have some friggin' patience by gbjbaanb · · Score: 1

      Programmers might actually be debugging their own code! Oh they sure are if they've gone and parallelised it!

    8. Re:Have some friggin' patience by Goaway · · Score: 1

      >> Since this discussion has been going on for over three decades with little progress in terms of widespread change...

      >Programmers might actually be debugging their own code!

      That is some debugging session there.

    9. Re:Have some friggin' patience by gcooke · · Score: 1

      I work for a large financial organization, on just this problem. From our perspective, the issue isn't whether parallel programming is too hard...we've adapted to various programming trends over the years just fine...the real question is how to manage the disruption of a new paradigm like this. Unlike other paradigms, parallelism has the capacity to apply to so many situations that you end up with a boil-the-ocean problem -- especially now that our codebases are truely ginormous, in constant flux, and fully mission-critical. How do you find the best spots in your codebase to parallelize without parallelizing the whole damned thing?

      Some say, "well, just run a profiler on your code and parallelize the slowest functions!". Well, that's a start, but parallel technologies are not all created equal -- one code might be perfectly appropriate for threaded execution on a multicore chip but a complete waste of time on an FPGA or GPU. And parallelizing compilers, when they -do- work, often produce code that is horribly inefficient on a conventional processor (which seriously complicates the transition to production use). And yes, I know that there are tools out there that purport to sniff out candidate code...but their expense and lack of track record inhibits their adoption (at least where I work).

      The reason parallization isn't popular yet in the enterprise is partly tooling, partly training...and partly decision-making. It requires substantial expertise to find good parallelization candidates -- and it takes even more expertise to explain to a budget-holder why the port costs as much as it does. The parallelization paradigm requires hardware AND software AND expertise and all of these parts have to be precisely fit or the solution suffers tremendously. But progress -is- being made, every time a project lead wins support to move one of the business's codes to FPGA or GPU or multicore or Clearspeed or whatever -- regardless of whether its successful or not.

      The barriers to adoption aren't really all that unusual and won't keep parallelization from happening...its just going to take time for this meme to penetrate into the larger companies whose money will drive the paradigm into full-scale adoption. I think we're at the stage now where we need real live working demonstrations of valuable business code running in real production environments, both in order to convince our management that its worth spending money to foster this paradigm, and to learn what does and does not work.

    10. Re:Have some friggin' patience by Raenex · · Score: 1

      I glanced at Occam recently. One thing that stood out was the introduction of pi calculus. Do you use pi calculus in addition to CSP?

    11. Re:Have some friggin' patience by GileadGreene · · Score: 1

      Not directly. The tool support for the pi-calculus is (IMHO) a little lacking compared to what you can do with CSP. Mobility Workbench is nice, but no real competition for FDR when it comes to design analysis. Not to say that you couldn't use the pi-calculus. However, since it's relatively straightforward to model the mobile aspects of occam-pi within the CSP framework using channel datatype conventions, and CSP is already a reasonably good match for the non-mobile part of occam, I've just used CSP as my analytical framework.

      I'm not sure if there's been any work on applying the pi-calculus to occam-pi. I gather Peter Welch has done some work on a pure-CSP semantics for occam-pi (using the aforementioned technique for modeling of mobility within CSP), and I've heard talk of developing techniques for working with occam-pi in the "Unifying Theories of Programming" (which is kind of a mix of Z and CSP), but have heard nothing about using the pi-calculus so far (which is not to say it isn't happening of course). I have seen a few papers that discuss using the pi-calculus to model Erlang programs. But I don't recall if the intent there was to actually provide analytical support.

    12. Re:Have some friggin' patience by Raenex · · Score: 1

      Thanks for your reply. Do you know if there is an open source version of FDR or similar tool? I looked but didn't find any.

    13. Re:Have some friggin' patience by GileadGreene · · Score: 1

      Well, yeah, that is a problem. FDR is free for academic use, IIRC. But they charge for commercial use. Although, as the Formal Systems Europe folks point out, exactly how much debugging time do they need to save to justify the cost of FDR.

      If FDR is too pricey for you (perhaps you're an open source developer), there are a few other options. In the free category is LTSA. LTSA accepts a language called FSP, which is similar (but not identical) to CSP. The tool itself is not as powerful as FDR from what I can tell, can potentially still very useful. And there's an Eclipse plugin :-) In the open source category is SPIN. SPIN's process modeling language, Promela, is more C-like than CSP-like, but does have CSP-like semantics. The tool itself is free, open source, very powerful, and has an active community of users. Definitely worth a try if you're looking for something capable of industrial-strength model-checking.

  5. It's not trivial, and often not necessary by Opportunist · · Score: 5, Interesting

    Aside from my usual lament that people already call themselves programmers when they can fire up Visual Studio, parallelizing your tasks opens quite a few cans of worms. Many things can't be done simultanously, many side effects can occur if you don't take care and generally, programmers don't really enjoy multithreaded applications, for exactly those reasons.

    And often enough, it's far from necessary. Unless you're actually dealing with an application that does a lot of "work", calculate or display, preferable simultanously (games would be one of the few applications that come to my mind), most of the time, your application is waiting. Either for input from the user or for data from a slow source, like a network or even the internet. The average text processor or database client is usually not in the situation that it needs more than the processing power of one core. Modern machines are by magnitudes faster than anything you usually need.

    Generally, we'll have to deal with this issue sooner or later, especially if our systems become more and more overburdened with "features" while the advance of processing speed will not keep up with it. I don't see the overwhelming need for parallel processing within a single application for most programs, though.

    --
    We used to have a Bill of Rights. Now, with the rights gone, all we have left is the bill.
    1. Re:It's not trivial, and often not necessary by ubernostrum · · Score: 1

      Many things can't be done simultanously, many side effects can occur if you don't take care and generally, programmers don't really enjoy multithreaded applications, for exactly those reasons.

      This is why the languages which have the highest level of "enjoyment" for concurrent tasks tend to move further along the spectrum toward pure functional programming, and partially or completely ban side effects and mutable state (e.g., Erlang forbids shared state in its concurrency model, and also forbids reassignment).

    2. Re:It's not trivial, and often not necessary by mpe · · Score: 1

      Aside from my usual lament that people already call themselves programmers when they can fire up Visual Studio, parallelizing your tasks opens quite a few cans of worms. Many things can't be done simultanously, many side effects can occur if you don't take care and generally, programmers don't really enjoy multithreaded applications, for exactly those reasons.

      For tasks to be done in parallel they need to be independent of each other. Things also get further complicated where the number of parallel tasks is not a multiple of the number of execution units available and/or the tasks themselves are non identical.

    3. Re:It's not trivial, and often not necessary by try_anything · · Score: 1

      most of the time, your application is waiting. Either for input from the user or for data from a slow source, like a network or even the internet


      And a single-threaded program, unless it is written very cleverly, can only wait for one thing at a time. Don't you hate it when a program you're using tries to access a slow resource and completely locks up until the resource responds, preventing you from even cancelling the action? That's the kind of bug you get when a programmer assumes that a single-threaded design is always easier, even when solving a naturally concurrent problem.

      You can get a single-threaded program to fake concurrency correctly, but it takes special care, just like multithreading takes special care. The single-threaded program will rely on baroque control flow hacks that cause control to skip all over the source code, trying to keep all the plates spinning, while the execution flows in multithreaded programs can proceed quite linearly, blocking whenever they feel like it. These aspects have to be balanced against the difficulty of protecting shared resources, which is much easier in single-threaded programs. It's a complexity tradeoff that by no means always favors the single-threaded solution. It's possible to decide in favor of a multithreaded solution even when performance is not a factor at all.
    4. Re:It's not trivial, and often not necessary by Breakfast+Pants · · Score: 1

      Since when is 'select' some clever thing, only clever people can figure out?

      --

      --

      WHO ATE MY BREAKFAST PANTS?
    5. Re:It's not trivial, and often not necessary by try_anything · · Score: 1

      select() only handles input that arrives through file descriptors. If you have to handle many different kinds of events, you have to go around polling all the possible places where they could arrive. Or, I suppose you could provide a wrapper for every single kind of input event that channels the events through file descriptors, so you could use select for everything.

      Even then, you have to come up with a way of making sure you don't spend too much time on one task. Basically, you have to reimplement task-switching and process scheduling to avoid one computationally expensive task highjacking the program and making it unresponsive. Why not let the operating system or threading library handle that?

    6. Re:It's not trivial, and often not necessary by nahdude812 · · Score: 1

      Part of the lack of triviality is the difficulty in debugging. In sequential programming, the program's operations happen in the same order every time. In parallel programming they might happen in a certain order 99% of the time, and in a different order 1% of the time.

      At least with the procedural and OO languages that we primarily use today, it can be very nearly impossible for even the most veteran of programmers to correctly identify all of the potential race conditions which can happen.

      Unless you are using a functional language, you simply aren't going to be able to avoid race conditions. I don't have much experience in this venue other than with XSLT. Functional languages are by nature inherently parallelizable without additional developer considerations.

      Interestingly most of what is considered parallel programming today is actually a whole lot of serial functions operating in parallel. It's this mix of systems which leads to the race conditions which are in my book why "parallel" programming isn't more main-stream.

    7. Re:It's not trivial, and often not necessary by Duhavid · · Score: 1

      I guess I must be ungeneral, because I enjoy multi-threaded programming.

      I wish I was doing more of it.

      --
      emt 377 emt 4
  6. Not justifyable by dj245 · · Score: 3, Interesting

    I can see this going down in cubicles all through the gaming industry. The game is mostly coming together, the models have been tuned, textures drawn, code is coming together, and the coder goes to the pointy haired boss.

    Coder: We need more time to make this game multithreaded!
    PHB: Why? Can it run on one core of a X?
    Coder: Well I suppose it can but...
    PHB: Shove it out the door then.

    If flight simulator X is any indication (a game that should have been easy to parallize) this conversation happens all the time and games are launched taking advantage of only one core.

    --
    Even those who arrange and design shrubberies are under considerable economic stress at this period in history.
    1. Re:Not justifyable by lmpeters · · Score: 1

      If flight simulator X is any indication (a game that should have been easy to parallize) this conversation happens all the time and games are launched taking advantage of only one core.

      How about Adobe Creative Suite 3? The professionals using it are the most likely to buy quad- or 8-core systems, but CS3 only supports up to two cores.

    2. Re:Not justifyable by Grave · · Score: 4, Insightful

      I seem to recall comments from Tim Sweeney and John Carmack that parallelism needed to start from the beginning of the code - IE, if you weren't thinking about it and implementing it when you started the engine, it was too late. You can't just tack it on as a feature. Unreal Engine 3 is a prime example of an engine that is properly parallelized. It was designed from the ground up to take full advantage of multiple processing cores.

      If your programmers are telling you they need more time to turn a single-threaded game into a multi-threaded one, then the correct solution IS to push the game out the door, because it won't benefit performance to try to do it at the end of a project. It's a fundamental design choice that has to be made early on.

    3. Re:Not justifyable by Anonymous Coward · · Score: 0

      If you don't leave some juicy features for next revision CS4, your customers won't run in the upgrade threadmill...

    4. Re:Not justifyable by Splab · · Score: 1

      Not only do you have to design your code around it, you also need to make sure that every single library you link against is thread safe and that is quite hard to do.

    5. Re:Not justifyable by SlowMovingTarget · · Score: 1

      There's a giant "it depends" here. If you optimize code for multi-core processors and run it on an older generation machine with on single-core processor, you actually incur a performance penalty. My guess is that the decision for FS X had more to do with an estimate of market penetration for dual-core machines than a PHB pushing something out the door in an unfinished state.

      In all likelihood, they took a look at their choices--get crappy performance now, and better performance when everyone has dual-core, or have reasonably good performance now and reasonably good performance later (even without full CPU utilization, the processors will be faster)--and made an economically reasonable call.

    6. Re:Not justifyable by LarsWestergren · · Score: 2, Insightful

      PHB: Why? Can it run on one core of a X?
      Coder: Well I suppose it can but...
      PHB: Shove it out the door then.


      I think the PHB may have a point. Games are expensive to make, gamers are fickle, and if reviews say a game "looks dated" it is a death sentence for sales. Rewriting an engine to be multi-threaded after it is done will take a lot of time and money, and most PCs out there have more dated hardware than you think, so most current players won't see any benefints whatsoever from it anyway.

      --

      Being bitter is drinking poison and hoping someone else will die

    7. Re:Not justifyable by mpe · · Score: 1

      How about Adobe Creative Suite 3? The professionals using it are the most likely to buy quad- or 8-core systems, but CS3 only supports up to two cores.

      This demonstrates one of the problems with writing parallel programs. It's difficult to write for an arbitary number of "cores". Even though 4 and 8 are multiples of 2. There is also the issue that an application shouldn't have to know details about the physical hardware/it should be capable of running in a virtual machine which may or may not have any similarity to the actual hardware.

    8. Re:Not justifyable by lmpeters · · Score: 1

      A while ago, I wrote a program that used several computers in parallel to generate a Mandelbrot set. Because of how it divided up the work, it could easily scale to any number of computers (although I never tried it with more than four). In theory, the same algorithm could also scale to any number of processors on a single computer.

      Now, I don't know if the Mandelbrot set is the best example, but it seems to me that it shouldn't be that hard in general to write graphics applications that would scale to an arbitrary number of processors.

    9. Re:Not justifyable by smallfries · · Score: 2, Informative

      Given that it is an example of an embarrasingly parallel algorithm, like ray-tracing. No, it is not the best example. The difficulty in parallel programming is trying to divide up the work when your sub-problems are not entirely independent of each other.

      --
      Slashdot: where don knuth is an idiot because he cant grasp the awesome power of php
    10. Re:Not justifyable by julesh · · Score: 1

      Almost all graphics algorithms are embarrasingly parallel. That's why you'll find your GPU is essentially a highly parallel processor, with insane numbers of simple cores all operating (largely) independently of each other. For instance, a GeForce 8800 GTX has 128 stream processors and 32 texture processors; each of these is essentially a customised (although not particularly powerful) processor optimised to perform a particular task.

    11. Re:Not justifyable by shplorb · · Score: 1

      If you can't get that information and the source from the vendor then what the hell are you doing using that library?

    12. Re:Not justifyable by DragonWriter · · Score: 1

      If you can't get that information and the source from the vendor then what the hell are you doing using that library?
      I don't think getting the information is the problem, I think the problem is that when you get the answer to the "is this library thread safe?" question, its often "No." It may not be so much that it is harder to program things for parallelism as that there is a lot more material to build on if you aren't trying to go for parallelism, or only using it in a very restricted way. Building from the ground up is a lot more work. OTOH, I think that that problem takes care of itself over time: as more applications implementing parallelism are built, more support libraries will be built, and the difficulty of building parallel apps will drop. Its only rather recently that multicore consumer machines have become popular justifying designing consumer apps to take advantage of that capacity, so that hasn't had time to happen yet.
    13. Re:Not justifyable by PB_TPU_40 · · Score: 1

      If you're just referring to the initial release, then yes you are correct. It should have been multi-threaded, and Service Pack 1 for FSX proves that by taking advantage of dual and quad core systems.

      Please note FSX is now multi-threaded. From release to patch it was 6 months. That being said, that would have been six months without sales and income. If it can run on a single core, and a majority of the code is written to be parallel, modifying it after release could actually be more beneficial to a cost benefit point of view. It's the equivalent of adding a feature after release.

      Any product being delayed out the door risks whats called "loosing the window." Where by after you miss that window, projected profits from the product start decreasing.

      FSX certainly shows that some things may be shoved out the door before being multi-threaded, however thats no reason to flip out and say it was released too soon. The evidence that it was released too soon was the frame rate problems on even high end systems, and a memory problem.

      Just my two cents.

      --
      -PB_TPU_40 The trick to flying is to throw yourself at the ground and miss.
    14. Re:Not justifyable by Anonymous Coward · · Score: 0

      Although UE3 is doing a decent job at it, I don't think it qualifies as an example of doing things right.
      UE3 added multi-threaded rendering under a year ago to the engine (some games shipped without it). That's not built from the ground up. Nothing else in the engine is multi-threaded (Apart from the physics, but that was done by Ageia). There are absolutely no multithreaded primitives other than locks/mutexes. No job manager. Good, but not exactly first in class.

  7. Are Serial Programmers Just Too Dumb? by ArmorFiend · · Score: 4, Interesting

    For this generation of "average" programmers, yes its too hard. Its the programming language, stupid. The average programming language has come a remarkably short distance in the last 30 years. Java and Fortran really aren't very different, and neither is well suited to paralellizing programs.

    Why isn't there a mass stampede to Erlang or Haskell, languages that address this problem in a serious way? My conclusion is that most programmers are just too dumb to do major mind-bending once they've burned their first couple languages into their ROMs.

    Wait for the next generation, or make yourself above average.

    1. Re:Are Serial Programmers Just Too Dumb? by Anonymous Coward · · Score: 0

      "Java and Fortran really aren't very different, and neither is well suited to paralellizing programs."

      Maybe you haven't seen the latest Fortran 2003 standard? Even Fortran 95 had parallel constructs.
      Fortran is still the most widely used parallel and high-performance computing language.

    2. Re:Are Serial Programmers Just Too Dumb? by QuantumG · · Score: 1

      Why isn't there a mass stampede to Erlang or Haskell, languages that address this problem in a serious way? Ummm, because just writing a simple game like tic-tac-toe or Tetris is considered worthy of scientific papers?

      People who feel a need to coin terms like Functional Reactive Programming and develop 40 different "frameworks" to shoehorn event processing into a functional environment are the reason why these languages are shunned by people who just want to get work done.

      --
      How we know is more important than what we know.
    3. Re:Are Serial Programmers Just Too Dumb? by coolgeek · · Score: 1

      My conclusion is that most programmers are just too dumb to do major mind-bending once they've burned their first couple languages into their ROMs. I think it's more that most programmers are just too dumb to try a different paradigm for designing their code. "WAAAH IT'S TOO HARD!" I dunno. Maybe I'm different. I got my first job as a programmer in 1984, working on multiprocessor machines.
      --

      cat /dev/null >sig
    4. Re:Are Serial Programmers Just Too Dumb? by Opportunist · · Score: 2, Interesting

      That's maybe due to most programmers nowadays not being programmers but people who learned how to write code. When the IT biz was the make-money-fast scheme, people picked up any kind of computer skill that more or less fit them, some went into web based programming since that's where the really big bucks were, they learned PHP and a few tidbits of logic.

      Then dot.com blew up and they were dead in the water. Today you need a fraction of the PHP artists that were sought after in 2000. So they picked up C, in a sorta-kinda-way, since it's "about the same" and now they push into the programming market as cheap workforce.

      Well, you get what you pay for.

      --
      We used to have a Bill of Rights. Now, with the rights gone, all we have left is the bill.
    5. Re:Are Serial Programmers Just Too Dumb? by Goalie_Ca · · Score: 1

      I'm learning haskell. It is a complete 180 in terms of thinking from a standard imperative language. I think to truly appreciate haskell you must have a solid appreciation for mathematics in general because as far as programming languages go, haskell is pretty pure. The underlying theory is rather elegant but takes a lot of work to appreciate. That said, i do not yet have the necessary mental process required to write a "real-world" application in haskell however i find it brilliantly simple to write elegant and bug-free one-line functions that do rather complicated tasks. The string parsing capabilities are top notch but i have yet to scratch the surface.

      --

      ----
      Go canucks, habs, and sens!
    6. Re:Are Serial Programmers Just Too Dumb? by Jessta · · Score: 1

      I've been programming(not professionally) for 10 years.
      Mostly in C, Python, ECMAscript and Java. I've been recently trying to get in to functional programming after reading a really interesting article: http://www.defmacro.org/ramblings/fp.html. I really liked the concepts.

      I started by looking at Erlang and Haskell, but I just don't like their syntax which made it really difficult to stay motivated in learning. Thinking functionally was pretty easy, but thinking functionally to do something that involves state is confusing.

      I've recently been looking at scheme and using ECMAscript functionally, which I like the syntax of more.

      --
      ...and that is all I have to say about that.
      http://jessta.id.au
    7. Re:Are Serial Programmers Just Too Dumb? by bughouse26 · · Score: 1

      Java/C++/OO programmers are too used to being babied and having the compiler deal with their dirty work. Turns out monitors and synchronized { } suck. Learn pthreads or quit bitching.

    8. Re:Are Serial Programmers Just Too Dumb? by AuMatar · · Score: 1

      Because functional programming makes it extremely difficult to do things that OOP and procedural can do very simply. Stateless isn't a benefit, its a defect. Real life has state. Most workflows you use a computer for require state. Even a simple event like posting this answer requires state- state to store my session info (on both ends). THere's a reason that functional languages are used only in the realm of mathematics- its not suitable anywhere else.

      --
      I still have more fans than freaks. WTF is wrong with you people?
    9. Re:Are Serial Programmers Just Too Dumb? by gnalre · · Score: 1

      Wrong,Wrong and Wrong again.

      Remember we are taliing parallel programming here. History and experience has shown that OOP/procedural are not the best way to write such applications. There are just to many ways to go wrong and when they do it is incredibly difficult to debug.

      You do maintian state with functional programs, but instead of storing is in a variable you pass it between functions. This makes it thread and process safe.

      Erlang is used all over the place. Especially in applications which involve large numbers of low cost threads such as telecoms.

      --
      Choose your allies carefully, it is highly unlikely you will be held accountable for the actions of your enemies
    10. Re:Are Serial Programmers Just Too Dumb? by Da+Fokka · · Score: 1

      Remember we are taliing parallel programming here. History and experience has shown that OOP/procedural are not the best way to write such applications. There are just to many ways to go wrong and when they do it is incredibly difficult to debug.

      You do maintian state with functional programs, but instead of storing is in a variable you pass it between functions. This makes it thread and process safe.

      You can do this with OO/Procedural programming as well you know. And a similar technique, immutable objects can go a long way to make a program thread-safe. The best way to prevent thread-related bugs is by having a design that is inherently resistant to these problems. That's a lesson that functional programming learned us. But although functional languages are good at representing algorithms and reasoning about them, they are horribly unproductive when it comes to most real-world applications (the ones with a GUI, for instance). So let's take the lessons from functional programming and apply them to a language that actually is productive and you've got yourself a ballgame.

    11. Re:Are Serial Programmers Just Too Dumb? by jdh41 · · Score: 1

      Actually, Fortran can be quite good at parallel stuff. It just depends on the type of parallelism, I'd take its multi-threaded approach sucks a bit [like most explicit multi-threading], however if you rely on loop vecotrization Fortran 90 is ahead of the game with its explicit loop handlers (forall, array assignment) and reduction statements (sum, count, ...) allowing a compiler to take explicit advantage of such especially on SMP systems. Its possibly worth noting that a lot of parallel programs already exists in the form of academic codes in the languages you mention, its not new for anything but the mainstream desktop.

    12. Re:Are Serial Programmers Just Too Dumb? by LarsWestergren · · Score: 1

      Why isn't there a mass stampede to Erlang or Haskell, languages that address this problem in a serious way? My conclusion is that most programmers are just too dumb to do major mind-bending once they've burned their first couple languages into their ROMs.

      Mhm. I'm sure it has nothing to do with functional programmers being so humble and welcoming to the rest of us. I feel so motivated to getting anywhere near people like you waving their e-peen around.

      --

      Being bitter is drinking poison and hoping someone else will die

    13. Re:Are Serial Programmers Just Too Dumb? by igomaniac · · Score: 1

      I have a little experience with Haskell, extending a first order logic theorem prover as part of a university course. It's a beautiful language for research, but to write something like an A-title computer game (which I have done professionally) in a language like this is simply not possible with the tools that currently exist. It's extremely hard to predict the performance of a given piece of code, and there are no profilers or serious debuggers available. It can be extremely difficult to figure out someone else's code (because you can be exceedingly clever, which is brilliant when you're programming alone) so it's not really good for large teams. And finally, you'd have to develop your own bindings to all kinds of software libraries (OpenGL, MPI, physics solvers, compression libraries... ). In the end it's just not worth the hassle, with C++ you have way more mature tools and you can get the job done quicker.

      --

      The interactive way to Go -- http://www.playgo.to/iwtg/en/
    14. Re:Are Serial Programmers Just Too Dumb? by arevos · · Score: 1

      Because functional programming makes it extremely difficult to do things that OOP and procedural can do very simply. A minor nitpick; a language can be functional and object orientated, such as Scala or OCaml.

      Stateless isn't a benefit, its a defect. Real life has state. Most workflows you use a computer for require state. Even a simple event like posting this answer requires state- state to store my session info (on both ends). Functional programming languages do not forbid the use of state; they merely require that the programmer pass state around explicitly, rather than it being an implicit part of the environment. State is often a necessary evil, but it causes a lot of problems. Stateful functions are harder to make concurrent, harder to test, and harder to rigorously type. Functional programming discourages the use of states use whenever possible, and attempts to separate it out in the cases when it is required.

      Frankly, this seems a rather sensible idea to me.

    15. Re:Are Serial Programmers Just Too Dumb? by TeknoHog · · Score: 1

      Actually, Fortran can be quite good at parallel stuff. It just depends on the type of parallelism, I'd take its multi-threaded approach sucks a bit [like most explicit multi-threading], however if you rely on loop vecotrization Fortran 90 is ahead of the game with its explicit loop handlers (forall, array assignment) and reduction statements (sum, count, ...) allowing a compiler to take explicit advantage of such especially on SMP systems. Its possibly worth noting that a lot of parallel programs already exists in the form of academic codes in the languages you mention, its not new for anything but the mainstream desktop.

      I agree completely. In this discussion, people should note that there are different kinds of parallelism, and Fortran 90 has solved the problems of data-level parallelism (e.g. matrix math) a long time ago.

      I just find it strange that people see parallelization as a recent problem that only came up when AMD and Intel introduced multicore x86. Multiprocessor systems have been used for decades and I thought the basic problems were already solved.

      --
      Escher was the first MC and Giger invented the HR department.
    16. Re:Are Serial Programmers Just Too Dumb? by arevos · · Score: 1

      But although functional languages are good at representing algorithms and reasoning about them, they are horribly unproductive when it comes to most real-world applications (the ones with a GUI, for instance). Care to justify that statement?
    17. Re:Are Serial Programmers Just Too Dumb? by arevos · · Score: 1

      Haskell is used by many as a springboard through which to research programming language design and computer science, so it should come as little surprise that there are many different experimental extensions to the language.

      It is a language not without its disadvantages, but every language has its weaknesses, and that should not blind you to their strengths.

    18. Re:Are Serial Programmers Just Too Dumb? by drgonzo59 · · Score: 1
      That said, i do not yet have the necessary mental process required to write a "real-world" application

      Don't worry it's not you, it's the "real world".

      One of the reasons is that real-world is often full of state and the state is easier to represent when it's explicit and not hidden in the function parameters/the stack. Of course there are different problems and my "real-world" is not your "real-world" but I think in general not everything is a function/a list/ a predicate/ and yes, an object. There is no holy grail. Some problems can be expressed easier if you think in terms of functions, some if you think in terms of predicates (i.e. logic programming a la Prolog), and of course the all too popular objects.

      The trick is to recognize the most efficient and clear representation and if there isn't one, it's time to roll your own language. Google did it , Microsoft did it for the Office. That's sort of the next level of development -- making your own language to fit your problem/solution domain best

    19. Re:Are Serial Programmers Just Too Dumb? by Aceticon · · Score: 1

      Java and Fortran really aren't very different, and neither is well suited to paralellizing programs.

      Actually in Java it's extraordinarilly easy to do things like spawning new threads and fine grained synchronizing of multiple threads.

      Here's a simple example multithreaded Java app:

      public class MultiHello {
          public static void main(String args[]){
              (new Thread(new Runnable(){public void run(){System.out.println("Hello world!");}})).start();
              System.out.println("Goodbye world!");
          }
      }

      (it starts a new thread which just prints "Hello world!" to the console while the main thread prints "Goodbye world!")

      Even more, if you work with Enterprise Applications or Web Based interfaces in Java your code will be working in a multi-threaded environment and can be executed simultaneously by multiple threads (unless you explicitly configure it otherwise).

      The problem is not the suitability of the language for multithreading but the quality of the programmers:
      - There's a whole generation of Java developers out there which wouldn't recognize a mutator if it bit their asses (even though in Java when you use the keyword "synchronized" you're using a mutator). And let's not even start talking about semaphores ...

      Many of the latest crop of Java developers have never done C, never worked with multiple processes and never really understood the nitty gritty details of how multithreading works in Java. Most are in one of two groups:
      - Blissefully unaware that their code is working in a multithreaded environment - many of those doing Servlets and JSP pages (web-based UIs) are not even aware that their code can be called by multiple threads simultaneously.
      - Blindly using the "synchronized" keyword in all their functions (a syhcronized function on an Object can only be accessed by one thread at a time) - thus, often needlessly, removing any and all possibility of serialization in their programs (or worse, their libraries).

      Proper multi-threaded programming in Java isn't easy but it isn't that hard either. I recommend the following:
      - Read a good book about it ("Concurrent Programming in Java: Design Principles and Patterns" from Sun is good)
      - Think before you act! A little bit of up-front design (even if only in your mind) makes a lot of difference on the results.
      - Exercise a bit of discipline and restraint. (do you really need to make a variable an object variable when it's only used as a temporary variable inside functions; do you really need to keep variables in an algorithm implementation Object when it's perfectly feasible to pass the input values as function parameters; why syncronized a method which does not write into object or class variables?)

    20. Re:Are Serial Programmers Just Too Dumb? by 808140 · · Score: 1

      I'm not sure where you get this idea. The folks I've met in the functional programming community were extremely helpful and friendly. But functional programming is a fundamentally different paradigm, and it is definitely more difficult for people with an imperative background (99% of programmers who aren't also mathematicians, I'd wager) to master. The importance of concepts from relatively technical branches of CS and Math don't help to lower the barrier, either.

      The GP's comment about how most programmers are just too dumb was perhaps not in good taste, and was probably born of his frustration with people's unwillingness to consider functional solutions to many of these problems to which they appear ideally suited.

      Having said that, it is definitely true that most "programmers" today are not as competent or intelligent as the CS geeks of yesteryear, who managed to just as much or more with less resources and without the benefit of the internet to provide them with cookbook solutions to their problems. Essentially, the barrier to entry was higher in the old days -- no one can deny that. Since then, though, programming has become more mainstream, much of what the programmer wants to do has already been done, etc. It's gotten easier, mainly because we better understand the problem space much better now. Functional programming is not quite this mainstream, yet.

      The problem, perhaps, is a combination of two things: these days much of the active research in CS is happening in the functional space, and conversely not much wide-scale application development is happening in the functional space. This means that the functional programming beginner is exposed very quickly to rather daunting subjects that are an active area of PL research, which he may find intimidating. He is also not exposed much to subjects that he's familiar with from the imperative space, like writing a GUI chat client or similar. Someone on #haskell joked once that Haskell was the only programming language where research papers are linked in the "Introduction to Haskell" section of the webpage.

      I don't think that it's unfair to say that most programmers are not quite cut out to digest papers that use Haskell to tackle problems from category theory, for example.

      But contrary to the impression that a beginner to a language like Haskell may get, you don't actually need to understand these topics to do things like write a GUI chat program, and Haskell is perfectly well suited to these more standard applications. It's just that most Haskell-heads are more interested in research than application development, so examples of the former abound whereas examples of the latter are few and far between.

    21. Re:Are Serial Programmers Just Too Dumb? by 808140 · · Score: 1

      Plus, languages like Haskell use monads to abstract away the state passing, so you can pass state from function to function without even being aware you're doing it, much as you would with a global variable in an imperative language. But state monads give you all the benefits of having a global variable without any of the drawbacks, because you are actually passing thet state into the function and returning it, it's just hidden by the bind operator. So functions are still referentially transparent!

    22. Re:Are Serial Programmers Just Too Dumb? by DannyO152 · · Score: 1

      I'm working though learning Haskell as well. I started work on a sudoku game program and made some progress, but it was going to be command line only, the code looked a little long (and it wasn't near finished), and my algorithms seemed inefficient, so, I set the program aside to do some more woodshedding. Regarding inefficiency, since we were talking about 81 cells, this was okay, but, one technique for getting O(1) access to a cell would be using arrays and these seem to be a data structure of last resort.

      Before I could start applying it to work issues, I would need to nail down how a program communicates with a database back end, draws and handles an mvc gui, and generates xml. I've found some libraries, but, to be honest, if someone asked me to do something on the clock, I'd have to go with java because I'm so much more facile with all the libraries for what I do.

      Another real problem is that I'm just too used to thinking of state, and, in my layman mostly-ignorant way of thinking, it is side-effect state change that degrades the program's ability to parallelize cleanly.

    23. Re:Are Serial Programmers Just Too Dumb? by Junks+Jerzey · · Score: 1

      Why isn't there a mass stampede to Erlang or Haskell, languages that address this problem in a serious way? My conclusion is that most programmers are just too dumb to do major mind-bending once they've burned their first couple languages into their ROMs.

      Because, quite honestly, and this very rarely gets pointed out, Erlang and Haskell can be awkward to program in. For concurrency, Erlang is wonderful. For algorithmic beauty--for some types of algorithms--Haskell is oh so pretty. But for other things that would be a doddle in C, both Erlang and Haskell are bears to work with. Try doing array or matrix work in Erlang, for example. Try writing something that would map well to an OOP language, something involving many "actors" that have dozens of frequently updated state variables, in Erlang. While you can do it, it's awkward, just like doing text processing in Pascal is so clunky in comparison to Perl.

    24. Re:Are Serial Programmers Just Too Dumb? by Anonymous Coward · · Score: 0

      For this generation of "average" programmers, yes its too hard.
      This generation's average programmer is maintaining the previous generation's code. There's no time or space for improvement.
    25. Re:Are Serial Programmers Just Too Dumb? by smellotron · · Score: 1

      C++ doesn't put any parallelization dirty-work onto the compiler, and we C++ programmers still use pthreads. Or do you come from some magic fairy-land where C++ programmers can't use extern "C"?

    26. Re:Are Serial Programmers Just Too Dumb? by smellotron · · Score: 1

      Functional programming discourages the use of states use whenever possible, and attempts to separate it out in the cases when it is required.

      If you're at all familiar with Design Patterns (the book or the concept), I'd like to point you towards Domain-Driven Design. In particular, "Side-Effect-Free Function" and "Value Object" are two patterns for imperative programming languages that discourage unnecessary state-dependence. One of the requirements for effective unit-testing in imperative languages is the ability to reduce state-dependence (it's much safer to test return values of objects than to try to test internal state).

      Maybe it's just a little bit of the functional-programming mentality getting absorbed into the mainstream (OO/imperative), but the goal of reducing side-effects is increasingly common with modern software engineering methodologies

    27. Re:Are Serial Programmers Just Too Dumb? by Anonymous Coward · · Score: 0

      Why isn't there a mass stampede to Erlang or Haskell...

      Check http://www.dice.com/ for reasons why developers are falling over themselves to do either..

      My conclusion is that most programmers are just too dumb to do major mind-bending once they've burned their first couple languages into their ROMs.

      I know plenty of wannabe developers who fall into this category, but they don't last long in the industry, tech changes to quickly for them. Just look at the way the Java APIs have changed over the past 5 years.

      Also most programmers out of school for more than a couple of years don't care about the current academic fad language.

    28. Re:Are Serial Programmers Just Too Dumb? by simon_clarkstone · · Score: 1

      Because functional programming makes it extremely difficult to do things that OOP and procedural can do very simply. Stateless isn't a benefit, its a defect. Real life has state. Most workflows you use a computer for require state. Even a simple event like posting this answer requires state- state to store my session info (on both ends). There's a reason that functional languages are used only in the realm of mathematics- its not suitable anywhere else. You can write imperative code just fine in Haskell, with the occasional requirement to be more explicit about something than in an ordinary imperative language (e.g. distinguishing passing around a variable from passing around the value it had at a particular time). One should not be forced to do imperative programming without first-class variables, first-class imperative actions, and first-class program state. Full STM, channels, and MVars are great for parallelism. Those things are what you get in return for your slight extra explicitness about what you want, and many of the repetative bits have already been wrapped up in monad combinators.
      --

      C:\>spell -b slashdot_submission.txt
      Bad command or file name.
    29. Re:Are Serial Programmers Just Too Dumb? by arevos · · Score: 1

      Maybe it's just a little bit of the functional-programming mentality getting absorbed into the mainstream (OO/imperative), but the goal of reducing side-effects is increasingly common with modern software engineering methodologies More than just a little; the defining feature of a functional language is a language that attempts to avoid mutable state. If the goal of reducing side-effects is becoming increasingly more common, then I'd say languages are becoming more functional in nature.
    30. Re:Are Serial Programmers Just Too Dumb? by Anonymous Coward · · Score: 0

      You're missing the point. We WANT to get away from OOP with doezens of frequently updatable state variables, since THEY are the whole problem in the first place!

      You can't say "X is not a solution to problem P, because it doesn't allow you to do things which result in P", that's the whole point of X!

      I recommend you take another look at Haskell. None of your criticisms are valid, frankly (presumably based on ignorance). Pay particular attention to the ST and STM monads, and the concurrency library.

    31. Re:Are Serial Programmers Just Too Dumb? by h4ck7h3p14n37 · · Score: 1

      Perhaps I'm mistaken, but I thought a mutator (as in accessors and mutators) was something that changed the state of the object? Typically a method called something like setProperty() in Java. Also doesn't the synchronized keyword simply mark the entire method as a critical region? The JVM obtains a lock on the object, executes the method and then releases the lock.

      See also:

      1. http://en.wikipedia.org/wiki/Mutator
      2. http://www.janeg.ca/scjp/threads/synchronization .html
    32. Re:Are Serial Programmers Just Too Dumb? by Raenex · · Score: 1

      I'm not sure where you get this idea. The folks I've met in the functional programming community were extremely helpful and friendly. Yeah, like calling people "too dumb" is friendly. I've seen this attitude over and over again. Here's a perfect example: http://www.defmacro.org/ramblings/concurrency.html

      Note that the author springs the idea of Erlang and message passing concurrency on interview canditates, and gets all haughty when they don't immediately understand how it works. And yet, he says about himself:

      "In the case I'm about to describe, the difference between me and the people I've interviewed was that I was fortunate enough to stumble upon the right resources supported by a reasonably persistent group of advocates."

      So he would have been exactly like the people he's interviewing, but he spent a lot of effort and climbed the mountain. Yet he acts like a jerk when giving interviews and writing about them later. This attitude is very common. I understand it, it's human nature (as described by Paul Graham and "Blub"), but ultimately unhelpful and a turnoff. These "Blub" programmers aren't stupid. It's just hard to come to grips with a dramatically different way of doing things, after multiple years of C-style imperative programming.

      In defense of the blogger, he actually has a much better article that describes his turmoils when trying to "get" Lisp and macros. In that article, he doesn't denigrate the target -- instead, he uses relevant examples: http://www.defmacro.org/ramblings/lisp.html/

      By the way, the people on #haskell are friendly and helpful, but now and then some of the hard-core advocates exhibit the above behavior.
    33. Re:Are Serial Programmers Just Too Dumb? by Raenex · · Score: 1

      Proper multi-threaded programming in Java isn't easy but it isn't that hard either. Yeah right. Is it easy to make a threading mistake? Does the compiler warn you when you make a threading mistake? Do you get bugs that don't occur in testing, but occur in production under heavy load? Are the bugs easily reproducible? Is it easy to reason about code in the presence of threads? Is the Java library clear about what code is thread-safe and what isn't? Is your code?
    34. Re:Are Serial Programmers Just Too Dumb? by Aceticon · · Score: 1

      Read the book i recommended.

      There's a huge number of good practices which majorly decrease the chances of critical races and deadlocks. Actually, most of those are used in the standard Java classes.

      Things like read-only objects (for example Strings); passing the state around as State objects which are inputs to methods of Objects which act based on the state; stateless Objects such as Algorithm objects; and more, much more.

      It also helps a lot if you have a proper Object Oriented design were Containement of Information and Clear Separation of Responsabilities have been worked payed proper attention - if each data category is only contained in a specific type of container object and only changed via a small number of well define pathways, then the place(s) to put your synchronized blocks to control multi-threaded access to that data is(are) obvious.

      Multi-threading must to be worked into the design of the software: considering the multithreading issues only at development time is a painfull and unrewarding task (as you seem to have discovered).

      I never said it was easy - i only said it wasn't that hard ;)

    35. Re:Are Serial Programmers Just Too Dumb? by Raenex · · Score: 1

      I understand that the way to keep any kind of sanity when doing multithreading is to keep the communication between threads well defined and to use immutable objects. Basically what you are recommending is Erlang, but instead of the Actor model you are still using shared locks and an imperative language that doesn't even have a proper const (final is weak). The problem is you have to be religious in your design, the language doesn't help you, and you will eventually make a mistake that will be a pain in the ass to track down.

      So I vehemently disagree with all the posts that say it isn't that hard, that we just need really smart/educated/careful programmers. There are other approaches to concurrency that are much better than threads and locks, and they should be pushed as the default way to do concurrency.

    36. Re:Are Serial Programmers Just Too Dumb? by Da+Fokka · · Score: 1

      Care to justify that statement?


      Of course. Although functional languages are great at specifying and evaluating algorithms which are at the heart of a program, these algorithms usually take up a small percentage of the total work on the program. The rest is business logic, a GUI, database connectivity, etc., which are most easily tackled by a procedural, object-oriented language.

    37. Re:Are Serial Programmers Just Too Dumb? by arevos · · Score: 1

      Of course. Although functional languages are great at specifying and evaluating algorithms which are at the heart of a program, these algorithms usually take up a small percentage of the total work on the program. The rest is business logic, a GUI, database connectivity, etc., which are most easily tackled by a procedural, object-oriented language. But you haven't explained why business logic, GUIs, etc. are more suited to imperative OO languages. Could you provide a pseudo-code example which you think would be difficult to emulate in a functional language?
    38. Re:Are Serial Programmers Just Too Dumb? by coolgeek · · Score: 1

      The .com era was the 3rd massive expansion followed by contraction in the computer industry. The previous two contractions seemed to send all the wannabes packin. I guess we didn't quite shake off that last bit of riff-raff that infiltrated our industry.

      Nice sig. Proper use of the 'Soviet Russia' construct.

      --

      cat /dev/null >sig
    39. Re:Are Serial Programmers Just Too Dumb? by Opportunist · · Score: 1

      I doubt we can shake off the ballast easily this time. The industry won't let us.

      Let's face it, it's never been this easy to write a program. You don't have to understand anymore what a computer does. Pretty much everything is abstracted in ways that most people grasp now. You don't have to deal with stacks (and cleaning them up), you don't have to know what indirect addressing is, you don't have to deal with code optimization.

      I've seen a trend towards VB (and now C#) in many business applications, not because it speeds up development, but because it allows you to hire less qualified (and thus cheaper) programmers. I've seen people develop ocx "libraries" who don't know what COM is or what OLE stands for. They knew that they have to set the compiler to do this or that, and that this will, most of the time at least, produce something they can work with. How it works, why it works, and what they should do when it doesn't? They didn't know.

      This creates, of course, rather ugly hacks when it doesn't work and they start fiddling around with the underlying framework, freeze version numbers 'cause they noticed when the ver changes it "breaks" (so everything had the same version number for about 3 years now) and so on. In other words, the huge advantage offered by COM was turned into a disadvantage...

      And those people are here to stay. Let's be honest, it is a pretty "comfortable" industry we're in. Your boss doesn't have an idea what you do or what you can do, so you get more leeway than those accountants and even marketing. The average HR guy has no idea what to make off the list of things you can do, so he resorts to counting items of things you can do when trying to determine how good you are. Unfortunately, this works in their favor.

      --
      We used to have a Bill of Rights. Now, with the rights gone, all we have left is the bill.
    40. Re:Are Serial Programmers Just Too Dumb? by Da+Fokka · · Score: 1

      But you haven't explained why business logic, GUIs, etc. are more suited to imperative OO languages. Could you provide a pseudo-code example which you think would be difficult to emulate in a functional language?

      In my first year of CompSci I had to program the game of Hangman in Miranda, which was considerably more difficult to do than the Java version, which had an actual GUI instead of a command line.

      Functional programming languages describe how a certain problem is structured. Procedural languages describe the steps to solve that problem. For many things like validating forms, applying business rules, etc., that latter is a more straightforward approach.

      Another difference is that the development environments for OO languages are very mature. Creating a GUI using Eclipse, VS.NET or Delphi is as easy as point-and-click. I know of no such environment for Haskell.

      I am aware that the last argument has little to do with the language per se, but languages don't exist in a vacuum and when talking about productivity the tools are an important factor.

    41. Re:Are Serial Programmers Just Too Dumb? by arevos · · Score: 1

      Functional programming languages describe how a certain problem is structured. Procedural languages describe the steps to solve that problem. For many things like validating forms, applying business rules, etc., that latter is a more straightforward approach. I'd argue it's more a question of mindset. Do you have more experience programming in functional languages, or in procedural ones? If the latter, is it any wonder that programming in a functional language seems more difficult?

      Also, perhaps the differences are less pronounced than you think. For instance, in Python, we might write:

      def main():
          print "What is your name? ",
          name = raw_input()
          print "Hello " + name
      Which could be written in Haskell as:

      main = putStr "What is your name? " >> getLine >>= (\name -> putStrLn ("Hello " ++ name))
      But with a little syntactic sugar, courtesy of Haskell's do-notation:

      main = do
          putStr "What is your name? "
          name <- getLine
          putStrLn ("Hello " ++ name)
      More than a passing resemblance to the procedural Python code! So I don't think it's necessarily true that functional languages are less adept at solving these types of problems. I'd agree that Haskell is probably more difficult to learn, especially coming from a procedural background, but I'd say that was more to do with Haskell's type system more than it's functional approach. Haskell's type system is powerful and strict to such a degree that it makes languages like Java look almost weakly typed in comparison, but in return for this extra complexity at compile time, there tend to be far fewer runtime bugs.

      Another difference is that the development environments for OO languages are very mature. Creating a GUI using Eclipse, VS.NET or Delphi is as easy as point-and-click. I know of no such environment for Haskell. This is true, however there are several functional languages designed to interoperate with existing environments. Scala, a JVM-based functional language, and F#, a CLI language, are two of the most well known. Scala has a plugin for Eclipse, so one could design a GUI graphically and write the logic in a functional language. I believe something similar is being developed for F# and Visual Studio.
  8. Programmers by Anonymous Coward · · Score: 2, Insightful

    Well, the way they 'teach' programming nowadays, programmers are simply just typists.

    No need to worry about memory management, java will do it for you.

    No need to worry about data location, let the java technology of the day do it for you.

    No need to worry about how/which algorithm you use, just let java do it for you, no need to optimize your code.

    Problem X => Java cookbook solution Y

    1. Re:Programmers by compro01 · · Score: 1

      this is probablely the reason why in my college course, they has us use assembler (on the PIC16F84A) last semester before they start on higher level stuff next semester.

      --
      upon the advice of my lawyer, i have no sig at this time
    2. Re:Programmers by __aaclcg7560 · · Score: 1

      I just graduated with an associate degree in computer programming. (This is my second associate degree from the same community college; my first degree was in General Ed in 1994.) Java is the catch all programming language where you really don't have to think about anything. I went out of my way to learn C++ even though I had to think about stuff that I never did in Java. Parallel programming was a topic that we never came across.

    3. Re:Programmers by bladesjester · · Score: 1

      After doing classes in college using C, C++, Assembly, and a host of other things then picking up Java, Ruby, and another host of other stuff, the only time I really had to worry about doing anything in parallel was multithreading things in my OS and internetworking courses.

      As a general rule, for your standard, vanilla business stuff, it just doesn't tend to come up...

      --
      Everything I need to know I learned by killing smart people and eating their brains.
    4. Re:Programmers by ZenShadow · · Score: 1

      I'd be more impressed if they had you writing long mode X86 assembler. PIC is incredibly trivial by comparison. It's like tic-tac-toe vs. Unreal Tournament, here.

      How many graduates do you know who learned a modern assembly in school?

      --S

      --
      -- sigs cause cancer.
    5. Re:Programmers by maxwell+demon · · Score: 1

      I'd be more impressed if they had you writing long mode X86 assembler.

      Long mode? What's that? I know real mode, 16 bit protected mode, 32 bit protected mode, virtual 8086 mode and "unreal mode" (this is an unofficial mode where through some tricks involving PM you have some 32-bit addressing in real mode; I don't know if this is still possible with today's x86 processors). Oh, and AFAIK newer processors also have a "system management mode", although I don't know details. But long mode I've never heared. What's that?
      --
      The Tao of math: The numbers you can count are not the real numbers.
    6. Re:Programmers by compro01 · · Score: 1

      ask and you shall find out

      system management mode being in newer is a relative term, as it has been around since the 386SL.

      long mode is something pretty recent, as it first appeared with the Opteron.

      --
      upon the advice of my lawyer, i have no sig at this time
    7. Re:Programmers by ZenShadow · · Score: 1

      64-bit mode, part of AMD64/EM64T.

      --S

      --
      -- sigs cause cancer.
  9. Did someone say paralell programming? by Anonymous Coward · · Score: 0

    It may come in useful for the numerous beowolf clusters I have imagined on slashdot.

  10. Parallel Language... by vortex2.71 · · Score: 3, Insightful

    Though there are many very good parallel programmers who make excellent use of the Message Passing Interface, we are entering a new era of parallel computing where MPI will soon be unusable. Consider when the switch was made from assembly language to a programming language - when the "processor" contained too many components to be effectively programmed with machine language. That same threshold has long since passed with parallel computers. Now that we have computers with more than 100 thousand processors and are working to build computers with more than a million processors, MPI has become the assembly language of parallel programming. It hence, needs to be replaced with a new parallel language that can controll great numbers of processors.

    1. Re:Parallel Language... by Anonymous Coward · · Score: 0

      Control great numbers? I think MPI is doing quite well on BG/L on 130K processors - surely it works pretty well. I don't imagine the typical application is going to require that many parallel threads for a long, long time. I do believe that in many cases MPI can become the 'assembler' of message-passing, and already several packages out there provide libraries to handle parallel scientific methods - look at ScaLAPACK, CHARM++, FFTW, etc.

      The real difference is between applications that have multiple tasks doing the same operations (SPMD - essentially most MPI tasks in a typical code) or parallelism that where each processor handles different aspects of an application, such as (for example) one for the AI of a game, one for user interface, one for graphics, etc. It is the latter case where I believe your analogy to the earlier switch from assembly to a higher-level language is key. Keeping track of 1000 identical tasks operating on different data is one thing, but keeping track of 1000 different tasks is a whole other beast!

    2. Re:Parallel Language... by GileadGreene · · Score: 1

      MPI is a heavyweight solution resting on top of essentially sequential languages. What is need is languages that integrate share-nothing message-passing into the language itself, in a lightweight manner. Erlang and E are good examples of that kind of approach.

    3. Re:Parallel Language... by Anonymous Coward · · Score: 0

      "I think MPI is doing quite well on BG/L on 130K processors - surely it works pretty well." Bah, the guys who won the Gordon Bell prize in 2005 on BG/L had a hell of a time with getting the thing to run. Ever tried to manage I/O on 140K processors? Think MPI All Reduce is a valid operation on Blue Gene L when you are using the whole machine? Ever wonder why the GB in 2005 was for achieving 100 Teraflops on a machine with a theoretical peak of over 300 Teraflops?

  11. Yes, difficult, but our brains are not limited. by themoneyish · · Score: 2, Insightful

    In one word, the answer is yes. It's difficult for people who are used to programming for a single CPU.

    Programmers that are accustomed to non-parallel programming environments forget to think about the synchronization issues that come up in parallel programming. Several conventional programs do not take into account synchronization of the shared memory or message passing requirements that come up for these programs to work correctly in a parallel environment.

    This is not to say that there will not be any progress in this field. There will be and there has been. The design techniques and best practices differ for parallel programming than for the conventional programming. Also currently there is limited IDE support for debugging purposes. There are already several books on this topic and classes in the universities. As the topic becomes more and more important, computer science students will be required to take such classes (as opposed to it being optional) and more and more programmers that know and are experts in parallel programming will be churned out. It's just not as popular because the universities don't currently seem to make it a required subject. But that will change because of the advancement in hardware and more market demand for expert parallel programmers.

    Our brains might be limited about other things, but this is just a matter of better education. 'Nuff said.

    1. Re:Yes, difficult, but our brains are not limited. by wellingj · · Score: 1

      Programmers that are accustomed to non-parallel programming environments forget to think about the synchronization issues that come up in parallel programming. Several conventional programs do not take into account synchronization of the shared memory or message passing requirements that come up for these programs to work correctly in a parallel environment.
      Speaking of which, I think Flash Player on Linux has a synchronization problem. I keep getting locked up every now an then on my new Core 2 Duo, where as on my old Celeron-M didn't. Go figure... I guess it could be any number of things but I'm running almost identical setup on both of them...
  12. Clusters? by bill_mcgonigle · · Score: 3, Insightful

    Since this discussion has been going on for over three decades with little progress in terms of widespread change

    Funny, I've seen an explosion in the number of compute clusters in the past decade. Those employ parallelism, of differing types and degrees. I guess I'm not focused as much on the games scene - is this somebody from the Cell group writing in?

    I mean, when there's an ancient Slashdot joke about something there has to be some entrenchment.

    The costs are just getting to the point where lots of big companies and academic departments can afford compute clusters. Just last year the price of multi-core CPU's made it into mainstream desktops (ironically, more in laptops so far). Don't be so quick to write off a technology that's just out of its first year of being on the desktop.

    Now, that doesn't mean that all programmers are going to be good at it - generally programmers have a specialty. I'm told the guys who write microcode are very special, are well fed, and generally left undisturbed in their dark rooms, for fear that they might go look for a better employer, leaving the current one to sift through a stack of 40,000 resumes to find another. I probably wouldn't stand a chance at it, and they might not do well in my field, internet applications - yet we both need to understand parallelism - they in their special languages and me, perhaps with Java this week, doing a multithreaded network server.

    --
    My God, it's Full of Source!
    OUTSIDE_IP=$(dig +short my.ip @outsideip.net)
    1. Re:Clusters? by Lost+Engineer · · Score: 1

      If multi-core chips made it into laptops first, it's because they're more efficient. You can easily shut down the second core in the OS if it's not needed, buying yourself massive power savings.

      Also as the Core Duo is the successor to the Pentium M, it's technology was already in laptops, even if they were single core. Even a dual core Core chip easily burns less juice than that dog the Pentium 4, as anyone who's ever had a Pentium 4 laptop sitting on his lap will attest to. As a side note, I also believe the Pentium 4 contributed towards the trend of huge (in screen size and weight) laptops, which now seems to be reversing itself.

    2. Re:Clusters? by Anonymous Coward · · Score: 0

      Most subtle beowulf cluster joke yet?

    3. Re:Clusters? by h4ck7h3p14n37 · · Score: 1

      Microcode? It's not too tough assuming you understand the architecture you're working with. It's also extremely simple. You're basically messing with the data and control lines on the underlying digital logic devices.

      My first course in computer architecture had us implement an ABI for an 8-bit RISC machine in microcode.

    4. Re:Clusters? by philipgar · · Score: 1

      Yes, there have been an explosion in the number of clusters etc. However these generally are running HPC applications. Many are applications that are either embarrasingly parallel, or were written tens of years ago. Many newer HPC apps also share common code bases, or use a single algorithm that was written by highly experienced coder.

      Translating general purpose applications is a lot more difficult. There is much ongoing research into the area, but little results. Mostly people have been focussing on solutions that address small portions of the problem (transactional memory), or are simply looking into designing more novel computer architectures. The problem is that the Von Neuman architecture is what everyone knows, and what comes natual. Until someone comes up with an archticture model that is as simple as this for parallel programming, it will be quite difficult for programmers to take advantage of them. The model is just unknown, and the results of programs have too much indeterminance.

      Phil

  13. Yes and no. Languages help (or hinder). by Anonymous Coward · · Score: 2, Insightful

    It's very easy to just say "Parallel programming is too hard", and try to ignore it. But consider this: the languages we use today are designed to work in the same way as the CPUs of old: one step at a time, in sequence, from start to finish.

    A special case of this is seen in the vector units found in today's CPUs: MMX, SSE, Altivec, and so forth. You can't write a C compiler that takes advantage of these units (not easily, anyway), because the design of C means that a programmer takes the mathematics and splits it up into a bunch of sequential instructions. Fortran, on the other hand, is readily adapted, because the language is designed for mathematics; you tell it what you need to do, but not how to do it.

    In the same way, trying to cram parallelism into a program written in C is a nightmare. Semaphores, exclusive zones, shared variables, locking, deadlocks ... there's a hell of a lot to think about, and you only have to get it wrong once to introduce a very hard to reproduce and debug problem. Other languages are more abstract, and have much greater opportunities for compilers to extract the inherent parallelism; it's just that they have had more use to date in academia to illustrate principles than in the real world to solve problems.

    As time marches on, and the reality of the situation becomes increasingly obvious, I would expect that performance-intensive apps will start to be written in languages better suited to the domain of parallel programming. Single threaded apps will remain - eg, Word doesn't really need any more processing power (MS' best efforts to the contrary notwithstanding) - and C-like languages will still be used in that domain, but I don't think inherently sequential languages, like C, C++, and others of that nature, will be as common in five or ten years as they are today, simply because of the rise of the parallel programming domain necessitating the rise of languages that mimic that domain better than C does.

  14. tag yes by Anonymous Coward · · Score: 0

    please someone tag yes.

    wtf happened anyway? the tags got all boring.

  15. Yes and No by synx · · Score: 5, Interesting

    The problem with parallel programming is we don't have the right set of primitives. Right now the primitives are threads, mutexes, semaphores, shared memory and queues. This is the machine language of concurrency - it's too primitive to effective write lots of code by anyone who isn't a genius.

    What we need is more advanced primitives. Here are my 2 or 3 top likely suspects:

    - Concurrent Sequential Programs - CSP. This is the programming model behind Erlang - one of the most successful concurrent programming languages available. Writing large, concurrent, robust apps is as simple as 'hello world' in Erlang. There is a whole new way of thinking that is pretty much mind bending. However, it is that new methodology that is key to the concurrency and robustness of the end applications. Be warned, it's functional!
    - Highly optimizing functional languages (HOFL) - These are in the proto-phase, and there isn't much available, but I think this will be the key to extremely high performance parallel apps. Erlang is nice, but not high performance computing, but HOFLs won't be as safe as Erlang. You get one or the other. The basic concept is most computation in high performance systems is bound up in various loops. A loop is a 'noop' from a semantic point of view. To get efficient highly parallel systems Cray uses loop annotations and special compilers to get more information about loops. In a functional language (such as Haskel) you would use map/fold functions or list comprehensions. Both of which convey more semantic meaning to the compiler. The compiler can auto-parallelize a functional-map where each individual map-computation is not dependent on any other.
    - Map-reduce - the paper is elegant and really cool. It seems like this is a half way model between C++ and HOFLs that might tide people over.

    In the end, the problem is the abstractions. People will consider threads and mutexes as dangerous and unnecessary as we consider manual memory allocation today.

    1. Re:Yes and No by Anonymous Coward · · Score: 0

      So why don't people take a page from Verilog, VHDL, etc.? Doesn't get a whole lot more parallel than that.

    2. Re:Yes and No by pnotequalsnp · · Score: 1

      The problem is definitely with the primitives and the model. Without them we cannot even solve wait-free consensus (or equivalently elect a leader) in an asynchronous distributed system! This stuff has been proven really hard a long long time ago, but not in a galaxy far away. -- Don't use "Engineer" in your programming job title. When your code fails horribly you definitely will not be held legally accountable.

    3. Re:Yes and No by GileadGreene · · Score: 2, Interesting

      Concurrent Sequential Programs - CSP. This is the programming model behind Erlang
      Technically speaking, Erlang has more in common with the Actor model than with CSP. The Actor model (like Erlang) is based on named actors (cf Erlang pids) that communicate via asynchronous passing of messages sent to specific names. CSP is based on anonymous processes that communicate via synchronized passing of messages sent through names channels. Granted, you can essentially simulate one model within the other. But it pays to be clear about which model we're discussing.

      There is a whole new way of thinking that is pretty much mind bending.
      It's really not that new. CSP has been around in the literature since at least 1978 (the date of Hoare's first paper on the topic). Hewitt's Actor model predates that by a number of years. Languages implementing both CSP and the Actor model have been around for at least 20 years. They just haven't seen widespread use so far.

      Be warned, it's functional!
      Not necessarily. Erlang is certainly implemented that way. But it's not a requirement. The 20-year old occam programming language, which was based pretty heavily on CSP, is basically an imperative language. The E programming language is OO to the core. The Oz language freely mixes functional, imperative, and OO constructs. All three permit message-passing concurrency in the Actor or CSP style.

      The compiler can auto-parallelize a functional-map where each individual map-computation is not dependent on any other.
      This can help to improve the performance of computational tasks. But it doesn't address the fact that (a) the world is fundamentally concurrent, and (b) most modern apps (web browsers, word processors, games) have a large interactive component that could really benefit from a concurrent design. Too much emphasis is being placed on pure computational speed in discussions like this one, when in most cases computation isn't the bottleneck - it's I/O and interactivity. As Joe Armstrong (the guy behind Erlang) has said, "In Concurrency Oriented Programming, the concurrent structure of the program should follow the concurrent structure of the application. It is particularly suited to programming applications which model or interact with the real world."
    4. Re:Yes and No by TodMinuit · · Score: 1

      - Concurrent Sequential Programs - CSP. This is the programming model behind Erlang - one of the most successful concurrent programming languages available. Writing large, concurrent, robust apps is as simple as 'hello world' in Erlang. There is a whole new way of thinking that is pretty much mind bending. However, it is that new methodology that is key to the concurrency and robustness of the end applications. Be warned, it's functional!
      Erlang uses an Actor concurrency model. Limbo uses a CSP model.
      --
      I wonder if I use bold in my signature, people will notice my posts.
    5. Re:Yes and No by Richard+W.M.+Jones · · Score: 1

      Don't forget STM, a method of composing concurrent primitives together.

      Rich.

    6. Re:Yes and No by dkf · · Score: 1

      What we need is more advanced primitives. Here are my 2 or 3 top likely suspects:
      I think you'll find that while they work well for some parallel problems, for others they suck. The problem is that there are quite a few different general parallel computing model problems and it's not at all clear that the same approach will work well for all of them. Indeed, there remain problems that are "embarrassingly serial" and there are also a great many other things where working out how to parallelise them is itself an open research question; it's not even sure whether the list of "dwarfs" in that article is itself complete...
      --
      "Little does he know, but there is no 'I' in 'Idiot'!"
    7. Re:Yes and No by Anonymous Coward · · Score: 0

      it's too primitive to effective write lots of code by anyone who isn't a genius.
      Thank you, thank you very much. I learned how to write "thread safe" code working on 1960s modified IBM 360 mainframes, but we didn't call it that in the early 1990s when I learned. It is good to be called a genius over something as trivial as writing reentrant code and being careful with which thread a variable was used on. Really, it isn't that hard if you are willing to follow standard techniques.

      Only the folks that think they are smarter than everyone else have trouble learning to write thread safe code. If you can't initialize all variables to known values and set your pointers back to NULL when you're done with them, give it up already.
    8. Re:Yes and No by suv4x4 · · Score: 1

      One more: transactional programming. The loss of performance is expected to be around 30% in most cases, but what it allows is that you can program away without worrying about thread conflicts.

      The function will not edit the memory directly, but behind the scenes create a map of the changes it wants to apply to the memory, which are collected completely transparently to the programmer, who just writes normal serial thread code.

      If there's a conflict, the data is discarded and the thread is re-run. If there's no conflict, the changes are aplpied like a normal transaction.

    9. Re:Yes and No by Chibi+Merrow · · Score: 1

      If you can't initialize all variables to known values and set your pointers back to NULL when you're done with them, give it up already.


      Wait... What does this have to do with concurrency, exactly? That sounds more like a prescription for function call etiquette, not avoiding concurrency problems...
      --
      Maxim: People cannot follow directions.
      Increases in truth directly with the length of time spent explaining them
    10. Re:Yes and No by anothy · · Score: 1

      from personal experience, both programming and managing programmers, this is exactly right.

      i had the odd fortune to be working at Bell Labs in the Inferno Business Unit at pretty much the start of my career. i'd taken a few programming courses, but the first time i had to do anything non-trivial, i was working in Limbo, a beautiful language based strongly on the CSP model (Hoare's revision of it, with channels as first class types). we never really thought much about parallel programming in particular, but concurrent programming was simply the easiest way to solve very many problems. when you apply more processors to the problem, you get the parallelism pretty much for free.

      anyway, i picked this up without much difficulty. i'm a bright guy, but certainly no genius, and at the time was way down on the experience chain. i've since had the "opportunity" to work with parallels programming in C/C++ using the conventional models there, and find myself very lost very quickly. i keep asking myself "wait, you have to do what?" and "why would anyone do this?" whenever looking at this stuff. people spend months trying to wrap their heads around this, when it should be very simple. thankfully, there are now even CSP libraries for C when stuck there. i've seen lots of programmers make the switch in the other direction and very quickly become much more productive.

      for those not familiar with the model, there's an excellent lecture by Rob Pike on the model and a language he wrote called Newsqueak that implements it (Newsqueak was a significant influence on Limbo). highly recommended for anyone who cares about this problem domain.

      --

      i speak for myself and those who like what i say.
  16. It's still the wild west... by Max+Romantschuk · · Score: 2, Interesting

    Parallel programming and construction share one crucial fundamental requirement: Proper communication. But building a house is much easier to grasp. Programming is abstract.

    I think part of the problem is, that many programmers tend to be lone wolves, and having to take other people (and their code, processes, and threads) into consideration is a huge psychological hurdle.

    Just think about traffic: If everyone were to cooperate and people wouldn't cut lanes and fuck around in general we'd all be better off. But traffic laws are still needed.

    I figure what we really need is to develop proper guidelines and "laws" for increased parallelism.

    Disclaimer: This is all totally unscientific coming from the top of my head...

    --
    .: Max Romantschuk :: http://max.romantschuk.fi/
  17. My two cents. by Verte · · Score: 1, Interesting

    I'd like to think compilers should be smart enough to assess data dependencies and space those instructions out- we've always had to do this anyway, at least since pipelined processors hit the market, but loops still aren't cascaded properly. An example is a loop that calculates a sum of products- the add instruction must wait for the multiplication instruction to finish, when in fact the processor could be doing a heap of multiplications, and using associativity to cut down dataflow problems in the add stage. Spreading the dataflow graph out as much as possible at compile time also helps with cache coherency between many processors.

    I think a program compiled that way would need hardware that will understand that the data dependencies are spread out so that it can distribute instructions among the processors, although the distribution could be very simple if the dependencies could be spread out significantly- instructions could almost be distributed like dealing cards. It's a much finer granularity than threading, but I think more applications suit this sort of parallelism.

    Another barrier to parallel programming is accessing [for read] data that should be global to all threads. You can do it by passing pointers to state [messy], using globals [dangerous, obese] or by copying all the data onto the stack of the thread [slow]. Threads need to really share address space- use the same stack and everything, IMHO.

    --
    We at slashdot are scientists, specialists and kernel hackers. Your FUD will be found out.
  18. loosely coupled tasks by TheSHAD0W · · Score: 1

    Splitting up a single task can be a lot of trouble, but modern programs, games and applications with lots of creeping featurism, can benefit enormously by sticking those tasks in separate threads and letting them run on different processors. Time effects on 3D scenes, AI for NPCs, real-time changes in embedded data, all can be offloaded, which improves the response time for the main thread to the user.

  19. Non-Repeatable Errors by MrSteveSD · · Score: 1

    Finding errors can be hard enough, but it becomes much harder when they are non-repeatable. That's exactly the sort of bug you get with multi-threaded programming. Run a function 99 times, fine. Run it the 100th time, bang!. On the 100th run the threads were juggled by the OS in such a way that your flawed programming suddenly shows up and the threads clash. I've already used some graphics software that had this exact problem. Thinking in a parallel/multi-threaded way may be a challenge, but I think debugging is the real issue.

    1. Re:Non-Repeatable Errors by Anonymous Coward · · Score: 0

      Some of you smart ones have any insight on this? One thing to design parallelizing algorithms, but any way to better test the implementation? How do we chase and choke out race conditions and deadlocks in testing?

    2. Re:Non-Repeatable Errors by GileadGreene · · Score: 3, Insightful

      How do we chase and choke out race conditions and deadlocks in testing?
      Using testing to iron out concurrency errors is a losing proposition. You're better off trying prevent race conditions and deadlocks getting into your design in the first place, and making the design robust to those errors that do slip through. A few ideas (by no means a complete solution):
      • Use interaction patterns which are known to be free of deadlock (Welch's IO-Seq and IO-Par patterns, client-server structures, E's event-loop concurrency).
      • Model your design in something like CSP or Promela, and then model-check it to detect and eliminate potential race conditions or deadlocks.
      • If it's too late to model the design, then use a model-checker like Java Pathfinder to actually model-check your code, or extract a model from your code and model-check it with SPIN.
      • Develop a design that is robust to the concurrency errors that slip through the modeling and analysis process - see Erlang's approach to supervised process networks for one example.
    3. Re:Non-Repeatable Errors by Speare · · Score: 1

      How do we chase and choke out race conditions and deadlocks in testing?
      Using testing to iron out concurrency errors is a losing proposition. ...
      • Develop a design that is robust to the concurrency errors that slip through the modeling and analysis process.
      This sounds like a chicken-and-egg situation. Even with all the pencil-paper-uml exercises available, you can rarely "develop" a design without accidentally introducing races due to assumptions and then debugging to find and exorcise them from the design. Even your written language can get stuck in recursion or circular dependencies. It's no wonder that multi-threading can be very difficult.
      --
      [ .sig file not found ]
    4. Re:Non-Repeatable Errors by Anonymous Coward · · Score: 0

      Thanks for the pointers - I'll look them up. But as others (and the original commenter) has noted, if out best bet is to try to design correctly, it appears we definitely need a better tools/methods to do this competently.

    5. Re:Non-Repeatable Errors by GileadGreene · · Score: 1

      Even with all the pencil-paper-uml exercises available, you can rarely "develop" a design without accidentally introducing races due to assumptions and then debugging to find and exorcise them from the design.
      Who said anything about UML? Certainly not I. UML is hopeless for designing concurrent systems, precisely because it lacks a truly formal semantics, and therefore does allow assumptions and race conditions to slip in. I'm talking about modeling languages like CSP and Promela, that are formally defined, executable, and able to be exhaustively model-checked to uncover all those hidden assumptions and race conditions. There are even tools and techniques that will help you to refine code from an abstract model in correctness-preserving steps. Granted, none of this is perfect. But it's still (a) streets ahead of how most sequential software is developed, and (b) much better than trying to find and eliminate bugs in already-developed code.
    6. Re:Non-Repeatable Errors by GileadGreene · · Score: 1

      ...it appears we definitely need a better tools/methods to do this competently
      We already have them. Not to say they couldn't be improved. But before asserting that we "need a better tools", it'd be nice to see the tools/methods we already have actually get tried. As it is, most developers are (as this entire thread demonstrates) largely unaware of the huge body of existing work that's already been done in this area. Why reinvent the wheel? Smarter minds than you or I have already spent considerable time thinking about these problems, and coming up with solutions. Why not give them a go!
  20. One thing about our brains and programming... by themoneyish · · Score: 0

    is that our brains do NOT need to think in parallel to write solid parallel code. Just certain design principles need to be used and it is happening all the time.

    And someone said languages are a limitation, and that's probably partially true. The most popular programming languages don't make it easy for a programmer to write parallel code. The ones that do are not so popular yet. So there's a little gap there, but as hardware technology grows more powerful, that will change.

  21. Yes, because programmers are too conservative by Coryoth · · Score: 5, Insightful

    Parallel programming doesn't have to be quite as painful as it currently is. The catch is that you have to face the fact that you can't go on thinking with a sequential paradigm and have some tool, library, or methodology magically make everything work. And now, I'm not talking about functional programming. Functional programming is great, and has a lot going for it, but solving concurrent programming issues is not one of those things. Functional programming deals with concurrency issues by simply avoiding them. For problems that have no state and can be coded purely functionally this is fine, but for a large number of problems you end up either tainting the purity of your functions, or wrapping things up in monads which end up having the same concurrency issues all over again. It does have the benefit that you can isolate the state, and code that doesn't need it is fine, but it doesn't solve the issue of concurrent programming.

    No, the different sorts of paradigms I'm talking about no shared state, message passing concurrency models ala CSP and pi Calculus and the Actor Model. That sort of approach in terms of how to think about the problem shows up in languages like Erlang, and Oz which handle concurrency well. The aim here is to make message passing and threads lightweight and integrated right into the language. You think in terms actors passing data, and the language supports you in thinking this way. Personally I'm rather fond of SCOOP for Eiffel which elegantly integrates this idea into OO paradigms (an object making a method call is, ostensibly, passing a message after all). That's still research work though (only available as a preprocessor and library, with promises of eventually integrating it into the compiler). At least it makes thinking about concurrency easier, while still staying somewhat close more traditional paradigms (it's well worth having a look at if you've never heard of it).

    The reality, however, is that these new languages which provide the newer and better paradigms for thinking and reasoning about concurrent code, just aren't going to get developer uptake. Programmers are too conservative and too wedded to their C, C++, and Java to step off and think as differently as the solution really requires. No, what I expect we'll get is kluginess retrofitted on to existing languages in a slipshod way that sort of work, in as much as it is an improvement over previous concurrent programming in that language, but doesn't really make the leap required to make the problem truly significantly easier.

    1. Re:Yes, because programmers are too conservative by tirerim · · Score: 1

      People will adapt eventually. You don't see too much stuff written in COBOL these days, because better stuff has come around since. Yes, it will take a few years before the new languages and new techniques take over, but any major paradigm shift takes time. And all it will really take to kick the transition into high gear is a few significant pieces of software that blow the competition away by being written to take proper advantage of parallel architectures. Seems like a business opportunity to me if that's your bag.

    2. Re:Yes, because programmers are too conservative by Coryoth · · Score: 1

      People will adapt eventually...Yes, it will take a few years before the new languages and new techniques take over, but any major paradigm shift takes time. I'm not so confident. Consider, for example, the OO revolution. It was a new paradigm, which provided a good way to deal with the ever largeer programming projects that were being undertaken. At the time there were a number of languages that took that bull by the horns and produced very nice solutions, such as SmallTalk, and Eiffel. Developer conservatism kicked in however, and what we ended up with was a bastardized kluge of the clean OO concepts hacked onto C in the mess that is C++. Eventually someone was kind of enough to wipe up the worst of the drool, and make the child a little more presentable, and we got Java. I expect to see the same with concurrent paradigms. We'll see some wonderful languages which elegantly implement the new paradigm, like Erlang, but what we'll end up with is whatever kluge can be arranged to make things slightly better in C++ and Java (Software Transactional Memory seems to be the popular option right now). Years later someone will again, clean up the resulting mess and make a language that is merely not quite as slovenly, but still relatively retarded.
    3. Re:Yes, because programmers are too conservative by master_p · · Score: 1

      It's not as easy to pick an advanced programming language (haskell, erlang, eiffel, oz etc) for the next project as some people make it to be:

      1) you need trained personnel. It's extremely difficult to find such personnel.

      2) programming languages have to have an infrastructure well beyond what academia offers. For example, in order to win contracts with governments, you need certified people and certified technologies, which means no haskell/erlang/eiffel/oz etc.

      Even if the above problems are solved, you still do not solve the problem of concurrency; even if in the context of a purely functional programming language, the IO monad is not parallelizable; you still need mutexes and semaphores.

      The only solution I see is for message passing in object-oriented programming to become real message passing, i.e. each object having a queue of jobs and a lightweight thread which takes over the remaining jobs in the queue. It's not quite the Actor model, but it is close, and it certainly fits technologies like the 80-core CPU from Intel.

      But even if such a language appeared tomorrow, it would have to go a long way until it is widely used...

    4. Re:Yes, because programmers are too conservative by 808140 · · Score: 1

      I'm not talking about functional programming. Functional programming is great, and has a lot going for it, but solving concurrent programming issues is not one of those things. Functional programming deals with concurrency issues by simply avoiding them. For problems that have no state and can be coded purely functionally this is fine, but for a large number of problems you end up either tainting the purity of your functions, or wrapping things up in monads which end up having the same concurrency issues all over again. It does have the benefit that you can isolate the state, and code that doesn't need it is fine, but it doesn't solve the issue of concurrent programming.

      Not every monad is the IO monad or a state monad; having functional code wrapped up in a monad doesn't inherently force sequential evaluation and one of the great strengths of purely functional languages like Haskell is the guarantee that you won't have side-effects -- thus any function call, anywhere at all, can be executed in its own thread without any worry about blocks or volatile memory.

      The IO monad is admittedly a black box, but in practice very little of a well coded Haskell program is wrapped up in the IO monad.

      Referential transparency means parallelization and memoization, two of the most promising optimisation techniques moving forward. While it is certainly possible to write very fast parallelizable imperative code, the complexity quickly becomes untenable precisely because imperative programming is so tied to sequencing and makes the often completely unnecessary assumption that one statement must follow another. Because Haskell and its derivatives make the opposite assumption -- that order doesn't matter and that functions should be executed if and only if their values are needed to move computation forward -- one ends up with programs where the compiler knows exactly what can be parallelized and what cannot be. Language extensions like those found in the Glasgow Parallel Haskell project further increase parallelization potential by introducing some explicit parallelization and barrier keywords.

      Of course, one is still left with the language-agnostic problem of developers writing crappy algorithms that can't easily be parallelized when one a parallelizable one would do the trick. But it's often a trade-off: for example, easily paralleizable functional algorithms are often slower than their non-parallelizable imperative counterparts in a single-core world.

    5. Re:Yes, because programmers are too conservative by Midnight+Thunder · · Score: 1

      One thing that I have always wondered is whether when doing concurrent programming we make the mistake of trying to be efficient with memory and great with our concurrent model. What I mean by this is that instead of ensuring that a thread is using local variables where possible, we try sharing too much amongst them. If a unit of work can be made to run without regards for the existence of another (no shared resources), then it is much easier to write. Reducing the amount of data sharing as much as possible makes it easier and also potentially faster, since every time two or more threads needs to interact, because of data sharing (accessing the same list for example), you are going to create potential complications and potential performance hits, while one thread needs to wait for the other.

      Someone mentioned that building a house is highly parallelised process. Having followed the construction of a house recently, I realise that is only true when the tasks don't interact. If the tasks depend on each other, then communication can slow each other down, miscommunication can happen and in some cases tasks have to wait for the seemingly separate task to finish first. In many ways writing concurrent software is not much different.

      --
      Jumpstart the tartan drive.
    6. Re:Yes, because programmers are too conservative by Coryoth · · Score: 1

      The only solution I see is for message passing in object-oriented programming to become real message passing, i.e. each object having a queue of jobs and a lightweight thread which takes over the remaining jobs in the queue. It's not quite the Actor model, but it is close Take a look at SCOOP for Eiffel then. It is rather akin to that, just slightly more nuanced in that it allows you to state which objects are parallelisable, and which objects need to remain in the same thread/process/processor. In practice it is as simple as the separate keyword, which declares that objects can run independently. From there you just think of method calls as messages. The compiler handles all the details of locking etc. for you autonatically. Even if you don't use Eiffel and never intend to (it is, after all, a nice language with a GPLd IDE and compiler suite) its worth looking at SCOOP just to see what you should be lobbying other OO lanuages to take the plunge and do.
    7. Re:Yes, because programmers are too conservative by Raenex · · Score: 1

      it is, after all, a nice language with a GPLd IDE and compiler suite GPL Eiffel sucks if you aren't writing GPL apps. Even GPL'd Java has the Classpath exception so that you don't have to license your application under the GPL. There are too many good, free, unencumbered languages around to consider proprietary ones like Eiffel.
  22. Amdahl's law by apsmith · · Score: 5, Insightful

    I've worked with parallel software for years - there are lots of ways to do it, lots of good programming tools around even a couple of decades back (my stuff ranged from custom message passing in C to using "Connection-Machine Fortran"; now it's java threads) but the fundamental problem was stated long ago by Gene Amdahl - if half the things you need to do are simply not parallelizable, then it doesn't matter how much you parallelize everything else, you'll never go more than twice as fast as using a single thread.

    Now there's been lots of work on eliminating those single-threaded bits in our algorithms, but every new software problem needs to be analyzed anew. It's just another example of the no-silver-bullet problem of software engineering...

    --

    Energy: time to change the picture.

    1. Re:Amdahl's law by butlerdi · · Score: 1

      Amdahls law does in deed pose a problem and is correct, however things like Promise Pipelining in the E language as well as Autonomous Agent Architechtures may aid in diminishing the impact.

      --
      "If the King's English was good enough for Jesus, it's good enough for me!" -- "Ma" Ferguson, Governor of Texas (circa
    2. Re:Amdahl's law by drgonzo59 · · Score: 1
      That makes total sense. People forget that some tasks are not inherently concurrent while some a embarrassingly concurrent. Knowing which is which will save enormous amounts of resources (time and money). Also the worst one can do is to go back and make some old code that was never meant to have threads in it execute in parallel.


        Multiple cores are still good because of application parallelism -- run multiple applications at the same time (given that CPU is the bottleneck and not I/O). At least 2 cores are very nice, one takes care of OS stuff, monitoring, security, maintenance, the other can be monopolized by an application...

    3. Re:Amdahl's law by Anonymous Coward · · Score: 0

      Some parallel codes can have super-linear speed ups !!! this is the case of some codes performing lots of memory operations...

    4. Re:Amdahl's law by clary · · Score: 1

      John Gustafson has a different take. In a nutshell, he says two things. First, when many processors are available, what you really want to do is solve a bigger problem in the available wall clock time. Second, when you grow the kinds of problems we are talking about, the parallel part grows faster than the serial part. For the right kinds of problems, these two things make Amdahl's law not applicable.

      --

      "Rub her feet." -- L.L.

    5. Re:Amdahl's law by Raenex · · Score: 1

      That's a really good point, one that I haven't seen mentioned before. Amdahl's law was limiting my enthusiasm for multicore, but I had a nagging feeling about it because it seemed that you could always make use of more computers for a big service operation like Google. It's good to know the theory of why this works! Too bad "Gustafson's law" isn't a memorable name :)

  23. Discussed for years on comp.arch by calidoscope · · Score: 1
    Anyone who's followed the discussions on comp.arch will be familiar with Nick McLaren's appeals for more to be done on parallelizing algorithm's. The writing has been on the wall for several years now that we'll be seeing incremental improvements in single threaded performance over the next few years.


    Along those lines, Sun's work on threading was largely in support of adapting applications to run on multiprocessor systems. This work has been going on for more than a decade and has received additional impetus with the 'Niagara' series processors. Seems to me that Intel has finally seen the light.

    --
    A Shadeless room is a brighter room.
  24. Functional programming removes the problem by Anonymous Coward · · Score: 0

    Instead of continuing to write software in imperative languages like C and Java and dealing with the added complexity of multiple threads, race conditions, etc. it seems to this AC a bit simpler to just start pushing functional programming as a solution: let the compiler do the work.

    Historical precedent: as processors and their instruction sets became more complex and varied, there was no "crisis" of programmers failing to adapt to more complicated assembly language; instead the solution was to start progamming in "higher level" languages (ya know like Cobol and Fortan!).

  25. BeOS by Anonymous Coward · · Score: 0

    if you want to solve the problem, think BeOS. Join Haiku or code for it www.haiku-OS.com. If you want to learn about how parallelism work in that OS, just take a look at the BeBook (the API reference easy to find on the web) or one of the now free Oreily book on the subject.

  26. Too much emphasis on instruction flow by putaro · · Score: 3, Interesting

    I've been doing true parallel programming for the better part of 20 years now. I started off writing kernel code on multi-processors and have moved on to writing distributed systems.

    Multi-threaded code is hard. Keeping track of locks, race conditions and possible deadlocks is a bitch. Working on projects with multiple programmers passing data across threads is hard (I remember one problem that took days to track down where a programmer passed a pointer to something on his stack across threads. Every now and then by the time the other thread went to read the data it was not what was expected. But most of the time it worked).

    At the same time we are passing comments back and forth here on Slashdot between thousands of different processors using a system written in Perl. Why does this work when parallel programming is so hard?

    Traditional multi-threaded code places way too much emphasis on synchronization of INSTRUCTION streams, rather than synchronization of data flow. It's like having a bunch of blind cooks in a kitchen and trying to work it so that you can give them instructions so that if they follow the instructions each cook will be in exactly the right place at the right time. They're passing knives and pots of boiling hot soup between them. One misstep and, ouch, that was a carving knife in the ribs.

    In contrast, distributed programming typically puts each blind cook in his own area with well defined spots to use his knives that no one else enters and well defined places to put that pot of boiling soup. Often there are queues between cooks so that one cook can work a little faster for a while without messing everything up.

    As we move into this era of cheap, ubiquitous parallel chips we're going to have to give up synchronizing instruction streams and start moving to programming models based on data flow. It may be a bit less efficient but it's much easier to code for and much more forgiving of errors.

    1. Re:Too much emphasis on instruction flow by underflowx · · Score: 3, Interesting

      My experience with data flow is LabVIEW. As a language designed to handle simultaneous slow hardware communication and fast dataset processing, it's a natural for multi-threading. Parallelization is automated within the compiler based on program structure. The compiler's not all that great at it (limited to 5 explicit threads plus whatever internal tweaking is done), but... the actual writing of the code is just damn easy. Not to excuse the LabVIEW compiler: closed architecture, tight binding to the IDE, strong typing that's really painful, memory copies everywhere. But the overall model for dataflow is just superior for parallel applications. It's unfortunate that there seems to be little alternative out there with similar support for data flow, but more overall utility.

    2. Re:Too much emphasis on instruction flow by jmv · · Score: 1

      Try FlowDesigner</Blatant plug>

    3. Re:Too much emphasis on instruction flow by MemoryDragon · · Score: 1

      Good explanation wrong conclusion. Parallel programming is a bitch, but part of the problem is the language you apply to the problem. Parallel programming is bread and butter every day in java, most people dont even notice too much that they are in a parallel environment. The reason, you do not have to fight constantly with the language. The same applies to perl, and other scripting languages. You still have to fight with locks ciritical regions etc... if you go down to the core, but given the fact that all of this is nicely integrated into the language makes things way easier. On a normal level once you have left the lower layer of those systems you normally dont even think about those issues anymore because most of the times you work in a single thread where the server parallels everything the low level (servers and operating systems have a lot in common that way)

    4. Re:Too much emphasis on instruction flow by putaro · · Score: 1

      I do most of my work in Java these days. There are still a lot of gotchas available as you get deeper into parallelism. How many locks is your code holding right now? If it's holding more than 1 you have a potential for deadlock. Are all of the classes that you're using thread-safe? Oh, you're using an ArrayList and you didn't synchronize it? Oh, and BTW, the UI classes are not thread safe. Did you make sure that all of your UI events are executing on the UI thread?

      If you think that synchronizing instruction streams is easy it's just because you're not doing anything very serious. Java's support is useful but it just basically lets you skip the easy problems and move straight to the hard ones.

    5. Re:Too much emphasis on instruction flow by kahei · · Score: 1


      What you're describing as 'models based on data flow' is the way parallel programming SHOULD be being done already.

      The reason a parallel system like /. works, as you say, is that there are well-defined compartments for the 'cooks', buffered work queues between them, and well defined interfaces between their compartments. That structure is forced by the fact that the parallelization is happening across the Internet.

      Good software design uses compartmentalization, buffering, and well defined interfaces even when NOT forced to by the physical environment. And lo and behold, multithreading becomes easy (for certain values of 'easy').

      All you have to do is forget about the UNIX process model really :/

      --
      Whence? Hence. Whither? Thither.
    6. Re:Too much emphasis on instruction flow by dkf · · Score: 1

      The same applies to perl, and other scripting languages. You still have to fight with locks ciritical regions etc...
      Nope. Not all scripting languages expose that level to you. Some stick exclusively to the dataflow/message passing domain.
      --
      "Little does he know, but there is no 'I' in 'Idiot'!"
    7. Re:Too much emphasis on instruction flow by dkf · · Score: 1

      All you have to do is forget about the UNIX process model really
      No. It's more like going from a monolithic "do everything" process into a world with pipelines. Guess what? Unix systems have been doing that sort of thing for decades. That sort of parallelism works.
      --
      "Little does he know, but there is no 'I' in 'Idiot'!"
    8. Re:Too much emphasis on instruction flow by polarbeer · · Score: 1

      Good point. Because parallel programming is so difficult, orthogonality between instructions and data is more important than ever. I don't think it's a coincidence that multicore processors and third-party game engines are going mainstream at the same time. The Unreal 3 engine is being used for 100 games in many different genres. All of whom are able to take advantage of parallelism without inventing it themselves. Unreal gets the instructions right, other developers bring the data = cheaper next-gen games.

    9. Re:Too much emphasis on instruction flow by mvarga · · Score: 2, Interesting

      Programmers aren't so bad. There is a paper coming from the Berkeley University, which mathematically proves that a multithreaded program cannot be thoroughly tested, so after a very strict testing procedure, there can still be deadlocks or other synchronization problems in the program. I am just working on a framework which would practically hides the need of mutexes and other synchronization primitives, and tries to provide a "fool-proof" parallel programming framework. Do you think that making it an open-source project (eg. on SourceForge) could be useful? I am not sure whether a new paradigm which does not come from a software giant could gain any attention...

    10. Re:Too much emphasis on instruction flow by ktorn · · Score: 1

      Do you think that making it an open-source project (eg. on SourceForge) could be useful?

      Absolutely.
    11. Re:Too much emphasis on instruction flow by francium+de+neobie · · Score: 1

      Why not? I'd be delighted to see how it works.

  27. IBM (or Intel) dude at GDC 2007 said. . . by ookabooka · · Score: 1

    I went to the Game Developers Conference and went to a session where a gentleman from either IBM or Intel gave a talk on how to utilize extra cores and yet not penalize those that did not have multicore. As an aside, Intel also offers something called the "Building Blocks" library which parallelizes primitive things such as for loops. Anywho, back to something game specific, a few of the suggestions below:

    Particle physics for client-side visual effects (omit on non multi-core machines)
    Animate faces more, smoother more natural animations when walking up stairs/inclines (again more static and rigid on single core machines)
    Animate cloth/hair

    And my personal favorite
    Dynamic texture/model tessellation. (models far away are less complex than models close up, make the transition smoother)


    So, whats my opinion? It's the libraries and programming languages and compilers that will change, the programmer just needs to have an idea of synchronization issues and whatnot.

    --
    If you are about to mod me down, keep in mind that this post was most likely sarcastic.
  28. Errors are difficult to find out in such systems by himanshuarora · · Score: 2, Informative

    Well, I was a Teaching Assistant of 'Concurrent Algorithms'. There used to be 30 students for that class. For a given assignment there used to be 30 different solutions and many used to be wrong.

    It is difficult to find out errors in these kind of algorithms. There has been some papers published in big conferences and it was found that some mathematical proofs were wrong because they could not think of some scenarios where it can fail.

    --
    Spam: Any activity on internet to gain popularity without paying to advertising companies like Google.
  29. Not hard, but not that easy by mveloso · · Score: 1

    One reason that parallel programming is hard is simple: lots of things can't be parallelized effectively. The computer is really doing one thing, namely, waiting for input (ie: the app is user-bound). If your app isn't user bound, then parallelism is possible.

    If your app isn't user bound, it should be pretty easy to parallelize, assuming that your processing stream isn't serialized (ie: the does a result depends on the previous result?). The problem then becomes contention. For some reason, lots of developers can't wrap their heads around threading and contention issues. Maybe it's been presented incorrectly in textbooks, or something like that. People have problems programming asynchronously as well. Maybe that's the problem?

    Anyhow, once you figure out the contention issue, then there are all kinds of other things you have to deal with, like asynchronous status notification. Timeouts. Data that never comes back. Unexpected termination. Data coherency. Read and write locking. Synchronization.

    In the end, sometimes it's easier to break your data set up into chunks and spawn a couple of processes in the background, then use cat to aggregate the data sets. It's definitely easier to do it that way (ie: not a lot of mental lifting involved).

    Most developers don't care about scalability. The ones that do parallelize. The ones that don't don't.

  30. bad education by nanosquid · · Score: 3, Insightful

    No, parallel programming isn't "too hard", it's just that programmers never learn how to do it because they spend all their time on mostly useless crap: enormous and bloated APIs, enormous IDEs, gimmicky tools, and fancy development methodologies and management speak. Most of them, however, don't understand even the fundamentals of non-procedural programming, parallel programming, elementary algorithms, or even how a CPU works.

    These same programmers often think that ideas like "garbage collection", "extreme programming", "visual GUI design", "object relational mappings", "unit testing", "backwards stepping debuggers", and "refactoring IDEs" (to name just a few) are innovations of the last few years, when in reality, many of them have been around for a quarter of a century or more. And, to add insult to injury, those programmers are often the ones that are the most vocal opponents of the kinds of technologies that make parallel programming easier: declarative programming and functional programming (not that they could actually define those terms, they just reject any language that offers such features).

    If you learn the basics of programming, then parallel programming isn't "too hard". But if all you have ever known is how to throw together some application in Eclipse or Visual Studio, then it's not surprising that you find it too hard.

    1. Re:bad education by ad0le · · Score: 2, Insightful

      I've read several comments like yours in this thread. I just picked a random one to comment on. It's important to realize that the majority of professional developers are paid to produce a product, that works, in the shortest amount of time possible, with the mindset that things will need to change quickly to accommodate clients needs. As well, most professional developers aren't really low level guys and deal mostly with glorified database frontends with scattered business logic thrown about. Things like ORMs, RAD IDEs and extreme programming allow for this type of hostile environment with a relatively quick turnaround. It's a competitive market and not everyone can, or even needs, work at the machine level.

      I get the feeling allot of you hardcore guys miss the idea that multicore systems are still very helpful, regardless of rather a thread model is implemented or not. When a machine is responsible for running a RDBMS, webserver, FTP server, mail server and an application pool, adding a threading model to your application can become a serious bottleneck.

      I would venture to guess, that the majority of professional (not at an academic, student or research level) would hardly ever have the need for parallel systems.

      The point I am trying to make, is; the benefits of a multicore machine, go FAR beyond individual applications in the real world.

      --
      My mother never saw the irony in calling me a son-of-a-bitch.
    2. Re:bad education by nanosquid · · Score: 1

      I've read several comments like yours in this thread. I just picked a random one to comment on. It's important to realize that the majority of professional developers are paid to produce a product, that works, in the shortest amount of time possible, with the mindset that things will need to change quickly to accommodate clients needs.

      Yes, and my point is that tools like Eclipse, Visual Studio, XML libraries, GUI designers, etc. probably hurt programmer productivity. Their real benefit is to reduce the amount of training people need initially, but whether that is a good tradeoff overall is unclear; one highly skilled programmer may well be more productive and cost-effective overall than ten average programmers.

      Not to be misunderstood: I do think there is a place for good tools to support working programmers, it's just that the tools that are widespread are mainly aimed at getting people "hooked" on them, not at supporting experienced professional programmers optimally.

      I would venture to guess, that the majority of professional (not at an academic, student or research level) would hardly ever have the need for parallel systems.

      This is not an academic or research issue. For example,every modern web application is a parallel, distributed system, and modern CPUs implicitly attempt to treat sequential code as parallel. The fact that many programmers don't know the right abstractions for dealing with parallelism causes both serious inefficiencies and outright bugs.

      The point I am trying to make, is; the benefits of a multicore machine, go FAR beyond individual applications in the real world.

      Yes, and I'm saying that inability to deal with parallel programming is only a symptom of a far deeper deficiency.

      (I also don't think that multicore parallelism is going to be very important in the long run, compared to other forms of parallelism.)

    3. Re:bad education by xtracto · · Score: 3, Insightful

      Yes, and my point is that tools like Eclipse, Visual Studio, XML libraries, GUI designers, etc. probably hurt programmer productivity. Their real benefit is to reduce the amount of training people need initially, but whether that is a good tradeoff overall is unclear; one highly skilled programmer may well be more productive and cost-effective overall than ten average programmers.

      Not to be misunderstood: I do think there is a place for good tools to support working programmers, it's just that the tools that are widespread are mainly aimed at getting people "hooked" on them, not at supporting experienced professional programmers optimally.


      I think you are misunderstanding the objective of the tools you are naming... they have been conceived to help developers in their work. It is not Microsoft's or Eclipse foundation (or the Gnome guys) that wannabe "code monkeys" play with their tools for 2 weeks and add them as a skill in their curriculum. Look at those tools as if they were carpenter tools like an electric drill or handsaw. They are conceived to make easier the work of the carpenter, but yo *do* need to *know* what you are doing. You can not say that they hurt the carpenters productivity because they incite people that do not know anything about woodworking to grab a DIY book and put an add on the newspaper...

      --
      Ubuntu is an African word meaning 'I can't configure Debian'
    4. Re:bad education by Anonymous Coward · · Score: 0

      I thought you were done with slashdot.
      Change your mind about digg?

  31. Two Problems by SRA8 · · Score: 3, Insightful

    I've encountered two problems with parallel programming 1. For applications which are constantly being changed under tight deadlines, parallel programming becomes an obstacle. Parallelism adds complexity which hinders quick changes to applications. This is a very broad generalization, but often the case. 2. Risk. Parallelism introduces a lot of risk, things that arent easy to debug. Some problems I faced happened only once every couple of weeks, and involved underlying black-box libraries. For financial applications, this was absolutely too much risk to bear. I would never do parallel programming for financial applications unless management was behind it fully (as they are for HUGE efforts such as monte carlo simulations and VaR apps.)

  32. To the tune of "Sitting On The Dock Of The Bay" by iminplaya · · Score: 1

    First I'll put a bit over here
    Then I'll put a bit over there
    Watchin' all those bits go in
    Then watch 'em do that I/O again

    I'm sittin' at my desk all day
    Watching the bits toil away
    Ooo, I'm just sittin' at my desk all day
    Wastin' time

    --
    What?
    1. Re:To the tune of "Sitting On The Dock Of The Bay" by Anonymous Coward · · Score: 0

      Thanks, that's fifteen seconds of my life I won't get back again.

      Wait... maybe if I playback a line from each stanza in parallel...?

    2. Re:To the tune of "Sitting On The Dock Of The Bay" by iminplaya · · Score: 1

      Took you fifteen seconds? I'll type faster next time. With both hands.

      --
      What?
  33. too many options by penguinbroker · · Score: 1
    parallel programming has a lot of obvious benefits. but say i want to write parallel code do i take advantage of 2 cores only or should i focus on a robust solution that identifies the number of core and optimizes accordingly?

    erlang is interesting because it presents a parallel platform that scales to the number of cores available. ultimately one of the strongest features of modern code is the ability to run across numerous hardware architectures and on diverse group of processors. as a result, it's usually best to follow the old mantra in CS to program for the 'worst case scenario' which manifests itself in single core processors today.

    parallel programming isn't impossible, it's just not that worthwhile right now for 99% of coders

  34. Careful with process algebra and process calculii by dr_pump95 · · Score: 1

    No, the different sorts of paradigms I'm talking about no shared state, message passing concurrency models ala CSP and pi Calculus

    You need to be careful with these paradigms. They all use an interleaved concurrency model as the basis for their semantics. This is OK as a way of defining semantics, but not for execution in a truly parallel environment. In essence, the semantic model says that running computation A in parallel with computation B is the same as executing "A" then "B" or "B" then "A". Notice that the parallelism has been removed to make the semantics easier to reason about.

    In a truly parallel application, you need to be very sure that executing "A" in parallel with "B" is not actually going to break anything. Often this means some implicit synchronisation, which is what we're trying to remove. There are better models around. Petri nets are truly parallel, but also introduce some synchronisation requirements. Models based on Winskel's event structures are somewhat better, but not that widely known or understood.

    So, there is still some way to go here.

  35. We do it all the time! by taniwha · · Score: 1
    our brains are highly parallel - we wouldn't be able to do such complex though processes with a bunch of meat otherwise .... streams of thought and reasoning are however pretty linear.

    Up thread someone wondered if we'd make the same rates of progress in parallel programming as chip design (Moore's law) .... guess what hardware design these days is largely programming, and highly programming at that .... and it's done by mere mortals. I have a decade in logic design and maybe 15 more years as a programmer - largely as a kernel hack and doing embedded systems - they're really all the same stuff - spending a lot of time doing logic helps you hone those parallel programming skills - after a while the deadlocks and places that need locks just start to become obvious ....

    Note to peanut gallery: favorite gdb debugging command "t a a bt"

  36. Our brains run in parallel but think in serial by Samarian+Hillbilly · · Score: 1

    The basic problem is one of optimization. THERE WOULD BE ABSOLUTELY NO REASON TO EVER PROGRAM IN PARALLEL IF COMPUTERS WERE FAST ENOUGH. This means that there needs to be a separation of concerns between the algorithm expressed serially and it's parallel optimization. So far, automatic parallelization has had only limited sucess and there is no reason to believe this will change in the near future. This suggests a three-fold architecture.
    1) A parallelizable (but not parallel) serial language for "every" programmer to write in.
    2) A specialized "mapping" meta-language for optimization experts, that would parallelize expressions in the serial language in an optimal way for the target hardware.
    3) The resulting machine code.

    NOBODY SEEMS TO BE WORKING ON THIS APPROACH. In fact object-oriented programming with it's state (object) based approach works dead against parallel programming. The parallizable/serial language would probably have to be functional.

    1. Re:Our brains run in parallel but think in serial by TheRaven64 · · Score: 1
      OO works incredibly well with parallelism. Object orientation is (From Alan Kay, who invented the term):

      Simple models of computers communicating by message passing. This extra abstraction, the message passing, is the vital bit. Once you've replaced procedure calls (which are just a special case of message passing) with a generic mechanism, you can choose the correct one depending on the circumstances. Sometimes the fastest thing is a synchronous operation in the same process, sometimes it's passing the message over to another process. Some languages, like C++ and Java, lose this abstraction, and just make message passing into function calls with a hidden 'self' parameter, and so aren't good for parallel programming, but that's a language, rather than a model, issue.
      --
      I am TheRaven on Soylent News
    2. Re:Our brains run in parallel but think in serial by Forseti · · Score: 1

      The basic problem is one of optimization. THERE WOULD BE ABSOLUTELY NO REASON TO EVER PROGRAM IN PARALLEL IF COMPUTERS WERE FAST ENOUGH.

      In answer to this, I'll paraphrase the great Grace Murray Hopper: In olden times, when they needed to rip out a tree stump and the ox wasn't strong enough, they didn't go back to the barn to breed a better ox; they'd just add more oxen until the job got done.

      There will always be a bigger job than a single contemporary processor can handle in a reasonable amount of time. Your proposed approach makes sense, but I'm just not sure it makes anything easier.

      --
      Delay is preferable to error. (Thomas Jefferson)
    3. Re:Our brains run in parallel but think in serial by Samarian+Hillbilly · · Score: 1

      "Incredibly Well"? A function which holds state between calls cannot be instantiated across multiple processes and run in parallel. That is OO programing works against data-level parallelism. Control level parallelism works just fine, but is generally not as useful in situations where optimization is desperately needed. Functional languages work better with data parallelism. Nor do current OO languages allow you to control the two most important factors in parallelization, data and functional granularity.

    4. Re:Our brains run in parallel but think in serial by Samarian+Hillbilly · · Score: 1

      We would only know that I think if we gave it a try. IBM's octopiler project http://domino.research.ibm.com/comm/research_proje cts.nsf/pages/cellcompiler.index.html is probably the closest I've seen. But it's insistence on trying to use c++ is probably going to kill it in the end.

  37. What I find most entertaining ... by TechnoLuddite · · Score: 1
    ... is that most of the pertinent replies are modded 2.

    There's long been the comment that multi-threaded programming was going to be the next quantum shift, much like OOP was. And the difficulty was going to be the same -- namely, getting the programmer's brain to wrap around the concept. The shift from OOP to threaded programming is likely to be at least as difficult as the shift from linear to OOP.

    What I'm seeing here (caveat: not a programmer by trade, only a lowly QA ... but I do have a rudimentary awareness of programming) is that the tools aren't fully ready. This is something I could fully believe -- I've been witness to the development cycle without tools, and the development cycle with tools. It's equivalent to editing a photo with MS Paint vs. Photoshop.

    As for those accusing programmers of being lazy, I'll pass on one question posed to me by a friend:

    "Why doesn't everyone just code in assembly language?"

  38. No, it's not hard. by ShakaUVM · · Score: 1

    I taught parallel processing (as a TA) at UC San Diego, and worked at the supercomputer center for years doing parallel code.

    No, parallel processing is not "too hard". Phah.

    It's simply hard for people that are being forced to write parallel code without taking a class in the subject, or really understanding what they're doing. Parallel code is as mind bending as recursive code the first time you saw it, only more so. It takes a lot of work to wrap your mind around the weirdness of having the same code being executed in different places with different data, making sure you pass the data back and forth correctly, synchronize correctly, and doing it all without making mistakes that destroy your performance.

    To anyone interested in the field, sit down, learn MPI, run through some tutorials, and get to the point where you can run something like a radial blur on an array in parallel without breaking a sweat, and you know you're mentally ready to write parallel code. In class, getting to this state usually takes 2-3 weeks, but if you're working on your own, you should be able to do it faster.

  39. Math Barbie says by Russ+Nelson · · Score: 1

    Math Barbie says "Parallel Programming is hard!"

    --
    Don't piss off The Angry Economist
  40. Our brains can rewire themselves by deek · · Score: 1

    Yes, you too can _learn_ how to program in parallel. You're right, in that we fundamentally do things in a linear fashion. But, we can learn to think differently, and learn different methods that will work in a parallel way.

    Taking your mathematical example, here's a parallel example of a change in thinking. At one stage, the concept of 'zero' was unfathomable. As little as over 2000 years ago, there was no zero. You could say that their brains weren't wired to think in zeroes. That's certainly changed these days. Once the concept was discovered, and taught, it eventually became instinctive for everyone.

    We obviously haven't reached that stage with parallel programming, but all it takes is familiarity with the concepts and methods, and a bit of practice. I rate it up there with object oriented programming. In fact, they're both very suited for each other.

  41. Superwaste by gustgr · · Score: 1

    Recently my University bought a supercomputer listed between the top500 computer systems in the world. During a class of Computational Physics, my Professor was commenting this issue and noted that the system was intended to serve about 80 research groups with tasks that demand parallel processing. The reality were much more modest though: only two groups were actually using the system (one of them was my Professor's research group), and of this two groups, only his group were taking advantage of parallel programming techniques to use the system the way it should be used.

    He said that a new policy would be implanted, this was about 3 or 4 months ago, so I don't know how it is right now. But this reflects the lack of preparation to use such a system, they've wasted tons of cash with something they don't really know how to use properly.

  42. A Case Study by iamdrscience · · Score: 2, Informative

    My brother just recently started doing IT stuff for the research psych department at a respected university I won't name. They do a lot of mathematical simulations with Matlab and in order to speed these up they decided to buy several Mac Pro towers with dual quad core Xeons at $15,000*. The problem is, their simulations aren't multithreaded (I don't know if this is a limitation of Matlab or of their programming abilities -- maybe both) so while one core is cranking on their simulations to the max, the other 7 are sitting there idle! So while a big part of this ridiculous situation is just uninformed people not understanding their computing needs, it also shows that there are plenty of programmers stuck playing catch-up since computers with multiple cores (i.e. Core 2 Duo, Athlon X2, etc.) have made their way onto the desktops of normal users.

    I think this is a temporary situation though, and something that has happened before, there have been many cases where new powerful hardware seeps into the mainstream before programmers are prepared to use it.



    *I know what you're thinking: "How the hell do you spend $15,000 on a Mac?". I wouldn't have thought it was possible either, but basically all you have to do is buy a Mac with every single option that no sane person would buy: max out the overpriced RAM, buy the four 750GB hard drives at 100% markup, throw in a $1700 Nvidia Quadro FX 4500, get the $1K quad fibre channel card, etc.

    1. Re:A Case Study by StarfishOne · · Score: 1

      I'm not very familiar with Matlab and OSX, but is it not just possible to start 8 Matlab instances and point them each to run on a particular core?

    2. Re:A Case Study by iamdrscience · · Score: 1

      It is possible, but that's not a cure-all because it only works with simulations where the datasets can be split up and run separately.

      My point is that newly prevalent multi-core systems are a big change in computing, not just for programmers but for users as well. These people bought these systems thinking "8 cores? These will be done eight times as fast!" not realizing what it really means.

    3. Re:A Case Study by The+One+and+Only · · Score: 1

      Can they run eight instances of a simulation at once, or eight different simulations? Or even four, or two? Parallelism doesn't only help you run one process, it also helps you run multiple processes with less cost.

      --
      In Repressive Burma, it's not just your connection that dies. slashdot.org/comments.pl?sid=314547&cid=20819199
    4. Re:A Case Study by basshedz2 · · Score: 1

      Cluster them and use the MATLAB Distributed Computing Toolkit. It parallelizes many of the underlying linear algebra algorithms used in matlab (using SCALAPACK) to take advantage of as many cores as you let it. Its not perfect by any means (and if you try and use it in a multi-user environment like a computational grid it is an absolute pain in the ass) but it does significantly speed up many types of matlab computation. Check it out here.

    5. Re:A Case Study by dbIII · · Score: 1
      Had a similar situation with one app - 8 CPUs going flat out on one job took exactly the same amount of time it would take limited to 2 CPUs. Running 4 jobs at once took the same time as running the single job - two and a half days for each run. Fortunately the application was updated and so far it appears to make full use of each CPU now - unfortunately I have no idea what those other 6 CPUs were working so hard on which gave no performance improvement (one of the costs of closed source scientific software). The same app is so chatty that it's always better to break the job up into independant chunks than to try to run it in cluster mode - up to one third of the time it is just sitting there waiting for some message to come in before it starts on the next bit which in not dependant on anything else at all.

      As for the Mac price above - quad core Xeons and memory are unfortunately the main clue as to why the price goes from ludicrous to insane. The things I'm using have two nodes in 1U and two quad core Xeons on each node and are most definitely not Macs - but with as much memory as would fit they would reach a similar price.

    6. Re:A Case Study by StarfishOne · · Score: 1

      "because it only works with simulations where the datasets can be split up and run separately."

      You've definitely got a point there.

      When typing my first reply, I was more thinking in the direction of serving 8 different users at the same time on a single machine.

      Sorry for not being explicit enough (I haven't had coffee for three weeks, sometimes it's noticeable ;P)

    7. Re:A Case Study by marcosdumay · · Score: 1

      A $15,000 computer to run MatLab is simply stupid. First you port your program to a decent environment*, then you add power if needed.

      * At MathLab your program will consume HUGE amounts of memory, that it somehow fragments trouhg a even biger space. It makes EVERY computer that I've saw running swap data, and needs to acess the data on the disk every time. (No, 2GB or 3GB of RAM aren't even near enough.) After a few minutes, your processos runs as fast as the disk... It is a piece of amateur code, for small, demonstrative, experiments only. It may very well turn your 30-second problem into a 1-week one (if you have enough disk for swapping). It won't ever solve your 1-week problem.

    8. Re:A Case Study by zippthorne · · Score: 1

      What I don't understand is, the MATrix LABoratory should've been one of the first to take advantage of multiple cores. I could've sworn I'd seen a cluster version a few years ago when I was looking into that sort of thing.

      By now, I'd have expected them to have a GPU-MATLAB to take advantage of the massively parallel matrix-oriented hardware sitting just inches from the CPU.

      --
      Can you be Even More Awesome?!
    9. Re:A Case Study by sznupi · · Score: 1

      I still can't forget a wall/building ad; seen 1 or 2 years ago. It was a totally standard PC with Pentium D 2,6 GHz. Yet, somehow, the most visible text was "5,2 GHz computer"

      --
      One that hath name thou can not otter
  43. And what of the other limit? by holophrastic · · Score: 2, Insightful

    I would argue that most user tasks cannot be fundamentally parallel. Quite simply, if a user highlights some text, and hits the bold button, there really isn't anything to split across multiple cores. No matter how much processing is necessary to make the text bold (or to build the table, or to check the spelling of a word, or to format a report, or to calculate a number, or to make a decision -- as in A.I.) it's a serial concept, and a serial algorithm, and cannot be anything more. Serial is cool too remember.

    So we're looking at multiple tasks. Obvious gaming and operating systems get to split by engine (graphics, network, interface, each type of sound, A.I., et cetera). I'd guess that there is a limit of about 25 such engines that anyone can dream up. Obviously raytracing gets to have something like 20 cores per pixel, which is really really cool. But that's clearly the exception.

    So really, in my semi-expert and wholy professional opinion, I think priming is the way to go. That is, it takes the user up to a second to click a mouse button. So if the mouse is over a word, start guessing. Get ready to bold it, underline it, turn it into a table, look up related information, pronounce it, stretch it, whatever.

    Think of it as: "we have up to a full second to do something. We don't know what it's going to be, but we have all of these cores just sitting here. So we'll just start doing stuff." It's the off-screen buffering of the user task world.

    Which results in just about any task, no matter how complicated, can be instantly presented -- having already been calculated.

    Doesn't exactly save power, but hey, the whole point is to utilize power. And power requires power. There must be someone's law -- the conservation of power, or power conversion, or something that discusses converting power between various abstract or unrelated forms -- muscle to crank to generator to battery to floatig point to computing to management to food et cetera; whatever.

    Right, so priming / off-screen buffering / preloading. Might as well parse every document in the directory when you open the first one. Might as well load every application on start-up. Can't have idle cores lying around just for fun.

    Has anyone ever thought that maybe we won't run out of copper after all? I'd bet that at some point in the next twenty years, we go back to clock speed improvement. I'd guess that it's when core busing becomes rediculous.

    I still don't understand how we went from shared RAM as the greatest thing in the world to GPU's with on-board RAM, to CPU's with three levels of on-chip RAM, to cores each with their own on-core RAM.

    Hail to the bus driver; bus driver man.

  44. The Bill comes due by stox · · Score: 4, Insightful

    After years of driving the programming profession to its least common denominator, and eliminating anything that was considered non-essential, somebody is surprised that current professionals are not elastic enough to quickly adapt to a changing environment in hardware. Whoda thunk it? The ones, you may have left, with some skills are nearing retirement.

    --
    "To those who are overly cautious, everything is impossible. "
    1. Re:The Bill comes due by xtracto · · Score: 1

      And suddenly, companies that need full fledged Computer Scientists or Software Engineers (instead of code monkeys) turn to India, China, Mexico or any other country to get them... not very far away, considering just some months ago I read a story about the lack of Computer Scientists in USA; and people here were asking themselves why was that, if there are *lots* of unemployed slashdoters

      --
      Ubuntu is an African word meaning 'I can't configure Debian'
  45. Time by Baldrson · · Score: 1
    Maybe if physicists started with a proper theory of time they'd figure out the reason our formalisms are so prone to over-serialize algorithmic descriptions. But then asking physicists for consilience with other disciplines is basically like asking a gang of tweakers to reflect on the bloody holes they're itching in their heads.

    As for computer scientists... well... I really don't know that there is much going on of any value outside of Kolmogorov Complexity. Maybe something will come out of that that will resolve the issue while the physicists are trepanning themselves into theoretic epilepsy.

  46. A different approach to parallel programming by Simonetta · · Score: 0

    I've often wondered if parallel programming would be easier if it were done in Chinese characters instead of English/European alphabetical characters.
        Perhaps having a Chinese character represent a simple block of pre-compiled code that does one simple thing. Then the characters could be placed in two-dimensional order to form parallel threads. This would require a completely different approach to compiler development. But that would be OK because compilers are stuck in the 1970s anyway.
        Just getting away from the idea of having code based on a very limited set of alphanumeric characters strung together like beads on a string might help unlock a whole new era of innovative approaches to parallel program development strategies.
        It does go without saying that Chinese programmers would have an incredible advantage in any new system of programming that is based on Chinese characters. It may be possible that this subject is already a project under development in China. I'm a bit thick, so whenever I think of something independently that seems to be a completely new idea, inevitably someone smarter than me is already developing it.

    1. Re:A different approach to parallel programming by StarfishOne · · Score: 3, Insightful

      "Perhaps having a Chinese character represent a simple block of pre-compiled code that does one simple thing."

      Basically like a compiled function?

    2. Re:A different approach to parallel programming by jlarocco · · Score: 4, Informative

      I've often wondered if parallel programming would be easier if it were done in Chinese characters instead of English/European alphabetical characters.

      Perhaps having a Chinese character represent a simple block of pre-compiled code that does one simple thing. Then the characters could be placed in two-dimensional order to form parallel threads. This would require a completely different approach to compiler development. But that would be OK because compilers are stuck in the 1970s anyway.

      Maybe I'm a "bit thick", but that doesn't make any sense to me. It's an interesting idea, but I just don't see how it'd help parrallelize things. At the very least, it seems to be solving the wrong problem.

      The biggest problem right now is that it's really hard to split most tasks into parts that can be performed at the same time. Once a parrallel algorithm is devised, it's relatively easy to write a program that performs the task in parrallel.

      Also, I don't know what you mean about compilers being stuck in the 70s. There have been massive improvements to compilers in the last 40 years.

      Just getting away from the idea of having code based on a very limited set of alphanumeric characters strung together like beads on a string might help unlock a whole new era of innovative approaches to parallel program development strategies.

      But programming doesn't work like that. Individual characters in a programming language are almost irrelevant.

    3. Re:A different approach to parallel programming by try_anything · · Score: 3, Interesting

      How would a string of Chinese characters like beads on a string be any better than a string of alphanumeric characters like beads on a string? Many (most?) Chinese words are written using multiple characters, so a language that had a special use for lone characters would end up looking a lot like Fortran 77 anyway. (What does the FSSCRD function do?)

      I think you're reasoning from some notion about the way "Oriental" people think differently from "Western" people. I tend to doubt that idea based on the kinds of people who have enthusiastically pushed it: originally imperialist racists of various groups, each bent on proving the superiority of their group, and more recently western PC racists who compulsively idealize everything non-Western. Despite the taint of racism, the idea may have some basis in fact as well -- there is ongoing research that occasionally manages to produce some evidence for it -- but the sad fact is that we have only been able to create programming languages that express a very tiny subset of the way "Western" people supposedly think anyway. The problem is not a lack of nonlinear, context-sensitive ways of thinking; the problem is that before we can use a given way of thinking to communicate with a computer, we must essentially enable the computer to think the same way. If you buy into the western PC version of the dualism, "Oriental = nonlinear, inclusive, sensitive, flexible, context-sensitive; Western = linear, exclusive, autistic, rigid, blinkered," then digital computers are quintessentially Western beings that cannot be made to appreciate Eastern ways of thinking, at least not without a few more decades of AI research and performance improvements.

      The Chinese government might very well be hard at work creating a quintessentially Chinese programming language, but it's a bad idea to pin your hopes on political science. It tends to suck. On top of that, many excellent programming languages have been doomed by much smaller barriers to entry than learning an entirely new system of writing. On top of that, your 2D array of characters is doomed by the multitudes of multicharacter words in Chinese. To add yet more on top of that, another poster just pointed out that the idea that it expresses has already been expressed in other languages using ASCII.

      I wouldn't have bothered piling on you like this if your post didn't strike me as racist. The commonly accepted story about the differences between Eastern and Western ways of thinking is propagated by uninformed repitition. Chinese, Americans, left-wingers, right-wingers, everybody has learned to love it and interpret it to flatter their side, so they all repeat it in unison. It pollutes the discourse. Wouldn't it be nice if everyone who didn't have firsthand experience just shut the hell up? Then we might hear something different from the standard story that gets passed around like a centuries-old fruitcake. Or we might hear the same thing, but then at least it would mean something.

    4. Re:A different approach to parallel programming by nschubach · · Score: 1

      How would a string of Chinese characters like beads on a string be any better than a string of alphanumeric characters like beads on a string?
      It's simple. We replace the common English words with Chinese symbols so only the Chinese will understand how to program. After that occurs, China will assign 1 billion people to programming the world's PCs and will finally gain true socialist supremacy.
      --
      Every time I start to have faith in humanity, I ruin it by driving to work between 7 and 8 am.
    5. Re:A different approach to parallel programming by MillionthMonkey · · Score: 2, Interesting

      Perhaps having a Chinese character represent a simple block of pre-compiled code that does one simple thing. Then the characters could be placed in two-dimensional order to form parallel threads. This would require a completely different approach to compiler development. But that would be OK because compilers are stuck in the 1970s anyway.

      I see neither a connection between the choice of character set and parallel programming, nor anything in your post that is beyond trivial to do in ASCII:

      - For vertical side-by-side alignment, check your editor prefs in your IDE). If it is important that the source code itself be laid out horizontally like drapes, two dimensional languages in ASCII have already been tried and you can look into what happened with those.
      - Typically many of these threads are running the same code, so a separate column for each thread is of dubious value.
      - Even single threaded code forks around way too much to be visually representable by a column of glyphs.
      - Why not just use English words? They exist in comparable numbers to Chinese characters.
      - Existing compilers already convert methods into compressed representations of code that are basically equivalent to anything you're suggesting.
      - What's this about the 1970s? Compilers have a lot of optimizations now including the ability to recognize code written by dumb or lazy coders. If you're complaining about language design that's not the fault of the compiler which is just doing its job for a given language.

      Just getting away from the idea of having code based on a very limited set of alphanumeric characters strung together like beads on a string might help unlock a whole new era of innovative approaches to parallel program development strategies.

      It reminds me of the time I was on here arguing with a guy who said files would be easier to compress if they were converted to Chinese characters first, because then the file would be shorter. Exploding the set of characters, and having individual characters represent chunks of pre-compiled code as you're suggesting, would basically be like having thousands of reserved words and global functions. It sounds like hell the more I think about it. The actual character encoding system with left-right top-bottom semantics doesn't really get in the way of anything at a fundamental level.

      It does go without saying that Chinese programmers would have an incredible advantage in any new system of programming that is based on Chinese characters.

      Aha- here we see the motive behind the evil subversive plan for global compilation dominance...

      It may be possible that this subject is already a project under development in China.

      Maybe someone is working on such a thing- who knows? Why even bother? There are more English speakers in China than in the U.S. And you don't have to know much of a natural language to just code in a programming language that draws on it for its symbols. It's not like asking for a taxi or interviewing for a job in that natural language. Ruby was invented in Japan and is ASCII based, and the Chinese have an easy time picking it up because they're already used to ASCII languages and there are no Hiragana characters in Ruby itself AFAIK, not even in variable names.

    6. Re:A different approach to parallel programming by maxwell+demon · · Score: 1

      What does the FSSCRD function do?

      Force Serious System Crash, Recovery Disabled.
      --
      The Tao of math: The numbers you can count are not the real numbers.
    7. Re:A different approach to parallel programming by try_anything · · Score: 1

      Oh, I see, it's just like all the others!

    8. Re:A different approach to parallel programming by drsquare · · Score: 1

      It reminds me of the time I was on here arguing with a guy who said files would be easier to compress if they were converted to Chinese characters first, because then the file would be shorter.
      But Chinese characters would take up far more bits than roman letters, and there would be no patterns so it would be impossible to compress.
    9. Re:A different approach to parallel programming by Danga · · Score: 1

      But Chinese characters would take up far more bits than roman letters,

      Yes, each Chinese character may take up more room than each individual Roman character but what I think you are missing is that many strings of Roman characters could be "compressed" down into single Chinese characters (since each Chinese character can stand for a whole word or maybe even sentence). So, I could see this "compression" sort of working for files that are purely text but I don't think much "compression" would occur for binary files.

      and there would be no patterns so it would be impossible to compress.

      As illustrated above the "compression" does not occur after the Roman characters to Chinese characters conversion but during the translation. IE "In the morning sun the big, hairy, dog ate a black cat." would "compress" down into possibly a couple of Chinese characters so instead of the sentence taking ~55 bytes it may only take ~6 bytes.

      No matter what I would have to guess that the "compression" gained translating to Chinese characters would be so small that it would not be worth it for large data sets and since it would mainly only work for text files it makes it much less valuable.

      --
      Hey, there is only one Return and it's not of the King, it's of the Jedi.
    10. Re:A different approach to parallel programming by MillionthMonkey · · Score: 1

      As illustrated above the "compression" does not occur after the Roman characters to Chinese characters conversion but during the translation. IE "In the morning sun the big, hairy, dog ate a black cat." would "compress" down into possibly a couple of Chinese characters so instead of the sentence taking ~55 bytes it may only take ~6 bytes.

      I see eight nontrivial words to encode {"morning", "sun", "big", "hairy", "dog", "ate", "black", "cat"} which is way more than "~6 bytes"; try ~16. A Chinese glyph is like a word, not a letter. It contains about two bytes. Not knowing Chinese, I can encode each English word with about 2 bytes of information as its ordinal position within an English dictionary (with a 65536 word vocabulary). That's about what Chinese does for you here. (The symbol table itself doesn't need to be included in the file if the 8 symbols are already included in prior knowledge of Chinese- but for files large enough to be compressed this won't matter too much.)

      The resulting bytes from Chinese-level compression have much higher entropy (per byte) than raw English letters and don't compress as well because you've already resolved the alphabet to a 16-bit symbol table. It will compress down further to about the same number of bytes as compressed ordinary English. A single communicable idea ("sunny morning big hairy dog ate black cat") contains the same raw information regardless of language, unless it's an idiom or proverb or something like that.

      I recently had this same fight with a guy at work who wanted to tokenize common patterns in URLs ("http", "javascript:", "img src" etc.) before we applied gzip encoding to some HTML. He wanted to implement JavaScript on the other end that would query the server for his goofy token table over AJAX after the browser decompressed the HTML "halfway" at its normal http compression layer.

    11. Re:A different approach to parallel programming by amerinese · · Score: 1

      Absolutely fucking awesome post. Seldom seen these days on Slashdot.

    12. Re:A different approach to parallel programming by killjoy966 · · Score: 1

      I think you're reasoning from some notion about the way "Oriental" people think differently from "Western" people. Rugs are "Oriental", people are not.
      --

      Sigs are for suckers.

    13. Re:A different approach to parallel programming by try_anything · · Score: 1

      Oriental does apply to people, although that meaning has been so damaged by its association with backwards thinking that it has been essentially retired. I used it intentionally to highlight how out-of-date and unwelcome the original post's stereotypes are.

    14. Re:A different approach to parallel programming by Raenex · · Score: 1

      Wouldn't it be nice if everyone who didn't have firsthand experience just shut the hell up? No, because sometimes even second-hand information is better than no information. Other than that, I agree with your skepticism about "parallel" thinking.
    15. Re:A different approach to parallel programming by Danga · · Score: 1

      I see eight nontrivial words to encode {"morning", "sun", "big", "hairy", "dog", "ate", "black", "cat"} which is way more than "~6 bytes"; try ~16.

      I never claimed to know Chinese or how it works and that is why I said "possibly". Either way 16 bytes is still a hell of a lot less bytes than 55 and this is the compression for ONE SENTENCE.

      A Chinese glyph is like a word, not a letter. It contains about two bytes.

      I know it is like a word and not like a letter, that is why I said it could be kind of like "compression" and for my example that is why I guess that it may be possible to compress my sentence down to maybe 3 Chinese symbols taking up 6 bytes instead of 55 bytes. Even if the translation only got it down to 16 bytes that would still be a big improvement over the 55 bytes.

      Not knowing Chinese, I can encode each English word with about 2 bytes of information as its ordinal position within an English dictionary (with a 65536 word vocabulary).

      Okay, now WHY would you want to do that? You will be leaving out A LOT of words. One source of information that I trust claims there are over 170,000 words in the English language although about 47,000 are obsolete. However, even if you excluded the obsolete words you would still be looking at a table with over 120,000 entries in which case 2 byte encoding would just NOT work. Source here:

      http://www.askoxford.com/asktheexperts/faq/abouten glish/numberwords

      That is just WAY too many entries. Now compare this to Chinese symbols in which case there are only around 60,000 symbols which would work perfectly for 2 byte encoding:

      "The Hanyu dacidian that came out recently in mainland China lists over 60,000 characters."

      http://www.logoi.com/notes/chinese_symbols.html

      The resulting bytes from Chinese-level compression have much higher entropy (per byte) than raw English letters and don't compress as well because you've already resolved the alphabet to a 16-bit symbol table.

      As long as your data storage or transmission uses ECC and EDC then the entropy of the data should not be too much of a factor. Also, who cares if it doesn't compress well after it is translated to Chinese symbols, the whole point of doing the translation was to compress the text in which case it probably did a much better job than any compression algorithm in existence. How well the translated file compresses does not matter because it already is compressed although I bet it could compress just a little bit more. The real test is to compare the size of the original text file compressed with a standard compression algorithm to the size of the same text files size after being translated to Chinese symbols, my guess is the Chinese translation will be much smaller.

      It will compress down further to about the same number of bytes as compressed ordinary English

      Do you understand how compression like ZIP and RAR work? I have written a ZIP compression library so I know what I am talking about. There is some overhead involved, the final archive does not only contain the compressed data. In the case of creating a text file containing the sentence I originally mentioned and then compressing it using the best possible compression in ZIP and RAR the "compressed" file actually ends up LARGER. Sure, this probably would not happen if the file contained a whole lot more text but I still think the Chinese translation would end up with much higher compression in the end.

      I recently had this same fight with a guy at work who wanted to tokenize common patterns in URLs ("http", "javascript:", "img src" etc.) before we applied gzip encoding to some HTML. He wanted to implement JavaScript on the other end that would query the server for his goofy token table over AJAX after the browser decompressed the HTML "halfway" at

      --
      Hey, there is only one Return and it's not of the King, it's of the Jedi.
  47. Just look around by const · · Score: 2, Informative

    A lot of efforts are being done to simplify the parallel programming, both on micro scale and component scale. Just look through lambda-the-ultimate archives. Micro scale is mostly invisible to application programmers, and it is mostly done by compilers when they use SSE and friends, one of notable efforts of making it more explicit is OpenMP. On component scale, most of them are based on the message passing concurrency model (after you grok it, it is really really simple). The best effort that I have seen from point of view of usability is E programming language. I tried to clone its core ideas in my pet project AsyncObjects Framework, but usability is less than E's one because of the framework clutter.

  48. OpenMP again by S3D · · Score: 1

    OpenMP provide almost transparent implementation of automatic threads parallelization in many practical cases. It easy to learn and use. It work perfectly for embarrassingly parallel task, especially loop parallelization. The rule of the thumb for multithreading - if task couldn't be paralellized with OpenMP it's often is not worth the effort to paralellize at all.

  49. Abotu Games... by Raven737 · · Score: 1

    Well as stated before, you can't just parallelize any task, if you could then compilers would have done it for the programmers long ago.

    It's also pointless to parallelize any task depending directly on a limited shared resource, for example copying files from A to B isn't going to get any faster when you copy 3 files at once, it will in fact be slower (since the hard drive has to jump back in forth, NCQ might help, but it's still less then 100%).

    What i hear people bitch most about are Games. Games are not as easy to parallelize as some might think because some of the 'tasks' involved cannot be parallelized and those that can are usually tied by a together by a shared resources (i.e. graphics card, geometry, textures). For example, you can try to do do the geometry transformation parallelized and separate from a rendering thread, but when writing the transformed geometry back to, for example, the vertex buffer you have to lock that buffer, meaning any thread trying to read/write from it has to wait for the operation to complete. If each thread tried just tried to access the shared resource whenever they have finished, they may end up waiting a long time for another threads (such as the the rendering thread for example), or block other threads trying to access the same resource. If you have threads waiting on other threads most of the time then you already have removed most of the the parallel execution benefits, in fact, the threading overhead may be worse then benefit gained from parallel execution in the first place.
    Another thing is that even if most of the 'tasks' in a game have been parallelized, you still only see the 'weakest' link. For example, if you have a Geforce 2 GTS running the latest Unreal 3 Engine (if that where possible) then it won't matter that you have a 16 Core CPU and the game is parallelized every possible task. You still get crappy FPS. An usually the weakest link (task) is one that cannot be parallelized.

    1. Re:Abotu Games... by Anonymous Coward · · Score: 0

      You can parallelize filling vertex buffer and rendering using them just fine at cost of increased memory consumption: fill one buffer while you render off another. If you can spare more memory, have queue with ready-to-render buffers. When you want to generate image, you already know all the parameters.

      Even if you cannot parallelize 100%, you can still have a multi-stage pipeline so the cost is essentially pipe flush and re-initialization, the rest is possible to parallelize.

      In OpenGL side the same thing can be done using VBO's, however, in some cases DL's are faster (but not in skinning case for example).

  50. MMOGs by nick_davison · · Score: 1

    MMOGs are typically years late and I'll bet part of the problem is trying to be more parallel/distributed. Programming teams are relatively small parts of an MMOGs development (granted, the term "programmer" and boundaries of "programming team" get blurred as artists become "particle programmers" etc.).

    Taking a look at the credits list for one of the major MMOs I was involved with, there were a ten programmers, two additional programming credits, two lead engineers and a tech director listed. Call that 15-20 people, a few more if you add in the DB teams etc.

    Compare that to over 30 designers, design assistants and additional game design credits, 4 writers, 7 world/architecture personel, 9 characters/creatures folks, 5 animators, 19 motion capture personel (before the three actors) and one George Lucas.

    Companies go bust over late games. Sigil's gone in large part because they kept overrunning Microsoft's willingness to add another six months and another million or two in salaries, leading to Microsoft pulling out (and a lot more politics beyond). If the real cause of games running late was coding, an area that takes maybe 10% of the production budget, don't you think they'd throw double, even triple the resources at it (even if that means only a few more guys but hugely paid parallel coding geniuses) to avoid the massive costs associated with a delay?

    Think about it: A typical MMO lifecycle is around five years with a geared up team for maybe the last three. You run late by a year, you're paying 20-30% extra in salaries. If it was really a coding issue, wouldn't you triple the resources and pay less overall?

    The biggest challenge for most games is getting the game balance tweaked so it's atually fun, scrapping all the ideas you ran with for a year or two that seemed great but didn't work once lots of people were playing together, and populating enough content to stand up against games that have been out for half a decade and ship with ten expansion packs in one box set for less than the cost of your new release.

    Getting code to run in parallel isn't to be diminished... But the scale of where resources are put shows far more is invested in to art, design and content than ever goes near programming. If programming were really a bottleneck, it's an easy one to fix (even accepting that double the money doesn't equal half the time due to scaling issues).
  51. Obligatory by Architect_sasyr · · Score: 1, Funny

    Windows Vista

    --
    Me failed English...
    FreeBSD over Linux. If my comments seem odd, this may explain...
    1. Re:Obligatory by Jugalator · · Score: 1

      Huh? You've got to be kidding... The bottleneck in Vista is RAM, not CPU power. Heck, even in games, it's largely GPU and driver related. Maybe that's due to Vista and its DirectX 9 emulation layer in the end, but it sure as hell isn't about the CPU more than in XP. And Aero Glass runs on the GPU too.

      --
      Beware: In C++, your friends can see your privates!
    2. Re:Obligatory by node159 · · Score: 1

      Insightful? Moderators been smoking crack again?

      --
      GPLv2: I want my rights, I want my phone call! DRM: What use is a phone call, if you are unable to speak?
    3. Re:Obligatory by Architect_sasyr · · Score: 1

      Parent should be Insightful! Anyone who didn't detect the funny post in that should be taken out and shot...

      --
      Me failed English...
      FreeBSD over Linux. If my comments seem odd, this may explain...
  52. LabVIEW by mkirsch · · Score: 1

    Most programming languages today are text-based and follow the flow of instructions. Parallel programming is inherently hard and unnatural on these (basically all) languages. Programmer needs to think of atomicity, mutexes, semaphores, deadlocks, race conditions... Add to that the fact that compilers may reorder some instructions to optimize for this or that CPU and things become trickier. There is a language called LabVIEW by National Instruments. It's a Turing-complete data flow languange (not control-flow) and it happens to be completely graphical (sometimes it is refered to as G) - no typing required, just drawing wires that represent data to blocks that represent operations or functions. In this language, parallel programming is very, very natural. You just write your wires in parallel, they merge sometimes, they don't, etc. The scheduler in the runtime takes care of spawning threads and using available CPUs. While powerful, it is unfortunately very tailored for the test and measurement markets and there is no free version. If you are interested to try this completely different programming paradigm, however, I recommend you download a trial version and play with it. It's available for Windows, Mac, and Linux.

    1. Re:LabVIEW by cibyr · · Score: 1

      Sounds similar to RoboLab (the "programming language" that comes with lego mindstorms). And I couldn't stand it. I can't really remember exactly what I hated about it (it was a while ago), but I do remember that it was messy as hell unless you spend more time making sure your blocks lined up than actually thinking about your program and that I remember often thinking how much easier it would be to do things with a normal programming language.

      My teachers wouldn't let me use NQC either, so I was stuck with the damm thing. My friends referred to it as "robogay". Yeah, mod me -1, politically incorrect.

      --
      It's not exactly rocket surgery.
    2. Re:LabVIEW by Anonymous Coward · · Score: 0

      I believe first version of Mindstorms software was not based on LabVIEW. The NXT version is written by National Instruments http://www.ni.com/academic/mindstorms/.

      Going from C to LabVIEW was very easy, and I feel knowing LabVIEW made learning MFC / C++ easier too. But I have only written MFC/C++ programs that spawn 1 thread and its quite tricky. In LabVIEW I wrote quite a complex program for measuring motor performance that has 6 main threads, that my coworkers use almost daily.

      LabVIEW is geared towards engineers due to the data acquisition (And its like wiring up an electronic schematic), but it can be used as a generic programming language. One drawback is that it does require a runtime engine - so even the smallest apps have a 10MB install package. The best thing I like is that because each VI ("function") has a GUI, you can test the code as you write.

      The tricky thing with any multi-threaded app is race conditions.

    3. Re:LabVIEW by pbrooks100 · · Score: 1

      LabVIEW will allow you to create parallel code easily, but that doesn't mean that it will run WELL. It is important to understand any tool's features (and shortcomings) to use it to full potential. Give a caveman a hammer, chisel and some stone and you might get a mortar for crushing food. Don't expect the Pantheon or Mt Rushmore in a week.

      Anyone interested in advanced LabVIEW use and capabilities should visit the LabVIEW Advanced Virtual Architects forum (http://forums.lavag.org/) Discussion areas include application design and architecture, high speed communications, UI design and customization and internet/database connectivity issues.

    4. Re:LabVIEW by Anonymous Coward · · Score: 0

      Labview has a lot of good things going for it, which mostly revolve around things like
      1) You can build things fast with less planning for the diagram is the code.
      2) It is automatically parallel
      3) Debugging is about as easy as it gets

      Unfortunately you pay for that, even ignoring the new OOP stuff that is generally just slow due in part to the by value design, the most common thing you pay for is in memory allocation. Quite often labview will make copies of complex clusters and such when you don't intend it to. You can get around this by continually using the profiler and checking for buffer allocations along with recoding when necessary, but that is an active process. Of course if you don't need speed then its not a problem to let the compiler do whatever it wants.

      My general conclusion is right now, if you need the absolute fastest code for a large project it might actually still be worthwhile using labview to get the skeleton in place and debug how your going to do everything, but then if you really need the fastest posslbe, ultimately you'd have to move to another language like C or what have you. Of course C won't automatically multithread simple things, but then with C you can presumably make intelligent choices _yourself_ versus praying to the compiler. Labview does also allow you to call external code, but some care might be needed to make sure that call is reentrant.itself.

      All in all, while I like a lot of things about labview, it is not the definitive answer to parallel program, at least not yet. I think too much focus has been put on ease of use, over being fast and optimal.

  53. My opinion. by Pe+Elle · · Score: 1

    K here is my two cents.

    Computers have been single processor systems for a long time. We have developed around that concept for a long time. A normal binary tree, is not any faster on a multi processor system than a single.

    I see 2 problems.
    1. Most CS students are not taught to utilize multi-threading(parallel) efficiently(when it is useful, and when it is not), or even worse they just get a crash course in fork.
    2. There are not many operations or algorithms as of yet that map easily to a parallel enviornment.

  54. We need good tools by benjymouse · · Score: 1

    Parallel programming is incredibly hard to do right, only novice programmers in the field will claim otherwise. Consider race/starve conditions, the fact that parallel programs are very hard to debug, hard to test. On top of that the can of worm called thread/process synchronization, which in modern architectures with processor caches etc. have not become any easier. You cannot change the property of an object and rely on another thread picking it up, even after a protected section. The other cpu may just have that propertys memory content in its own cache. Declaring every property of our program volatile is clearly not the way, as it would defeit the benefits of running in parallel in the first case.

    On the other hand many of us are already programming parallel threads/processes when we program for an application server. The typical web application server will handle a number of concurrent requests, but will serialize access to the relevant common object, namely the session abstraction.

    High end database systems have been doing parallel execution of queries for years. Clearly this is a very good abstraction as we don't even have to know that its taking place.

    A very common pattern seen in programs is looping through an array or list to do something, like e.g. a transform or performing specific actions on select items. Most of the time we just want the work done and don't really care whether it is done in parallel or serialized, only our programming language forces us to do the latter.

    Closures is a (small) step on the road to taking advantage of multiple CPUs and -cores. Microsoft LINQ (to objects) actually brings the parallel traversal of in-memory collections within reach for common developers.

    We need to know the theory behind parallel programming to understand concepts such as "volatile" variables etc, but we shouldn't need to be concerned with the complexities in every single line of code.

    I have a feeling that the statically typed high level languages will have an advantage here. Consider Java/.NET which uses a JIT compiler on the target architecture. Doing static analysis on a program with respect to the target architecture will be easier if the optimizer/compiler actually knows the types during JITing.

    --
    Reading slashdot one-liner: (irm http://rss.slashdot.org/Slashdot/slashdot).rdf.item | fl title,desc*
  55. What kind of parallel programming? by david.emery · · Score: 3, Insightful

    Many of the responses here, frankly, demonstrate how poorly people understand both the problem and the potential solutions.

    Are we talking about situations that lend themselves to data flow techniques? Or Single Instruction/Multiple Data (e.g. vector) techniques? Or problems that can be broken down and distributed, requiring explicit synchronization or avoidance?

    I agree with other posters (and I've said it elsewhere on /.) that for parallel/distributed processing, Language Does Matter. (And UML is clearly part of the problem...)

    Then there's the related issue of long-lived computation. Many of the interesting problems in the real-world take more than a couple of seconds to run, even on today's machines. So you have to worry about faults, failures, timeouts, etc.

    One place to start for distributed processing kinds of problems, including fault tolerance, is the work of Nancy Lynch of MIT. She has 2 books out (unfortunately not cheap), "Distributed Algorithms" and "Atomic Transactions". (No personal/financial connection, but I've read & used results from her papers for many years...)

    I get the sense that parallelism/distributed computation is not taught at the undergrad level (it's been a long time since I was an undergrad, and mine is not a computer science/software engineering/computer engineering degree.) And that's a big part of the problem...

            dave

    1. Re:What kind of parallel programming? by ivucica · · Score: 1

      When speaking of parallel programming, I think of multithreaded programming. (Close enough, eh?)

      Some problems are rather hard to be split up into pieces. For example, I'm pretty sure that a game client I'm coding would run much smoother if it could do networking and processing of data it receives in one thread, and OpenGL rendering in another. It grew so unstable that I ended up adding "critical sections" all around. Didn't help much. Added too much junk code. I ended up wrapping the entire contents of ParsePacket() and Render() in "critical section". Meaning I nullified all benefits of multithreading except for having blocking sockets which are surely giving better performance.

      Even if you write multithreaded code, you end up having problems with tons of code you didn't write doesn't like multithreading at all. And I use tons of libraries (LibTomMath for encryption, Lib3ds for loading 3d models, OpenGL, GLUT for managing window and GL context...) for which I can't guarantee they'll behave well in a threaded environment. That sucks, and it's hard to catch and squash thread-caused problems.

      It's better to do sequential coding of games after all, or split pretty much independent pieces into separate threads. Server programs can easily profit from threading, but clients aren't so easy. Intel and the crew are aware they can't do much progress, and are throwing the problem away and onto programmers' backs. Indie and free software developers are going to have one hell of a ride in the next few years.

      And while at it, Erlang seems interesting, but it's not following the old programming style, and won't get a large following in the mainstream for a long time. Nothing will happen until C/++ gets some good multithreading compilers. "I spit on my words", Borat would say, but there's only one company that can provide this, and that's Microsoft. Eww. But GCC does not move in that direction, and I have a feeling that MSVC is.

      Guess we have to wait and see.

    2. Re:What kind of parallel programming? by david.emery · · Score: 2, Interesting

      If you continue to depend on C and C++ for doing this kind of work, you can continue to expect these kinds of results.

      Ada95 is a -much better- choice for this kind of programming, with a rich set of concurrency primitives (for both synchronization (rendezvous) and avoidance (protected objects), integrated into both a strong typing system and an object-oriented approach. And there's a good compliler in the GNU compiler family.

      But programming language research seems to have been abandoned over the last 20 years, as if C++ and Java represented the final solution.

      C/C++ and even Java thread models are truly appalling, and they were known to be bug-ridden back in the 90s when they were being standardized. I remember during a POSIX meeting, the people working on the Ada binding detected a race condition anomoly in the C/Pthreads specification. Ted Baker sketched the problem out in terms of Ada tasks and we went back, looked at the C & text, and verified Ted's observation. We called in some representatives from the C/Pthreads group, and it took them about 30 minutes just to work out a 'language'/notation to reason about their own standard. After that 30 minute discussion, they came back and looked at our work, and said "Geez, you're right!".

      Another area where we need better tools are for the debugging of concurrent, parallel and distributed programs, preferrably starting with analytical tools that prevent, or at least detect before runtime, these kinds of problems. Debugging should be an embarrassment to an professional programmer, as it's basically a representation that you don't know what your code is actually doing.

      I'm no fan of "model-driven architecture" in general, but model-driven approaches, coupled with the right kind of source code analysis tools, have real promise here. (Look at how Microsoft, a company I rarely praise, has used this for checking out device drivers...)

                dave

  56. Three basic problems by bm_luethke · · Score: 2, Interesting

    There are three basic "problems" and to some extent I think they are unsolvable.

    First is debugging tools. People are used to having a nice neat step through debugger - press some key to execute the next statement. Because a large part of parallel processing does not conform to that process you have to add in your own debug code (even if using one of the parallel debuggers out there). I see no way around this one - you can not have a deterministic debugger on a non-deterministic system and I see no way for parallel systems to generally be deterministic in the sense of "press F8 to execute next line". This increases cost as you can not simply hire a cheap "code monkey" to do the job.

    Second is just general complexity, things like file locks, critical sections, race conditions, etc. Even if you deal with them every single day and have been doing it for the last 20 years these are still complex issue when something fails. I also see no way around this one, though there have been some really nice advances in recent times and there is still a long way to go before I think we have mostly maxed out the tools. Somebody has to deal with this and a good deal will eventually be shoved off to the tools, but when that happens figuring out where the error is will be a real bitch (ask anyone who eventually found an esoteric bug in a standard library how much work *that* took). While quite solvable, this also increases cost.

    Lastly you have Amdahl's law - basically you can not parallelize everything and performance degrades quickly the more serialization you have. I do not think that the real performance of SMP's or multi-core systems for the average user is going to come in single application performance - you just can not parallelize the typical applications that much. Where the performance comes in is allowing several things to go on at a time, basically that really large system tray many people run will be going across multiple processors or cores and not degrade performance that much. Though this really helps - I've ran two processor systems on my home systems for years and it is interesting how little processor power I need for games compared to the minimum specs even when I do not bother with paying attention to what is currently running.

    So, in short, not really too hard, it's a level of complexity that many have done well with in the past and will continue to do so, but that the problem space doesn't map well to parallelization. There is some level of "too hard" when you are asking if VB only people who think that HTML should be listed as a programming language and can not survive without Microsoft's wizard (note that using VB isn't the bad part - lots and lots of really good programmers use it at work because that is what will sale), but competent programmers/software engineers are quite capable of using it. I do not think that the benefits within most single applications are worth the cost, though as an overall system it will help quite a bit.

    --
    ------- Sorry about the spelling, I suffer from two problems. Dyslexia makes it difficult to spell well, lazy makes it
    1. Re:Three basic problems by tomstdenis · · Score: 1

      Last I checked gdb could debug multi-threaded [process] processes. If you want to step a process you just pick whichever to step.

      Tom

      --
      Someday, I'll have a real sig.
    2. Re:Three basic problems by bm_luethke · · Score: 1

      Good luck catching race conditions with that.

      --
      ------- Sorry about the spelling, I suffer from two problems. Dyslexia makes it difficult to spell well, lazy makes it
  57. We don't think in recursion either by TheMCP · · Score: 4, Interesting

    Most programmers have difficulty thinking about recursive processes as well, but there are still some who don't and we still have use for them. I should say "us", as I make many other programmers batty by using recursion frequently. Programmers tell me all the time that they find recursion difficult - difficult to write, difficult to trace, difficult to understand, difficult to debug. Conversely, I find it easier - all I have to do is reduce the problem to its simplest form and determine the end case, and a tiny snip of code will do where a huge mess of iterative code would otherwise have been required. So, I don't understand why anyone would want to write iterative code when recursion can solve the problem.

    I suspect that parallel programming may be similar - some programmers will "get it", others won't. Those who "get it" will find it fun and easy and be unable to understand why everyone else finds it hard.

    Also, most developement tools were created with a single processor system in mind: IDEs for parallel programming are a new-ish concept and there are few. As more are developed we'll learn about how the computer can best help the programmer to create code for a parallel system, and the whole process can become more efficient. Or maybe automated entirely; at least in some cases, if the code can be effectively profiled the computer may be able to determine how to parallelize it and the programmer may not have to worry about it. So, I think it's premature to argue about whether parallel programming is hard or not - it's different, but until we have taken the time to further develop the relevant tools, we won't know if it's really hard or not.

    And of course, for a lot of tasks it simply won't *matter* - anything with a live user sitting there, for example, only has to be fast enough that the person perceives it as being instantaneous. Any faster than that is essentially useless. So, for anything that has states requiring user input, there is a "fast enough" beyond which we need not bother optimizing unless we're just trying to speed up the system as a whole, and that sort of optimization is usually done at the compiler level. It is only for software requiring unusually large amounts of computation or for systems which have been abstracted to the point of being massively inefficient beneath the surface that the fastest possible computing speed is really required, and those are the sorts of systems to which specialist programmers could be applied.

    1. Re:We don't think in recursion either by gnalre · · Score: 2, Insightful

      Brought up programming C and Fortran I struggled for a long time with recursion. When I moved on to using functional languages(erlang to be specific) because recursion is integral(no loop construct) I eventually became quite comfortable with it.

      It goes to show to become a better programmer investigate as many programming paradigms as possible.

      --
      Choose your allies carefully, it is highly unlikely you will be held accountable for the actions of your enemies
    2. Re:We don't think in recursion either by Jasin+Natael · · Score: 1

      And of course, for a lot of tasks it simply won't *matter* - anything with a live user sitting there, for example, only has to be fast enough that the person perceives it as being instantaneous. Any faster than that is essentially useless. So, for anything that has states requiring user input, there is a "fast enough" beyond which we need not bother optimizing unless we're just trying to speed up the system as a whole, and that sort of optimization is usually done at the compiler level.

      I'll have to disagree a bit there. I think it's in everyone's best interest that computers use as little power and generate as little heat as possible. What used to take a roomful of vacuum tubes can now be done with a handheld unit powered by ambient indoor light through a 1x3cm solar collector.

      Whether you believe current energy trends are sustainable or not, the world will be a better place for software that consumes less energy at runtime. If your PDA or cellphone can get enough power from kinetic or solar energy, you'll never have to plug the thing in. Whatever energy would have fueled the bloat in Windows Mobile 6, and that wall-wart that never gets unplugged, can now be used to grow food for someone in the 3rd world -- and their children can get an education instead of making up that shortfall in the fields.

      I know this is quite melodromatic, but there are millions of devices out there, and it's kind of our job to make sure they're operating efficiently. We'll never (I hope) face a public outcry like the US automakers for their stubbornly low gas mileages, but that doesn't excuse inefficiency. Plugging a computer into the power grid doesn't excuse waste. Unless, that is, you think it's good for some multiple of all the saved programmer-hours to be made up in resource-hunting and agriculture instead.

      Think a little bit about software efficiency as a measure of energy, like grams of coal per problem solved. It is pretty clear that even though it may not seem worthwhile to optimize now, that over time and with millions, nay billions, of computing devices online, that eventually it must. Even if you don't consider long-term energy cost, making a laptop run ten minutes longer with your application may just make someone's day.

      --
      True science means that when you re-evaluate the evidence, you re-evaluate your faith.
    3. Re:We don't think in recursion either by SLi · · Score: 1

      I too actually find recursion often the more intuitive way. It must be the background in mathematics.

    4. Re:We don't think in recursion either by qwijibo · · Score: 1

      There are very few programs that are as commonly used as cars. The ones that are that common are written by large companies who don't care about things like efficient energy utilization. Computers waste power being on all the time doing nothing, or waiting for the user to do something. Basically, energy is being wasted for every computer that is online. If no one cares about that, you're not going to convince anyone to spend substantially longer on a program to make it slightly more efficient in a way that no one will perceive. The better optimized a program is, the longer it will take to optimize it further. There is a point of diminishing returns and when you look at the amount of expensive people time that goes into optimization, "barely functional" is the target most companies will set.

    5. Re:We don't think in recursion either by MajroMax · · Score: 1

      Or maybe automated entirely; at least in some cases, if the code can be effectively profiled the computer may be able to determine how to parallelize it and the programmer may not have to worry about it.

      Not with common languages. Automatic parallelization relies on the computer knowing what data is going to be touched by what process when. In a flowchart, that's simple enough, but the common computing languages (C and its derivatives included) don't offer enough guarantees to reliably parallelize, especially without throwing "restrict" and "const" keywords everywhere.

      In a way, the automatic parallelization problem is similar to the problem of high-level optimization of dynamic languages, like Python. The language is powerful, but parallelization (and, in the case of interpreted languages, high-performance compilation) require knowing exactly what is happening in a way that the language doesn't normally provide.

      --
      "Evil company X is threatening to restrict our rights! Let's all get together to stop--OOOH! SHINEY!!!" -- AC
    6. Re:We don't think in recursion either by Prof.Phreak · · Score: 1

      "To understand recursion, one must first understand recursion." - Anonymous

      --

      "If anything can go wrong, it will." - Murphy

  58. Not too hard at all by JustNiz · · Score: 3, Interesting

    Parallel programming is NOT too hard. Yes its harder than a single-threaded approach sometimes, but in my experience usually the problem maps more naturally into a multi-threaded paradigm.
    The real probelm is this: I've seen time and again that the real problem is that most companies do not require, recognise, or reward high technical skill, experience and ability instead they favour minimal cost and speed of product delivery times over quality.
    Also it seems most Human Resources staff/agents don't have the necessary skills to actually identify skilled Software Developers compared to useless Software Developers that have a few matching buzzwords on their resume, because they themselves don't understand enough to ask the right questions so resort to resume-keyword matching.
    The consequence is that the whole notion of Software Development being a skilled profession is being undermined and devalued. This is allowing a vast amount of people to be employed as Software Developers that don't have the natural ability and/or proper training to do the job.
    To those people, parallel programming IS hard. To anyone with some natural ability, the proper understanding of the issues (you get from say a BS Computer Science degree) and a naturally rigorus approach, no it really isn't.

    1. Re:Not too hard at all by Shados · · Score: 1

      Thats so true. The thing is, in software developement, for developers with X years of experience, and exactly the same skillset on their resume, you'll have actual variation in skills going to a factor of 10 and more. But too often, HR will go "How many certifications do you have? How long exactly, in months, did you work with this technology?", and stop there... Not counting that having 5 years experience working with technology Y here and there will never equate to working with it for 2 years 40 hours a week, and that the guy who only cares about his paycheck will never be able to match the guy who lives for that stuff, even with 5 times the experience.

      Personally, I don't even have a CS degree, and parallel programming feels fairly intuitive to me, it is just a bit trickier to debug (obviously, since most mainstream debugging tools are weak in that department), but thats it, and I've done some pretty complicated stuff...

    2. Re:Not too hard at all by Anonymous Coward · · Score: 0

      It's not really hard to write data parallel codes (SIMD).
      It's not really hard to split your code into several threads.
      What is really difficult is :
      1) to write EFFICIENT parallel codes !!!
      2) to write PORTABLE parallel codes (it means for me : independent of a given architecture). Well, your program can take advantage of 2 processors but what happens on 4 processors, or on a distributed architecture (with network communications)???
      3) to SCHEDULE concurrent threads and processes efficiently. Indeed OS schedulers do not take care of synchronizations between threads...

    3. Re:Not too hard at all by JustNiz · · Score: 1

      Baloney.

      1) happens automatically if you analyse the problem properly and engineer a good architecture.

      2) Simple. Just use Posix threads.

      3) You shouldn't worry at all about this low-level stuff at the application level. You espeically shouldn't write your code with a specific number of cores in mind. ( # of threads ) is not in anyway related to ( # of cores ). The only difference the number of cores actually makes is different scheduling. Your code should not assume any particular scheduling otherwise that means its buggy and/or badly architected.

      As long as you do proper locking etc. Your threads will all get time. Remember a locked thread gives up its time to other threads. Let the kernel worry about the actual scheduling.

    4. Re:Not too hard at all by jmcdood · · Score: 1


      I think many of the posts here are from programmers who are stroking their own egos. there are fairly well understood types of programmers...

      although 'programmer' or 'software developer' are general terms, they may mean the comp sci or otherwise specialized type who focuses on one aspect. they are by far the loudest here, and don't mind insulting other people or ironically insulting other people's way of working while promoting their own. they like to pretend they are the only ones with hard problems.

      there are all kinds or hard problems. making an interface work for a blind or novice user. making something work in a complex business environment and can be supported in a coarse grained, heterogeneous environment. usually, performance is the least of worries. visual tools have good applications, but there will always be 'problems' that are just out of the reach of visual tools, that require reaching into systems or framework APIs and writing new code, hopefully with some skill (though well designed base APIs can cover for a lot of ineptness, it will bite you in the end), yet don't require CS type knowledge. for these kinds of problems, a person's care about their end users and the future of their code is more important. you don't need matrix calculations to create a good system that suits the end users, and I doubt most of these macho programmers could be bothered to design a good end user system.

    5. Re:Not too hard at all by Anonymous Coward · · Score: 0

      Posix threads are not the universal solution.
      1) so you assume that efficiency depends on architecture ;-)
      2) If you consider a parallel code for clusters then you have to use a message passing library and the cost is not the same since you have non negligible communication/synchronization unlike shared memory computers. Consequently an "efficient" code can be very different from one arch to another.
      3) it is easy to write codes without the number of cores in mind for SIMD problems BUT if your code has a lot of irregular dependencies between tasks then you have to order them correctly depending on the number of available processors.
      The scheduling is not important for correctness of parallel codes, it is important for performance ! for example the Linux scheduler (2.6.12) gives priority to threads performing lots of I/O operations consequently if you want/need to give more priority to a computation thread then you have to change its priority...

    6. Re:Not too hard at all by Raenex · · Score: 1

      Capitals at the start of sentences make your message easier to read. Slashdot isn't a chat client.

    7. Re:Not too hard at all by jmcdood · · Score: 1

      Also make sure you keep your messages on topic.

  59. Re:Careful with process algebra and process calcul by mpe · · Score: 1

    This is OK as a way of defining semantics, but not for execution in a truly parallel environment. In essence, the semantic model says that running computation A in parallel with computation B is the same as executing "A" then "B" or "B" then "A". Notice that the parallelism has been removed to make the semantics easier to reason about.

    The thing to consider also is that the number of permutations is N! where N is the number of tasks you want to run in parallel. Thus even as few as 8 tasks means you have more than 40 thousand cases you need to be sure are actually independent.

  60. Re:Careful with process algebra and process calcul by GileadGreene · · Score: 1

    They all use an interleaved concurrency model as the basis for their semantics. This is OK as a way of defining semantics, but not for execution in a truly parallel environment. In essence, the semantic model says that running computation A in parallel with computation B is the same as executing "A" then "B" or "B" then "A". Notice that the parallelism has been removed to make the semantics easier to reason about.

    To a certain extent, that's a matter of interpretation and/or abstraction. Simultaneity of events is a tricky concept: it's always possible that if you look closely enough, you'll find that two things which appear "simultaneous" really aren't, but are actually interleaved. That's effectively the stance that calculi like CSP and the pi-calculus take: as you rightly point out, they make a fundamental assumption that events are "instantaneous" and indivisible, and simply cannot occur "simultaneously". However, all is not lost, since if you need to represent something that has any real duration, you can model it as a pair of events ("start" and "finish", or something similar). As for whether the interleaving model makes an acceptable basis for execution in a "truly" parallel environment, I guess it depends on what you mean by "truly" parallel. The success of the occam programming language running on networks of transputers would seem to provide a proof-by-example that the interleaving model can work in practice. Erlang provides a similar, more modern proof-by-example. But I suppose those may not count as "truly" parallel, in that they do enforce some serialization of events at the interfaces of individual processes, even if most of the system is operating "in parallel".

    Having said all of that, there's been some work done on providing a "true concurrency" semantics for CSP (not sure about the pi-calculus). See, for example, recent work in that area by Adrian Lawrence or Marc Smith. There has also been a bunch of work on other "true concurrency" process algebras. So to claim that "They all use an interleaved concurrency model..." is incorrect. rather, the interleaved concurrency model has so far proved adequate for the design problems to which the calculi in question have been applied (see my comments above about occam and the transputer).

    In a truly parallel application, you need to be very sure that executing "A" in parallel with "B" is not actually going to break anything.
    I can only really see that being an issue if A and B can both affect the same piece of state simultaneously (willing to be corrected on that count though - I just can't envision any other situation where it'd be an issue). Languages built on models like CSP enforce the interleaving of A and B if they are affecting the same state, as a byproduct of the share-nothing approach to state encapsulation. Note that that doesn't prevent A and B from occurring at the "same time" if they're not affecting the same piece of state.

    Petri nets are truly parallel, but also introduce some synchronisation requirements. Models based on Winskel's event structures are somewhat better, but not that widely known or understood.
    Both Petri nets and Winskel's event structures certainly have much to recommend them. However, in both cases, my impression is that they are better suited to use as tools for providing a semantics (much as traces provide a semantics to CSP, or labelled transition systems to the pi-calculus), rather than as something that one would actually want to use as the basis for developing a design or a programming language. Perhaps an event-structure-based semantics of something like CSP would be useful (I gather Winskel did some work on that kind of thing back in the early 80's, but I'm not sure if he's done much with it since - my quick skim of his work on HOPLA wasn't enough to determine if it provides "true" concurrency or not).
  61. Parallel Programming is EASY (APL, J, K langauges) by SimBuddha · · Score: 2, Insightful

    I've been programming using parallel techniques for more than 25 years using APL.
    I was so imnpressed with APL that I implemented an APL like derivative language
    called Simmunity which is a hybrid compiler for an APL like syntax. Simmunity
    can be targeted at a parallel processor implemented in FPGA's that provides
    multiple simultaneously executing vector/matrix operations in parallel...
    (stay tuned for more info)

    The quintessential parallel database programming language available is clearly
    KxSystems Q and KDB+
    See the faq at http://kx.com/faq/ and tutorial at http://kx.com/q/d/primer.htm

    Ken Iverson invented APL and then the J language which anyone interested in
    really discussing parallel programming should look at closely. The Connection
    Machine LISP had many of the APL operators/functions and certainly Map/Reduce
    that it added to provide a convienent parallel expression langauge

    Most programmers think in terms of sequential code execution with threads and
    processes. APL incourages the programmer to conceive of programming using
    vector and matrix operations to process strings and numbers and manipulate
    data like a spreadsheet. An application that people might be familiar with
    is Lotus Improv which provided naturally parallel expressions based on a subset
    of APL operations.

    Cheers, Simbuddha

  62. Biz apps do it all the time by Tablizer · · Score: 1

    Multiple smallish tasks or events that communicate mostly via a RDBMS is a common technique (AKA "client/server"). Transactions and A.C.I.D. take care of a lot of the nitty gritty of multiple communicating processes. Even different prog languages. Other domains can learn from this.

  63. How you can call yourself a programmer by Anonymous Coward · · Score: 0

    And yet have no concept of what an address bus is (or any other fundamental uP concept)?? Honestly, how do you expect to wrap your head around Parallel Programming if you don't have even the slightest idea of what's going on at the hardware level? Sorry for the troll tone, but the illusions need to be shattered.

  64. Parallel Programming Not For Programmer by Anonymous Coward · · Score: 0

    It needs project management skill rather than programming skill for parallel programming!

    But after all, who need parallel programming? Why we need to take the trouble adding non-productive communication complexity? Unless for number crunching or something like that, what we need are multi-threading though it is not all programmers can handle well yet.

  65. It's not that hard by PingXao · · Score: 1

    I've been doing it since the early OS/2 days. The victory of Windows over OS/2 cemented a lot of bad practices firmly into place IMO. New "technology" was whatever the MS buzzword of the day was. None of it ever really examined the benefits of parallel programming and multi-threading. Another reason it's not particularly widespread is because it doesn't lend itself well to seat-of-the-pants on-the-fly coding. The old adage that "the documentation is the code" doesn't cut it when you absolutely have to buckle down and do some design work at the outset to partition the problem and decide how the different threads and/or processes are going to interact with each other. Things like avoiding deadlocks through synchronization mechanisms and such simply have to be documented, and nobody likes to write documentation.

  66. Patience is not a goal here. by tempest69 · · Score: 2, Insightful

    Oh noes! Software doesn't get churned out immediately upon the suggestion of parallel programming! Programmers might actually be debugging their own code! There's nothing new here: just somebody being impatient. Parallel code is getting written. It is not difficult, nor are the tools inadequate. What we have is non-programmers not understanding that it takes a while to write new code. If anything, that the world hasn't exploded with massive amounts of parallel code is a good thing: it means that proper engineering practice is being used to develop sound programs, and the jonny-come-lately programmers aren't able to fake their way into the marketplace with crappy code, like they did 10 years ago.
    1. Parallel code is being written, agreed, but it is specialty engines that are getting it. General purpose parallel code isnt out there.. we just have pet projects that include parallelism but for the most part are ported serial code

    2. Parallel code is a monster to write. I'm not talking simple scatter-gather data spreaders. Imaging Adobe photoshop running across a 400 machine cluster, handling hundreds of users at a time. The data concurency issues, data residence, locking, message handling, message reordering Total bloody nightmare...., If youve parallelized a markov model it doesn't really compare.

    3. The tools arent adequate. tracing a data race, or deadlock in a cluster is a beast. MPI and PVM are nice but are really narrow in the scope that they handle problems.

    4. It isnt just non-programmers.. Parallel is a whole different scale of complexity... Almost everything I see is a "parallelize the brute zones of a specialty engine once it works in serial"..... Its an important baby step and it really blows non-programmers for a loop. But we are a far sight from having an implicitly parallel version of MS-word.

    5. Parallel isnt new, dual cpu boxes have been in userspace since the late 90's, it has been mostly ignored by applications. The use of network resources is horribly behind the times. The ability to aggregate resources on the fly is a total joke compared to where it should be.

    Storm

    1. Re:Patience is not a goal here. by Anonymous Coward · · Score: 0

      "Imaging Adobe photoshop running across a 400 machine cluster, handling hundreds of users at a time."

      What the? Why would you want to do this? I think the only problem with parallel programming is that people are given lots of processors and come up with utterly ridiculous uses for them.

    2. Re:Patience is not a goal here. by dkf · · Score: 1

      1. Parallel code is being written, agreed, but it is specialty engines that are getting it. General purpose parallel code isnt out there.. we just have pet projects that include parallelism but for the most part are ported serial code
      There is a lot of parallel code out there. Most of it is distributed code. It's called the internet. Biggest. Parallel. System. Ever.

      OK, it's made from lots of bits of serial code. Good reason for that; it works. And if you want to make working parallel code without pulling out your hair, design to not use a shared memory model, but instead stick to message passing. It's a bit slower (but not that much) and yet it is far easier to debug, since messaging semantics is pretty easy to understand on the level of individual systems.

      2. Parallel code is a monster to write. I'm not talking simple scatter-gather data spreaders. Imaging Adobe photoshop running across a 400 machine cluster, handling hundreds of users at a time. The data concurency issues, data residence, locking, message handling, message reordering Total bloody nightmare...., If youve parallelized a markov model it doesn't really compare.
      Either you're using shared memory model parallelism (a freaking nightmare) or you're using message passing parallelism. If you're using message passing, the main problem is message ordering (though it's pretty simple to ensure that the order of messages between any two endpoints is preserved). Anyone writing serious internet apps needs to deal with this anyway, so the experience is more widespread than you seem to think.

      3. The tools arent adequate. tracing a data race, or deadlock in a cluster is a beast. MPI and PVM are nice but are really narrow in the scope that they handle problems.
      Sounds like you're trying to use a shared-memory model. Good luck keeping your hair in tracking down those bugs...

      4. It isnt just non-programmers.. Parallel is a whole different scale of complexity... Almost everything I see is a "parallelize the brute zones of a specialty engine once it works in serial"..... Its an important baby step and it really blows non-programmers for a loop. But we are a far sight from having an implicitly parallel version of MS-word.
      Out of curiosity, what on earth would Word get from parallel programming? (I can see what it would gain from distributed programming though; I've worked on shared documents over the web and that's often really productive.) Here's a little secret: not everything needs to be parallel, and lots of stuff is actually already fast enough (it gets back to waiting for user input long before the user notices that the computer was doing anything).

      However, if you're seriously wanting to do parallel programming, it really helps to have a proper CS education. Understanding parallel and distributed programming is hard, but there have been quite a lot of basic conceptual tools for working with these things for a long time now. But CS is not in itself enough; a practical appreciation of just how many things can go wrong in practice is also needed. Parallel programming is not a practice that suits people who like to cut corners. Time to jettison those bad habits!

      5. Parallel isnt new, dual cpu boxes have been in userspace since the late 90's, it has been mostly ignored by applications. The use of network resources is horribly behind the times. The ability to aggregate resources on the fly is a total joke compared to where it should be.
      Have you actually tried doing this? Or are you just mouthing off with no experience? If you ever want to scale up beyond specialized dedicated clusters, there are whole new classes of problem that have to be addressed. (For example, security becomes suddenly all encompassing, and many of the cheap hacks like SSL and VPNs either don't really apply or need a lot of enhancements.) Of course, there are people working on dealing with these problems; there's at least 4 different standards bodies dealing with various aspects. Some you will even have heard of (IETF, W3C)...
      --
      "Little does he know, but there is no 'I' in 'Idiot'!"
    3. Re:Patience is not a goal here. by smellotron · · Score: 1

      Out of curiosity, what on earth would Word get from parallel programming?
      • Nonblocking save, regardless of the size of the document
      • Sophisticated (and therefore more CPU-intensive) nonblocking spelling and grammar checkers, potentially even using a separate service on the system (imagine a dbus/dcop-like service that could perform grammar and spell checking)
      • Nonblocking integration with live remote data sources
      Sure, the task of writing a document is serial for most individuals, but there's plenty of work that MS Word does that should be (is already?) farmed out to course-grained worker threads. I would particularly be excited about a system-wide spelling/grammar service than any application could invoke asynchronously (it would be better than a library like aspell for an integrated desktop environment, and it would reduce DLL/dependency hell).
    4. Re:Patience is not a goal here. by tempest69 · · Score: 1

      Have you actually tried doing this? Or are you just mouthing off with no experience? If you ever want to scale up beyond specialized dedicated clusters, there are whole new classes of problem that have to be addressed. (For example, security becomes suddenly all encompassing, and many of the cheap hacks like SSL and VPNs either don't really apply or need a lot of enhancements.) Of course, there are people working on dealing with these problems; there's at least 4 different standards bodies dealing with various aspects. Some you will even have heard of (IETF, W3C)...
      Well I did have dedicated clusters so I was able to mitigate the security issues. I had all of the source to all of the engines that were being used, so that the engines would deflate as needed, and delay inflation as needed. it was cludgy but workable.

      Storm

  67. Its not hard but often it is unnessary by Anonymous Coward · · Score: 0

    Look writing multi-threaded/multi-processor applications isn't hard to do.
    The tools to test and debug them are easy and available in any version of My Eclipse.

    However functionally speaking parallel programming isn't completely unnecessary. The thing is its pointless to write a multi-threaded application if the bottleneck is IO, or memory. This is because multi threaded applications take the load off the cpu nothing else. And unless your doing some pretty heavy math the cpu is very rarely the bottle neck now days.

    If you are doing cpu intensive functions then that code needs to be divided into independent chunks which can run separately without blocking (because if they block waiting for each other you might as well just write them in a single thread). This is less likely than you'd think because using this code is for a process, that is something will need to use this.
    Unless your talking about games or server side applications this is very rarely needed.

    More importantly software developers should only ever use hardware like this if it has a benefit, not so intel can justify their latest wow factor toy.
    This seems a case of the hardware providing things that are not needed and then complaining that they are not used more than anything else.
    Multi-threading has an overhead cost to it. If you use it too much the application can actually run slower than if every thing is in just one thread. Therefore you need a good reason to use multi-threaded code, like performance benefits for example.

    Believe me if and when it solves a real performance bottleneck or problem there will be no problem getting developers to write code that fully uses multi-core CPUs until that point they wont. Developers love the latest flashy toy as much as any other geek, but they like stable, secure reliable and efficient applications more.

  68. Not that hard by rsidd · · Score: 1

    I know many physicists, not professional programmers, who write code (using MPI) that scales well to dozens -- sometimes hundreds -- of processors. They are intelligent people, but programming is not their main job or what they were trained in. Also, their code is not user-friendly, but that's a cosmetic matter that can easily be fixed if needed. If they can do it, why can't professionals?

    1. Re:Not that hard by AlXtreme · · Score: 1
      I'll bite.


      The problem is that you can't parallelize everything equally well. Sure, non-professional programmers are able to write perfectly valid MPI code, but I'll bet you that their problem was trivially parallel to start off with (that is: you can split your problem space into independent chunks and have each processor deal with its own section of the problem). This is the case for a lot of problems, and can lead to a dramatic speedup.


      When you get into more complex problems (like search algorithms) MPI (or any other method of PP) gets increasingly hard to parallelize properly. Scaling into 100s of processors isn't uncommon, and communication adds up exponentially the further you go, possibly griding your program to a halt.


      Having said that, I've seen some amazing code by physicists trying to squeeze every last cycle out of their code. The problem is that they normally don't see pitfalls (deadlocks etc) until their code goes up in flames, but yes physicists are smart people and PP isn't rocket science, no matter what Intel or the like want you to believe.

      --
      This sig is intentionally left blank
    2. Re:Not that hard by Hal_Porter · · Score: 1

      I know many physicists, not professional programmers, who write code (using MPI) that scales well to dozens -- sometimes hundreds -- of processors. They are intelligent people, but programming is not their main job or what they were trained in. Also, their code is not user-friendly, but that's a cosmetic matter that can easily be fixed if needed. If they can do it, why can't professionals?

      Physicists are more able to work with non intuitively obvious systems? Just plain smart trumps being a professional?

      --
      echo -e 'global _start\n _start:\n mov eax, 2\n int 80h\n jmp _start' > a.asm; nasm a.asm -f elf; ld a.o -o a;
  69. "Dragged Kicking and Screaming" by netfunk · · Score: 4, Interesting

    Tom Leonard, a programmer from Valve, gave a fascinating talk about this at GDC this year, about retrofitting multicore support into Half-Life 2 (specifically, into the Source Engine, which powers Half-Life 2). Not surprisingly, this talk was named "Dragged Kicking and Screaming" ...

    There was a lot of really good wisdom in there, whether you are writing a game or something else that needs to get every possible performance boost.

    I'm sure they probably drew from 20+ years worth of whitepapers (and some newer ones about "lock-free" mutexes, see chapter 1.1 of "Game Programming Gems 6"), but what I walked away from the talk with was the question: "why the hell didn't _i_ think of that?"

    There were several techniques they used that, once you built a framework to support it, made parallelizing tasks dirt simple. A lot of it involves putting specific jobs onto queues and letting worker threads pick them up when they are idle, and being able to assign specific jobs to specific cores to protect your investment in CPU cache.

    Most of the rest of the work is building things that don't need a result immediately, and trying to build things that can be processed without having to compete for various pieces of state...sometimes easier said than done, sure. But after hearing his talk, I was of the opinion that while parallelism is always more complex than single-threaded code, doing this well is something most developers aren't even _thinking_ about yet. In most cases, we're not even at the point where we can talk about _languages_ and _tools_, since we aren't even using the ones we have well.

    --ryan.

    --
    Don't say, "don't quote me," because if no one quotes you, you probably haven't said a thing worth saying.
  70. No. No. No. by Duncan3 · · Score: 3, Interesting

    We've had a steady stream of multi-core guests here at Stanford lecturing on the horror and panic in the industry about multi-core, and how the world is ending. I've seen Intel guys practically shit themselves on stage, they are so terrified we can't find them a new killer multi-core app in time. That's BS. OK so it's a hour lecture, maybe two if you're not that fast. Parallel/SMP is not that hard, you just have to be careful and follow one rule, and it's not even a hard rule. There are even software tools to check you followed the rule!

    But that's not the problem...

    The problem is, a multi-year old desktop PC is still doing IM, email, web surfing, Excel, facebook/myspace, and even video playing fast enough a new one won't "feel" any faster once you load up all the software, not one bit. For everyone but the hardcore momma's basement dwelling gamers, the PC on your home/work desk is already fast enough. All the killer apps are now considered low-CPU, bandwidth is the problem.

    Now sure, I use 8-core systems at the lab, and sit on top of the 250k-node Folding@home so it sounds like I've lost my mind, but you know what, us super/distributed computing science geeks are still 0% of the computer market if you round. (and we'll always need every last TFLOP of computation on earth, and still need more)

    That's it. Simple. Sweet. And a REAL crisis - but only to the bottom line. The market has nowhere to go but lower wattage lower cost systems which means lower profits. Ouch.

    --
    - Adam L. Beberg - The Cosm Project - http://www.mithral.com/
    1. Re:No. No. No. by GigsVT · · Score: 3, Insightful

      Games have been driving PC performance lately. You shouldn't be opposed to such things.

      You can get a 4 core chip for under $600 now because of it. If you are into high performance computing then you should beg the game developers for something that can use as many cores as you can throw at it. Because as you said, you are 0% of the market, and gamers are a huge chunk of it.

      --
      I've had enough abrasive sigs. Kittens are cute and fuzzy.
    2. Re:No. No. No. by Anonymous Coward · · Score: 0

      Maybe not fast enough for me? At least in my case I have a single core Athlon 3200 and frankly it is not fast enough. I'm fairly sure a faster single core processor won't do a hell of a lot for me. A multi core processor will today and the coming quads probably do even more. So hardware is either coming or here that will solve some of my problems.

      The other issue, as has been noted repeatedly, is threaded applications. While I disagree that apps are fast enough. it is highly variable, it is certain that some don't need much improvement. I would argue that one of the places where parallel programing, in multiple forms, needs to be implemented is in the Internet browsers we all use. Be in better threading of javascript or the handling of Codecs. It doesn't take much of a web page to slow a single core PC down. At this point I kinda which that he only feature set to be implemented in Firefox 3 would be the use of threads to better exploit multi core systems.

      In a nut shell a lot of our desktop apps really aren't fine performance wise. Some are sure, but that doesn't forgive those that drag us down. And drag you down is exactly what some apps do if they can't keep up with you.

      Then there is the issue of power usage.

      Dave

    3. Re:No. No. No. by Anonymous Coward · · Score: 0

      I don't think there's really been a time when this wasn't the case: its tautological that everything people do on their desktops are within the capabilities of said desktops.

      The only non-gaming "killer apps" I can think of that would drive a hardware upgrade are: Windows 95 and perhaps XP (and if MS gets their Vista act together that could be one too), and playing the various types of optical media that have come out: CD, DVD, and now HDDVD and Blurray. I know that playing an MPEG-4 compressed 1080p stream pushes a single-core system pretty hard - people with 3GHz P4s probably won't need to upgrade but if you have a 2Ghz P4 you probably will, and you'll likely get a dual core to ensure the system stays responsive when you're playing that HDDVD.

    4. Re:No. No. No. by Mab_Mass · · Score: 1

      That's it. Simple. Sweet. And a REAL crisis - but only to the bottom line. The market has nowhere to go but lower wattage lower cost systems which means lower profits. Ouch.

      Except, potentially, lower cost = bigger markets, which means that even if the margins drop, profit may still do okay, given enough volume.

  71. Multiple CPUs aren't too hard. But multiple mems.. by Animats · · Score: 1

    It's not that hard to program shared-memory multiprocessors. Most of the problems we have doing that stem from the fact that C and C++ provide essentially no support for doing so; they shove the problem off to the operating system. The fundamental problem there is that the language has no idea which locks lock what. Compare Ada, Java, etc.

    Non-shared memory machines, though, are tough. If each CPU has plenty of memory, as in a (I hate to say it) Beowulf cluster, it's not too bad. But collections of small memory CPUs are a pain to program. Until recently, this was a headache only for people trying to use one of the weirder supercomputers like an NCube or a Connection Machine. Then came the Cell, and the PS3. With 256K per processor, you have to organize your program like an assembly line, where work units are pumped through the processor in sequence. For some applications this fits. For some it doesn't. And for some it adds a year to development time as the application logic is redesigned to fit this painful hardware. (Meanwhile, the XBox 360 programmers, who have a conventional 3-CPU shared memory multiprocessor, ship first.)

    Actually, the real progress in massive parallelism is in graphic cards. The operations needed are well understood, so the hardware can be matched to the job.

  72. Penis in Ear == Dance all Night by Anonymous Coward · · Score: 0

    he'll use his magnet to escape

  73. Well duh ! by Anonymous Coward · · Score: 0

    It's hard because very few things we do are inherently parallelizable.

    Yes, you can use functional programming and friends, and that often gives you a solution which is inherently 10 times slower than a straightforward algorithmic solution which you can then distribute across several processors.

    In a few cases it's a big gain, but in most it's simply wasting resources trying to come up with parallel solutions to non-parallel problems.

    It's often hard because it's stupid, not because it's actually difficult to do.

    Peter

  74. Its mostly the OS - by HW_Hack · · Score: 1

    then the application(s).

    As I ejected from my cube at Intel R+D in '04 there was already early talk about 4 cores - 8 cores - and something like 16 - 32 - or 64 mini-cores by '08 - '09.

    And really - do we need to have MS Office or Word parallel-threaded - or email ? Certainly media-streams should be threaded - games - communication / network streams. But I think a big part of this is the OS facilitating both threaded and non-threaded apps INTELLIGENTLY and EFFICIENTLY into those cores. And from what I took out of discussions - some of those mini-cores will be locked down either running or doing security checks etc. - others performing other low bandwidth or asynchronous tasks.

    And not to forget that 2 or more simultaneous OS sessions may be running on those cores --- the classic situation being a locked down OS running the in house IT package of productivity tools so users can't hose up the installed image or let loose a threat ---- the second OS runs the users personal space which they can corrupt and infect at will without affecting the network.

    --
    Its not the years, its the mileage .....
  75. A simple starting point by 12357bd · · Score: 2, Interesting

    could be to add a especifically parallel iterator keyword to programming languages, ie:

    for-every a in list; do something(a); done;

    The compiler then assumes that something(a) can be safely executed in parallel for every element in the list.

    Is not rocket science, it could lead to parallel spagheti, but is a straightforward method to promote parallel programming.

    --
    What's in a sig?
    1. Re:A simple starting point by TeknoHog · · Score: 2, Interesting

      Something like this exists in many languages, for example Fortran with its built-in matrix math and the map() construct in Python. The problem is that people don't use these languages, and while they stick with something like C they are forced to reinvent the wheel with things like explicit threads.

      --
      Escher was the first MC and Giger invented the HR department.
    2. Re:A simple starting point by WH44 · · Score: 1
      > for-every a in list; do something(a); done;

      > The compiler then assumes that something(a) can be safely executed in parallel for every element in the list.

      That is trivial to implement without changing a language, e.g. for C/C++ just pass function and list of parameters to be executed in parallel to a function which starts a thread for each:

      StartParallelThreads(something, list);

      The real problem is shared resources, i.e. where those "something(a)" do come into conflict with one another.

    3. Re:A simple starting point by tomstdenis · · Score: 1

      It's also not practical to spawn a thread [or threads] whenever there might be a bit of parallelism. If you already had a thread launched waiting for some data that's one thing. Consider the following bit.

      for (x = 0; x < n; x++) a[x] += b[x];

      Which is faster, serial, parallel, vector [e.g. SIMD] or some combination thereof?

      Don't know? Why would your compiler know either?

      Tom

      --
      Someday, I'll have a real sig.
    4. Re:A simple starting point by Anonymous Coward · · Score: 0

      That's true for every instruction, not just potentially parallizeable ones. There may be some CPUs where multiplication is faster than addition, for example. Still, it's better to give the compiler the option to optimize where it's reasonably confident that it'll speed things up, whereas without the for-each syntax it couldn't assume that it would be legal to parallelize it.

    5. Re:A simple starting point by tomstdenis · · Score: 1

      It's not a question of whether you can use parallelism or not. In C, as long as the prescribed behaviour is adhered to, it doesn't matter how it is implemented.

      For example, it would be valid for a C compiler to compile to java byte code, and use an interpreter to execute the instructions. So long as the program runs the way the C standard says it should, it's valid (just not efficient).

      Tom

      --
      Someday, I'll have a real sig.
    6. Re:A simple starting point by smellotron · · Score: 1

      for (x = 0; x < n; x++) a[x] += b[x];
      Which is faster, serial, parallel, vector [e.g. SIMD] or some combination thereof? Don't know? Why would your compiler know either?
      On the contrary, I would expect that the compiler knows the architecture it is compiling for, and thus knows how to optimize that loop. Modern compilers (commercial, at least) will look at that loop and understand
      1. every loop iteration is independent
      2. how "wide" the parallel processing can be (2 concurrent iterations? 4? 128?)
      3. how to properly parallelize (loop unrolling? software pipelining? SIMD?)
      One of the big difficulties in compiler optimization is taking high-level concepts that have been mapped to low-level implementations like C and then attempting to re-construct the high-level concept in order to see parallelization opportunities. This is one of the nicest things about higher-level languages (even the humble PHP foreach loop). The closer the code mirrors an abstract model, the easier it is to optimize that model.

      As an example, these Python snippets all take sequences a and b and does the same as the above C code. You can see that they're all at different levels of abstraction, potentially giving different levels of optimization.

      for i in range(len(b)): a[i] += b[i]
      a = map(lambda ai, bi: ai + bi, zip(a,b))
      a = [ a[i] + b[i] for i in range(len(b)) ]
      a = [ ai + bi for ai, bi in zip(a,b) ]
    7. Re:A simple starting point by AlgorithMan · · Score: 1
      yes, it looks so easy...
      but this may lead to strange errors that non-pros might not understand... for example

      int count = 0;
      for-every a in list do
      count = count+1;
      should give you the length of the list, right?
      in parallel computing it might give you any number between 1 and the actual length of the list...

      non-pros might not understand, what is "thread-safe" and what isn't...
      I think this concept would hurt the IT industry - many programs could have bugs that the authors might not be able to find, just because someone gave them a gun as a toy...

      at my university I have seen experts on multithreading making mistakes in thread safety... if you ask me: yes, parallel programming IS just too hard...
      --
      The MAFIAA is a bunch of mindless jerks who will be the first up against the wall when the revolution comes
    8. Re:A simple starting point by tomstdenis · · Score: 1

      The point is when you're compiling that you don't how big the loop is. You could add a bunch of tests (if n is larger than 16, 128, 1024, 100000, etc...) but that slows down the code and also makes it huge.

      Tom

      --
      Someday, I'll have a real sig.
    9. Re:A simple starting point by demo · · Score: 1
      Something like

      #pragma omp parallel for
      for(int i(0); i != max_size; ++i)
      {
      do_something(a);
      }
      perhaps?
      --
      ---
    10. Re:A simple starting point by 12357bd · · Score: 1

      Yes, programming is not easy, and that 'simple' for-every statement could be a real can of worms, but that's programming, trying to 'protect' programmers from mistakes wont help programming as a whole.

      The fact is, programmers use to know what sections of his own code could be executed in parallel, but have no easy way to use that knowledge. Let compiler writers start working on implementations (ie. on your example, warn about shared resource (count) being modified concurrently) , is my opinion that there's a big middle ground area where parallel programming could be used, as long as the tools are trivially simple to use.

      --
      What's in a sig?
  76. Multitasking support is not all that new. by krischik · · Score: 1

    The reality, however, is that these new languages which provide the newer and better paradigms for thinking and reasoning about concurrent code, just aren't going to get developer uptake. Programmers are too conservative and too wedded to their C, C++, and Java to step off and think as differently as the solution really requires. Programming languages with build in multitasking are not new. We have have them for quite a while now (see http://en.wikibooks.org/wiki/Ada_Programming/Taski ng - Ada was designed in the early 80'th). They where just ignored by PC programmers because there so heavy weight and difficult to learn. Both not realy true. And as you said: Quite a few programmers don't want to learn anything new :-( .

    Martin
  77. Basically unnatural by hisstory+student · · Score: 1

    Most tasks, other than system-wide tasks, are inherently serial in nature. It's the way we think. How many parallel flow charts have you ever seen? Probably very few, if any. Think of all the major computer applications. How many of them deal with anything in other than a serial manner? Probably very few, if any. Distributed tasks are generally the same algorithm being run on multiple processing units, each being basically a serial process. Add to this the fact that nearly all of us have been programming in serial mode all of our programming lives, then hell yes, parallel programming is just too difficult. It's basically unnatural. We only have one brain.

    --
    Heard any good sigs lately?
    1. Re:Basically unnatural by try_anything · · Score: 1

      Most tasks, other than system-wide tasks, are inherently serial in nature. It's the way we think.

      Few programs only perform a single task.

      How many parallel flow charts have you ever seen?

      Many. They're called dataflow diagrams, and people generate concurrent programs from them the same way people generate single-threaded programs from flowcharts.

      Think of all the major computer applications. How many of them deal with anything in other than a serial manner?

      E-mail clients, word processors, text editors, and browsers all have to perform concurrent tasks: checking for new mail, doing spell check, autosaving drafts, parsing text for grammar highlighting, downloading pages in the background, displaying animations, and checking for application updates, all while responding to user input.

      Add to this the fact that nearly all of us have been programming in serial mode all of our programming lives

      Java changed that. Basically every programmer who has had a basic Java course or worked through an introductory Java book has learned the basics of threading and written several multi-threaded programs. I would guess that the majority of professional Java programmers have to consider threading issues when they write code, though I might be wrong about that. In any case, that's a hell of a lot of programmers. Java is not an elite language.
    2. Re:Basically unnatural by WH44 · · Score: 1
      > Java changed that. Basically every programmer who has had a basic Java course or worked through an introductory Java book has learned the basics of threading and written several multi-threaded programs.

      Odd that: the one programmer in my shop who started out as a Java only programmer, has the weakest multithreading skills.

    3. Re:Basically unnatural by try_anything · · Score: 1

      Nothing odd about that. I would expect him to have the weakest single-threading skills, too. You can't have much education and experience if you're Java-only.

  78. Not hard if you use the right tools by mathfool2007 · · Score: 1

    Using MPI or PVM can be hard, but this is not the case if you use better tools like Star-P. ( www.interactivesupercomputing.com )

  79. Re:Careful with process algebra and process calcul by dr_pump95 · · Score: 1

    However, all is not lost, since if you need to represent something that has any real duration, you can model it as a pair of events ("start" and "finish", or something similar). Actually, all you are doing is decomposing the problem. What parts of the decomposed computations can be parallel?

    The success of the occam programming language running on networks of transputers would seem to provide a proof-by-example that the interleaving model can work in practice Yes, because Occam actually used messaging for its execution semantics and the execution semantics are actually parallel. This works quite well. The caution was about directly applying the operational semantics defined for CSP and pi Calculus, which does not work so well.

    Languages built on models like CSP enforce the interleaving of A and B if they are affecting the same state, Yes, they don't blindly apply the operational semantics of CSP: they use implicit synchronisation to avoid conflicts introduced by parallelism. This works well as long as the cost of the implicit synchronisation is significantly less than the benefits gained through parallelism. The synchronisation cost increases with the distance between processors (round trip time for synchronisation is roughly distance/speed-of-light). Because this synchronisation is implicit rather than explicit, it is difficult for a programmer to control and thus you can have performance issues in non-trivial programs. There is no easy answer, but I believe that asynchronous (event-driven) programming models are better.

    Both Petri nets and Winskel's event structures certainly have much to recommend them. However, in both cases, my impression is that they are better suited to use as tools for providing a semantics (much as traces provide a semantics to CSP, or labelled transition systems to the pi-calculus), rather than as something that one would actually want to use as the basis for developing a design or a programming language. Agree and that's what I meant. The model of an execution being a partially ordered set of events is a good one. I've previously developed a language, execution semantics and implementation of the semantics that provides this. In my case, I was trying to build a language and execution engine that could be easily distributed. The result is a fully asynchronous, distributed, state machine. Works well but it is very much a research prototype.
  80. Nitpick by Ihlosi · · Score: 2, Insightful
    Over 10 years ago, I was using a "visual programming language" created by National Instruments called LabView.



    The language isn't called LabView, it's called "G". LabView is the whole package (G interpreter/compiler, drivers, libraries, etc).

    And, yeah, G is pretty cool. National Instruments offers a slightly dated, but otherwise completely functional version of LabView for free for noncommercial use.

  81. That's irrelevant. by Estanislao+Mart�nez · · Score: 5, Insightful

    Our cognitive system does many things at the same time, yes. That doesn't answer the question that's being posed here: whether explicit, conscious reasoning about parallel processing is hard for people.

    1. Re:That's irrelevant. by TheRaven64 · · Score: 1

      No it's not. Much of the work of programming is taking an parallel process (i.e. pretty much anything you want a program to do) and translating it into the sequential model used by most programming languages. Alan Kay has shown that 11-year-old children have no problems understanding the ideas of parallel programming, and writing code with 100 or so parallel operations with the right tools.

      When I first learnt to program, I remember learning a little about function and then later discovering that they completed synchronously. I was surprised by this, because it just didn't seem to make any sense; a function has a deadline by which it needs to complete (when I use the result), but it can run in the background until then and join with the calling thread.

      Most programming tasks are inherently parallel. I can't think of a single piece of code I've written recently that hasn't been a solution to a parallel problem. The only question is whether we try to implement the parallelism using coroutines, threads, or processes. Processes are the easiest to reason about (we have lots of formal tools for that) and coroutines give the best performance on single-processor systems. At the moment, we tend to use coroutines (and call them 'run loops') and for some reason a lot of people seem to think threads are a good solution, despite evidence to the contrary.

      --
      I am TheRaven on Soylent News
    2. Re:That's irrelevant. by LionMage · · Score: 3, Interesting

      Much of the work of programming is taking an parallel process (i.e. pretty much anything you want a program to do) and translating it into the sequential model used by most programming languages.

      Well, that statement makes a gross assumption. Every software developer (programmer/engineer) thinks that their particular domain is representative of what computer programmers do in general. However, if you in fact write software that automates common business tasks, the software is directly analogous to the process it seeks to model and/or replace. Most business tasks are sequential, so procedural single-threaded programming is a perfectly fine model to use.

      Yes, for the things that most casual users and computer scientists think are "interesting," there is some inherent level of parallelism that can get pretty high. For a few choice types of tasks (ray tracing, rendering certain fractals), the problem itself is embarrassingly parallel because there is no direct coupling between the solutions of sub-problems. However, at some level you can't decompose your problem any further, and you can extract no more parallelism.

      The vast majority of computer software these days is written for businesses. Most of it is not the stuff you see on the shelf at the local computer store, but is written custom to solve a specific business need. Most business processes are inherently serial operations: you perform one step, then you perform another step that depends on the previous step. Occasionally, you get lucky and you discover multiple steps that can be done simultaneously. However, making such processes explicitly parallel might not be the most advantageous move; after all, most modern CPU architectures are adept at out-of-order execution, and can analyze instruction streams to figure out dependencies dynamically. Heck, most modern CPU architectures support multiple in-flight instructions, and allow multiple instructions to complete simultaneously, which extracts parallelism at a very low level.

      When I first learnt to program, I remember learning a little about function and then later discovering that they completed synchronously. I was surprised by this, because it just didn't seem to make any sense; a function has a deadline by which it needs to complete (when I use the result), but it can run in the background until then and join with the calling thread.

      You can still explicitly use this technique in modern programming languages; Java, for example, has Thread.join() which is used for precisely such situations. However, just because you can do something doesn't mean that you should; there is overhead associated with spawning threads of execution and synchronizing threads when some result is needed. If the computation being performed by a function call is long-lived, then it makes sense to spawn a thread to perform that computation -- assuming that there are sufficient computational resources to truly run that thread concurrently (e.g., another CPU core able to perform that computation). Otherwise, you're burning more computational resources and probably making your code actually slower in the process (due to management overhead). And if you're multitasking on a single CPU core, spawning another thread will almost certainly result in a slower-running program (because you still have all the overhead of managing another thread, but none of the benefit of true hardware-level concurrency).

      Most programming tasks are inherently parallel. I can't think of a single piece of code I've written recently that hasn't been a solution to a parallel problem.

      The first sentence is really an unsupported conjecture. The second sentence is an attempt to provide anecdotal evidence drawn from your own experiences to support the conjecture in the first. My own life experience is vastly different from yours, but then again, that too is anecdotal evidence; neither your nor my personal experiences are really "proof" o

    3. Re:That's irrelevant. by Estanislao+Mart�nez · · Score: 1

      Why are you telling me all that? I don't disagree that concurrent programming shouldn't be any harder than other kinds of programming. All I said was that all the amateur psychology and neuroscience that people were spouting in this thread was irrelevant to the question.

      Other than that, yes, data-flow synchronization makes concurrent programming way easier.

  82. It's not hard to write parallel programs by Anonymous Coward · · Score: 0

    I don't understand whats so hard about parallel programming?
    I cant see that anyone calling themself a real programmer would have any problems with parallel programming.

    It's about the same in most languages, you need to have mutex and threads. Not alot more too it.

    I have reed here that people bashes all over, saying that programmers are lazy not to learn Erlang
    and that every language out there are bad... my question to you: What language would you use, the perfect one or the one that get the job done?

    Today theres basicly two languanges that you can use, Java and C derived (C, C++, D.. etc).
    Why you might ask yourself? well.. do you know in what languages thirdparty api's comes in? .. They _are_ in C, C++ or Java.. Never in Erlang or Lisp.

    Learn what a deadlock, mutex and threads are.. thats all you need to know, then pick your language of your choice that gets your job done.

    One more tip, dont multithread applications that dont benefit from it.

  83. High performance multiprocessing by Cafe+Alpha · · Score: 2, Informative

    I've worked on a high performance multiprocessor system.

    There are a few principles and tools that make much of it manageable, and then there's some parts that are inherently nearly impossible.

    A few principles:

    1. Task switches are very very time consuming, at least under preemptive multitasking, and especially when that preemption (as it does in Windows) involves process switches. Since mutexes rely on task switches, they're very expensive, although exact implementation matters too.

    2. It's possible to come up with non-blocking algorithms that require no mutexes (though you do need low level access to interlocked instructions, or barriers). Unfortunately that's where it gets nearly impossible because proving that a non-blocking algorithm is correct requires a combinatorial analysis. I could go into the some of the principles of non-blocking algorithms, but they're still very hard even when you know what you're doing. Still it's useful to understand some basic interlocked instructions because people often use mutexes when a simple interlocked instruction would do the same task infinitely quicker.

    3. Having a few basic non-blocking queue algorithms (LIFO and FIFO) up your sleeve can suffice to allow rather separate tasks to communicate cheaply. There are even nonblocking queues that allow an unlimited number of processors to compete for each end of the queue simultaneously, and so you can have common banks of work to be balanced between processors, for instance.

    4. It's often a win to give very separate tasks to each processor, and have a single process per processor. Put all IO on one processor, for instance and have it communicate with the other processors through non-blocking queues.

    5. Even though fair preemptive multitasking is expensive (because of the task switches), in special cases you can use cooperative multitasking (fibers, green threading) and save the time. One advantage to cooperative multitasking is that you can control exactly when a fiber wakes up. In some benchmarks I've seen (producer-consumer), green threading outraces preemptive multitasking by over an order of magnitude.

    6. If you can all tie all interrupts to a single processor (which is possible in Windows) and lock specific processes to each processor, then you can (almost) guarantee that certain processors won't interrupted, and thus those processors are the ones that are cheapest to use for any task that the other processors will have to wait for.

    7. Aggregate. There are some tasks that can not be accomplished in parallel with the usual work. It's useful to save up a bunch of work like that so that you don't have to shut down the other tasks too often.

    8. State machines with atomic arcs. This gets closer to the harder sort of algorithms, but its useful to talk about what's easy. If you need a bunch of processors to cooperate, it's useful to have a state machine description of the global state. If the state can be stored in a single double word, then transitions between states can be accomplished atomically with a CAS instruction (compare and swap), and then it doesn't matter which processor changes the state. They may all try, and one will succeed. If one of the states is too complicated to fit in a double word, then you can either have a spin-lock intermediate state or in some cases, the state double word can include a pointer (but this gets complicated).

    9. Cache delays. Multiprocessor systems have to keep the caches coherent. Because of this situations like a CPU reading a value that's dirty in another processor's cache can bring all of the processors to a halt while they transfer data. I'm a few years out of date on what the newest processors do, but it's probably still true, and still true that these pauses are much longer on systems like the Sparc that allow hundreds of processors than it is in x86 machines that are more limited in the number of processors. In any case it's a win to keep data memory use separate between processors when possible.

    1. Re:High performance multiprocessing by fred+fleenblat · · Score: 1

      >

      Wondering out loud...seems like threads need to adopt a rollback/redo log approach too. Let the threads do their thing, but when two threads try to use the same resources, don't prevent it with a mutex, roll it back to the last point at which there was no possible conflict. If the winning thread needs to roll back because of competition for a second resource, the loser of the first resource can redo and continue.

  84. Hey it cut off my comment by Cafe+Alpha · · Score: 1

    In the "experimental view" slashdot cuts off the last two entries:

    10. Databases (locking, rolling back etc). For those cases where you don't need speed, database technology solves most of the problems of multiple entities keeping the data constant more flexibly and easily than anything other than stopping the world. It could be useful to build some database technology into your product, even if only for inter-process communication.

    11. The usual semaphores and mutexes. By the way there's a "many readers but only one writer" mutex pattern that's so useful that I wonder why it isn't more common. In any case you should all know to avoid mutual blocking etc etc...

  85. Re:Careful with process algebra and process calcul by GileadGreene · · Score: 1

    Actually, all you are doing is decomposing the problem. What parts of the decomposed computations can be parallel?
    The simple answer is: the parts you can't see :-) Process calculi generally only concern themselves with externally observable events (such as the start or finish of an internal computation). Two computations can be considered to overlap in time ("be parallel") if their "start"/"finish" intervals overlap. Of course, there will be no interaction between those parallel computations, since the computations themselves are internal to the processes in question. Any interaction requires the introduction of additional events between the start and finish events.

    Yes, they don't blindly apply the operational semantics of CSP: they use implicit synchronisation to avoid conflicts introduced by parallelism.

    I'm afraid that I may not be following you here. Just to clarify: are you referring to the fact that CSP includes a nondeterministic choice operator, which occam omits (and further restricts its equivalent of the CSP external choice operator such that it's not possible to ALT across output events)? Or is there some other aspect of the "implicit sychronization" that I'm missing?

    Please note that I'm not disagreeing with your point. You are quite correct that languages which implement concurrency models based on process calculi (such as occam or Nomadic Pict) do make judicious choices about which constructs make sense froma practical perspective, and which are better suited to theoretical use. However, your original complaint was about interleaving semantics in general as a basis for execution models, which is a somewhat broader issue than the choice of which constructs within an interleaving model to use.

    There is no easy answer, but I believe that asynchronous (event-driven) programming models are better.
    We are in agreement there. I think that asynchronous messaging is a better default choice for distributed programming. Of course, there are process calculi based on asynchronous messaging... ;-)

    I've previously developed a language, execution semantics and implementation of the semantics that provides this. In my case, I was trying to build a language and execution engine that could be easily distributed. The result is a fully asynchronous, distributed, state machine. Works well but it is very much a research prototype.
    Interesting. Is the implementation available anywhere online? I'd be interested in playing with it.
  86. Hardware description languages do it all the time. by Anonymous Coward · · Score: 0

    Real engineers designing hardware use languages like verilog /VHDL which allow description of concurrent and independent processes. Programmers can take a lok at "SystemC" which provides the same functionality in C++. Using one of the above mentioned languages takes care of the programming part. what is lacking is a cheap compiler which will translate it to code to run on a multiprocessor system. The existing simulators which are way too costly.

  87. Do we really need it? by IkeTo · · Score: 1

    When every of us have 1, 2 or 4 core/CPUs doing all the tasks that need to be done in the computer from the kernel to the desktop environment to the virus scanner to the servers to the BT clients to the video player to the real application, who need parallel programming? Give every of us 1024 core/CPUs, and every CPU-bound program will be parallel. But that's not a day that everybody see as about to come.

  88. Why No MPI? by XchristX · · Score: 1

    Most of the people in this discussion are talking about multithreading programs as a means of parallelization. While multithreading is one way, it's applicability in parallel processing is restricted to SMP (Shared Memory) systems only and thus is not very scalable by problem size. Far more general and powerful is Message Passing (http://en.wikipedia.org/wiki/Message_passing) which can be implemented in distributed grids and is very scalable. Multithreaded programs can be scaled upwards to distributed grids only by hybridizing it with MPI codes.

    --
    l'Homme n'est Rien l'Oeuvre Tout: Gustave Flaubert to George Sand
  89. You're not thinking of the right problem. by Estanislao+Mart�nez · · Score: 1

    You're thinking of how to speed up programs by using parallel execution units. This is closely related, but not exactly the same thing, as the use of concurrent programming techniques to write better organized programs capable of responding flexibly to events from multiple sources while also performing their own "background" computations. Think of a UI program that must simultaneously react to user interaction events, while also performing some computation that's mostly independent of user input. A word processor that does grammar checking in the background while the user interacts with the UI in other ways is a prime example.

    The thing is that with mainstream languages, writing programs like this is probably much harder than it needs to be, for several reasons:

    1. Many threading mechanisms are built with parallelism in mind rather than concurrency, and make it too expensive to spawn a gazillion concurrent threads to handle each independent thing in your app.
    2. Your typical mainstream language of today is an imperative language with threading and shared memory synchronization primitives bolted in. This means that perfectly innocent-looking code often has suprising and confusing behavior when executed concurrently, because the language's bolted-in concurrency exposes low-level details of the hardware like the interaction of cache and main memory. Shared mutable memory between parallel execution units is a hard thing to wrap your head around.
    3. The same hard stuff that makes some of your innocent-looking behave in a crassly incorrect way is, in fact, the stuff that you need to exploit for thread synchronization.

    Here's one way of solving this problem: (a) lightweight threading mechanisms for concurrency (in addition to the heavyweight ones for parallelism), (b) no shared mutable memory between threads (any shared memory must be immutable), and (c) simpler thread synchronization primitives that do not rely on shared mutable memory, like communication channels between threads.

  90. Actually it's just pipelined by Moraelin · · Score: 5, Insightful

    Actually, it's more like pipelined. The fact that your eyes already moved to the next letter, just says that the old one is still going through the pipeline. Yeah, there'll be some bayesian prediction and pre-fetching involved, but it's nowhere near consciously doing things in parallel.

    Try reading two different texts side by side, at the same time, and it won't work that neatly parallel any more.

    Heck, there were some recent articles about why most Powerpoint presentations are a disaster: in a nutshell, because your brain isn't that parallel, or doesn't have the bandwidth for it. If you try to read _and_ hear someone saying something (slightly) different at the same time, you just get overloaded and do neither well. The result is those time-wasting meetings where everyone goes fuzzy-brained and forgets everything as soon as the presentation flipped to the next chart.

    To get back to the pipeline idea, the brain seems to be quite the pipelined design. Starting from say, the eyes, you just don't have the bandwidth to consciously process the raw stream of pixels. There are several stages of buffering, filtering out the irrelevant bits (e.g., if you focus on the blonde in the car, you won't even notice the pink gorilla jumping up and down in the background), "tokenizing" it, matching and cross-referencing it, etc, and your conscious levels work on the pre-processed executive summary.

    We already know, for example, that the shortest term buffer can store about 8 seconds worth of raw data in transit. And that after about 8 seconds it will discard that data, whether it's been used or not. (Try closing your eyes while moving around a room, and for about 8 seconds you're still good. After that, you no longer know where you are and what the room looks like.)

    There's a lot of stuff done in parallel at each stage, yes, but the overall process is really just a serial pipeline.

    At any rate, yeah, your eyes may already be up to 8 seconds ahead of what your brain currently processes. It doesn't mean you're that much of a lean, mean, parallel-processing machine, it just means that some data is buffered in transit.

    Even time-slicing won't really work that well, because of that (potential) latency and the finite buffers. If you want to suddenly focus on another bit of the picture, or switch context to think of something else, you'll basically lose some data in the process. Your pipeline still has the old data in it, and it's going right to the bit bucket. That or both streams get thrashed because there's simply not enough processing power and bandwidth for both to go through the pipeline at the same time.

    Again, you only need to look at the fuzzy-brain effect of bad Powerpoint presentations to see just that in practice. Forced to try to process two streams at the same time (speech and text), people just make a hash of both.

    --
    A polar bear is a cartesian bear after a coordinate transform.
    1. Re:Actually it's just pipelined by Anonymous Coward · · Score: 0

      "Try closing your eyes while moving around a room, and for about 8 seconds you're still good. After that, you no longer know where you are and what the room looks like."

      If you can forget what your room looks like or where you are after only 8 seconds you might want to see a doctor.

    2. Re:Actually it's just pipelined by Mattintosh · · Score: 3, Funny

      Again, you only need to look at the fuzzy-brain effect of bad Powerpoint presentations to see just that in practice. Forced to try to process two streams at the same time (speech and text), people just make a hash of both.

      There's way more to it than that. The brain is an efficient organizer and sorter. It also tends to be great at estimating the relative importance of things and discarding the lesser ones it can't deal with. Thus, 99.999999999% of the time, I ignore Powerpoint presentations. It goes in my eyes, the brain deciphers the signal, decides that the Powerpoint stuff is useless drivel, and it continues processing the audio (in parallel!) and terminates the visual processing thread. Shortly thereafter, the audio signal is also determined to be of minimal benefit and is discarded as useless drivel as well, leaving more processing time for other things. Things like pondering the answer to the age-old question, "What's for lunch?"

    3. Re:Actually it's just pipelined by shelterpaw · · Score: 1

      "Try reading two different texts side by side, at the same time, and it won't work that neatly parallel any more." Your speaking in terms of "focus" as apposed to processing. You can really only focus on one task to do it well, well most people can. Your brain is still processing sound, keeping you breathing and aware of its surrounding. The one man band is a decent example of human focus on multi-processing. It's hard to do, but doable.

      If your programming is singularly focused, you'll serialize your code, but if you diagram it, then you can start to see how it can be paralleled. It's all about planning and figuring out what steps are involved. Our minds do it constantly, but only recognize the task at hand.
    4. Re:Actually it's just pipelined by SPickett · · Score: 1

      No, raednig is atuclaly dnoe in prelaell. You can tlel tihs bcuasee it is esay to raed tihs msgesae eevn tohguh its all jmlbuled up.

    5. Re:Actually it's just pipelined by tknd · · Score: 2, Interesting

      From what we know about the brain it takes advantage of many different techniques but I wouldn't necessarily agree that it is pipelined. Pipelining is a parallelization technique for making a serial set of operations execute faster through a processor by changing how the processor executes each instruction. When the brain processes information, it is basically a giant circuit that does all the processing for vision only, nothing else--break anything in the chain and the "vision" capability is either hindered or stopped.

      The brain has two separate pathways "vision" data takes: one path determines things like dimensional properties (as in how far away a cup is from you) while the other path determines identification (is what you're looking at a cup?). There have been documented cases where one pathway was lesioned and the patient could identify the object, but could not physically reach out and grab it while if the other pathway was broken the patient could physically catch a ball thrown at them and they could catch it, but they could not recognize what object was thrown at them until they used their other senses (like touch) to determine it.

      Each processing unit in the brain does some sort of processing on the data rather than contributing to make the final product. When you "see" an image, you are actual interpreting many different senses from your vision pathways. The only processing that might potentially be shared (as far as I know) is the processing done by the retina like edge detection. All of the other areas are very specialized at what they do and are only designed to do that one task. That's way different from pipelining where each unit is reused for different instructions giving the cpu its general purpose traits.

      I'd say multiple processors/cores is more how the brain operates but does not necessarily model how "we" think. What I mean by "we" is that each person has a pre-frontal cortex in their brain has that is where their personality and where their actual "thinking" as a person goes on. The rest of the brain is specialized to do other tasks. Some of those tasks are controlling emotions, labeling and highlighting memories, vision processing, motor skills, and so on. For example, when you first learned to write, you were probably intensely utilizing your prefrontal cortex to write letters. That's because the motor section of your brain specializing in hand-finger motions for writing the letter had not been trained yet. However, as time goes on, you no longer have to think in order to write the letter, in fact you could probably close your eyes and start writing--no prefrontal cortex processing is needed because the motor section now has it programmed in.

      So when you're thinking, you're really just utilizing your prefrontal cortex, but if the operation or task your performing is repetitive and can be memorized, at some point that task will be programmed into a specialized unit in your brain leading you to require less or no thinking at all. I'd say the brain itself is designed as a massively parallel unit with multiple areas that can be trained to perform specialized operations.

      Now, you may be thinking if each section of the brain can be trained to do something, can they be retrained to do other things? The answer is yes. There have also been cases where due to some reason, people lost a need to utilize one portion of their brain but started utilizing those portions to do other things. For example say a person lost their arms, well now their motor section for their arms is completely useless in their brain. But, because they must not be forced to use their feet and legs in ways they hadn't before, eventually the parts of the brain trained to do arm and hand motions will gradually be utilized to learn and control feet and leg movements. In fact, if you were to map out the amount of brain space used for each portion of the body, you would get a huge proportion devoted to things like hands and mouth where other portions of the body would utilize an insanely small portion of th

    6. Re:Actually it's just pipelined by StikyPad · · Score: 1
      Actually, people can't listen and read at the same time. http://www.newscientist.com/channel/being-human/mg 19425981.200-how-many-things-can-you-do-at-once.ht ml (Subscription required).

      The end of the last paragraph available in the preview, and the following paragraph are:

      Volunteers watch a screen and when a particular image appears, a red circle, say, they have to press a key with their index finger. Different coloured circles require presses from different fingers. Typical response time is about half a second, and the volunteers quickly reach their peak performance. Then they learn to listen to different recordings and respond by making a specific sound. For instance, when they hear a bird chirp, they have to say "ba"; an electronic sound should elicit a "ko", and so on. Again, no problem. A normal person can do that in about half a second, with almost no effort.

      The trouble comes when Marois shows the volunteers an image, then almost immediately plays them a sound. Now they're flummoxed. "If you show an image and play a sound at the same time, one task is postponed," he says. In fact, if the second task is introduced within the half-second or so it takes to process and react to the first, it will simply be delayed until the first one is done. The largest dual-task delays occur when the two tasks are presented simultaneously; delays progressively shorten as the interval between presenting the tasks lengthens.
      In other words, we can serialize processes very efficiently, but we suck at performing tasks simultaneously. Our brains are wired to do a very small number of things in parallel, which include maintaining balance, and breathing. Attention can be divided, but results are usually disasterous. A real world example many Slashdotters are probably familiar with is when someone asks a question while you're playing a game. The question is usually not answered fully, and/or gameplay suffers, even if one of the two tasks are delayed.

      Of course, this isn't about people performing parallel processing, it's about telling machines how to do it. Nonetheless, parallel processing adds an additional layer of complexity to the task, and in that respect, it's inherently more difficult. The question is whether it raises the bar above what most programmers are capable of, which would be my definition of "too hard." It's more difficult to write assembly than VB, but that doesn't necessarily mean assembly is too hard, as most programmers could probably handle it with a little training (although maybe not most VB programmers ;) even if it's more tedious and takes longer.
  91. One basic problem by Krishnoid · · Score: 1
    First is debugging tools.

    Just start with that -- a easy-to-use (whatever that means in the parallel programming case) and full-featured debugging tool. I think a lot will follow from that, especially if one can get to the bottom of what 'easy-to-use' and 'full-featured' means in the parallel programming case. And frankly, I believe it's Intel's and Microsoft's responsibility to step up on this.

  92. F**king hell. by Anonymous Coward · · Score: 0

    Crap f**king weak arse damn coders (probably bloody java weenies) need to shut the hell up and remember that SMP systems have been around for OVER FORTY YEARS!! If you have not worked out SMP, sockets, or pointers yet, then either learn or GIVE UP. Go into marketing or something and stop bothering real programmers.

    If you think threads are too hard, or you can't debug parallel code, then go to work on the tools and actually help the issue.

    damn..

    1. Re:F**king hell. by Hal_Porter · · Score: 1

      Pretty much. It's amazing how people round here believe that it's more important to have good technical skills than good interpersonal skills and then admit that they can't design a mulitithreaded application, or figure out Win32's subleties. And that their Windows boxes crash all the time.

      --
      echo -e 'global _start\n _start:\n mov eax, 2\n int 80h\n jmp _start' > a.asm; nasm a.asm -f elf; ld a.o -o a;
  93. Programming is hard by try_anything · · Score: 1
    Consider this template:

    $FOO programming is too hard. Few programmers can really handle it. Projects run into unpredictable difficulties. There's no way to do it without introducing lots of bugs which have to be laboriously tracked down and fixed by programmers. We need a revolution in tools and methodologies before $FOO programming becomes a reasonable and predictable task.


    Try replacing $FOO with various words: "parallel," "large-scale," "object-oriented," "cross-platform." No matter what you plug in there, the spiel sounds familiar. Now just take $FOO out altogether:

    Programming is too hard. Few programmers can really handle it. Projects run into unpredictable difficulties. There's no way to do it without introducing lots of bugs which have to be laboriously tracked down and fixed by programmers. We need a revolution in tools and methodologies before programming becomes a reasonable and predictable task.


    Yep, we hear that all the time too. These are meaningless words. I won't say they're pointless, since dissatisfaction drives progress, but they don't mean a damn thing at all.
  94. Re:Errors are difficult to find out in such system by Paradise+Pete · · Score: 1
    I was a Teaching Assistant of 'Concurrent Algorithms'. There used to be 30 students for that class. For a given assignment there used to be 30 different solutions and many used to be wrong.

    I think that would have been pretty much the case no matter the subject.

  95. disclaimers usually come BEFORE the text.... by bennini · · Score: 0, Flamebait

    "a bunch of bullshit like peter piper parallely picked a pied of peppers"

    so that we can avoid reading random crap that may not interest us :-)

  96. Lack of skill in the field by node159 · · Score: 5, Informative

    I've seen it over and over in the industry, there is a distinct lack of parallel programming skill and knowledge, and even senior developers with years under their belt struggle with the fundamentals.

    Parallel programming does add a layer of complexity and its inherent lack of general solutions does make abstracting its complexity away difficult, but I suspect that the biggest issue is the lack of training of the work force. It isn't something you can pick up easily without a steep learning curve with many hard lessons in it, definitely not something that can be incorporated as a new thing to be learnt on the fly with deadlines looming.
    Another aspect is that its fundamental to the design, parallelism can and often will dictate the design and if the software architects are not actively designing for it or are not experienced enough to ensure that it remains a viable future option, future attempts to parallelise can be difficult at best.

    Ultimately the key issues are:
    * Lack of skill and training in the work force (including the understanding that there are no general solutions)
    * Lack of mature development tool to easy the development process (debugging tools especially)

    --
    GPLv2: I want my rights, I want my phone call! DRM: What use is a phone call, if you are unable to speak?
    1. Re:Lack of skill in the field by CodeBuster · · Score: 2, Interesting

      Lack of skill and training in the work force (including the understanding that there are no general solutions)

      You may be shocked then to discover that a substantial percentage of the lecturers and professors in computer science programs at American (and probably foreign as well) universities have little or no *practical* experience in programming large multithreaded applications as well (they know what it is of course and they wave their hands while describing it but the programming details are often left as an exercise for the student to figure out on his own). Is it any wonder that their students, while familiar with the concept, also lack that experience or even practical training? The exceptions are professors whose area of interest or research involves operating systems, real time systems, or linear programming whereas many other disciplines in computer science, being more theoretical in nature, do not rely on practical mulithreaded programming abilities to advance the state of the art (or if it does occasionally come up then there are always a couple of grad students around who can do that grunt work for you in exchange for saying nice things about their research assistance on their PhD evaluations).

      Lack of mature development tool to easy the development process (debugging tools especially)

      Modern professional IDEs, such as Visual Studio, have really improved in this area (especially in the last five (5) years with the introduction of the .NET Framework) although the demand (the explicit demand anyway), relative to the many other types of development project that occur in the business world, remains relatively speaking quite low. If a particular programmer is able and willing and if the project allows for this type of solution then he may choose a multithreaded approach to solve the problem and if he succeeds then the management never knows that the application is multithreaded (most of them do not understand the concept in any more detail than some vague notion of multitasking anyway). It is rare for multithreaded to be an explicit project requirement, especially in the more common types of business applications. Of course, if the project fails and it is found that multithreading is involved then the progammer might take some heat, so why improve efficiency at the cost of project failure when you can do something that you know will work even if it doesn't hit the theoretical maximum efficiency? That last 10% of performance is frequently too expensive for all but the most critical applications (i.e. those that specify it as a project requirement).

      The *real* question is this, if you need someone with a high level of skill in parallel programming are you willing to pay a substantial premium for that person over a more average programmer or do you just expect every programmer who works professionally to have those skills? In the same way that not every lawyer is a constitutional scholar, not every programmer is a multithreading, operating system kernel hacking, real time Jedi programming master. If you want (and need) master Yoda, then you have to be willing to pay him what he is worth.

  97. Are americans just too dumb? by Anonymous Coward · · Score: 0

    Always these dumb headlines with "Is XXX too hard?" where XXX is a moderately difficult, but well-explored topic.
    Can't stand it, please stop it!

  98. It is hard, but doable by WH44 · · Score: 2, Insightful
    I've done a lot of multithreaded programming over the past 20 years, slowly progressing from a rare occurrence to pretty much my daily diet. I work in a shop with 6 full time programmers, plus several externals. At first I was the only one who could do any multithreaded programming, having learned the principles in college some 25 years ago (*ouch* I'm old!). Now others are producing reasonable multithreaded code, but I'm still the one they run to when there's a problem.

    Looking at the proposals for switching languages, they just shift the problem around (as another poster has already mentioned). The only thing new that might be useful is the idea of "Guards" from Haskell (for why, see below). But you don't need a new programming language to implement that, with a little imagination you can build it into a C++ library.

    In my experience, 99% of the problems are due to two problems: overlooked shared resources and deadlocks. An example of the first problem might be when two threads are pushing/popping from the same queue, causing duplicates or skips. An example of the second would be thread A has resource X and is waiting for resource Y, while thread B has resource Y and is waiting for resource X. Guards could possibly make it easier to avoid some forms of deadlock by making it easier to acquire multiple resources simultaneously with less risk of deadlock. I think I have a new library to go code now... ;-)

  99. I blame the tools by Anonymous Coward · · Score: 0

    I, myself am a programmer and I really thing the current tools are subpar.
    For example, I have never understood why a - let's say - "parallel" semantic hadn't been introduced.
    e.g:

    void parallel procedure1() { do somethin; }
    void procedure2() // "standard" procedure
    {
        procedure1(); // runs procedure1() in a new thread that is destroyed when over. immediately returns
        do something else...
    }

    1. Re:I blame the tools by Ornedan · · Score: 1

      See, the hard thing is not making things run parallel. It's the synchronisation.
      Let's say there's some variable C that your procedure1 (=p1) and procedure2 (=p2) need to read and then alter. Assume that read & alter cannot be done as an atomic operation. How do you ensure that the procedures do clobber each other's modifications?
      That is, how do you prevent a sequence of events:
        p1 reads C
        p2 reads C
        p1 writes to C
        p2 writes to C - p1's change just got clobbered

      What needs to happen is that first one procedure gets to perform it's read & alter on C, and only then can the other be allowed to access C. You need to temporarily prevent the parallel execution. The hard part is limiting the synchronized execution to only the minimum necessary to maintain correct execution.

    2. Re:I blame the tools by Canthros · · Score: 1

      At least under UNIX and assorted related OSes, you're looking for fork() and exec(). I'm pretty sure similar functionality exists under, e.g. Windows, though it may be a bit more work to make that magic happen.

      --
      Canthros
    3. Re:I blame the tools by TheRaven64 · · Score: 2, Interesting
      Take a look in the Étoilé SVN. I've contributed code that does exactly this with Objective-C objects (the EtoileThread module). It's still a work-in-progress, but it works in a lot of cases. You create an object in its own thread. Every message you send to it[1] is added to a queue, and a proxy object is returned immediately. When you send a message to the proxy object, it blocks until the first call completes.

      I remember when I was around 10 discovering that this wasn't how procedure calls worked in normal languages, and being disappointed. While I was playing with the Objective-C runtime, I realised there was no reason this had to be the case, and added it. It works on both Apple and GNU runtimes.

      Of course, if you use a language like Erlang, then you get this kind of semantic natively, and it's trivial to write hugely-parallel code.


      [1] That's 'method you call' for people more familiar with cargo-cult OO languages.

      --
      I am TheRaven on Soylent News
    4. Re:I blame the tools by fbjon · · Score: 1

      So why not just limit access to C? Have e.g. p1 responsible for it, and let everyone else communicate with p1.

      --
      True confidence comes not from realising you are as good as your peers, but that your peers are as bad as you are.
    5. Re:I blame the tools by ensignyu · · Score: 3, Informative

      FYI, that programming model is called futures.

    6. Re:I blame the tools by StarvingSE · · Score: 1

      Open MP basically works like this for C/C++ programs. It uses preprocessor directives to establish the sections of code that should be run in parallel.

      However, I think one of the above posters had it right, the main issue with writing parallel programs is synchronization. Despite the tools that are out there, it is very difficult to debug issues such as race conditions and deadlocks within your code.

      --
      I got nothin'
    7. Re:I blame the tools by BitchKapoor · · Score: 1

      So why not just limit access to C? Have e.g. p1 responsible for it, and let everyone else communicate with p1.

      That's a great idea, and it's called shared-nothing concurrency. Check out languages like Erlang.

    8. Re:I blame the tools by autocracy · · Score: 2, Insightful

      Look up Semaphores?

      --
      SIG: HUP
    9. Re:I blame the tools by DaChesserCat · · Score: 5, Interesting

      I was using a potential answer to this in 1990. I was working for a small company in the Provo/Orem area, called Computer System Architects, which was selling Transputer hardware. For those who haven't heard of Transputers, they were small, 16- or 32-bit processors, with a small amount of built-in RAM (not a cache; this was actually in the memory map and you could do small tasks on a Transputer without any external RAM), 2-4 high-speed serial channels (easily implemented with 4 wires) and a stack-based architecture. Adding megabytes of external RAM was easy, and it was embarrassingly easy to connect up networks of these things, even on one board (in a single ISA slot), and build cluster. An external card cage, in those days, could hold 20 slots, which would hold up to 80 Transputers, using our products.

      I did some Assembly and some C, but the kicker language for this chip was called Occam II. Among other things, it used the indentation in the code to determine block structure. A quick example:

      PAR
          step A
          step B
          step C
          SEQ
              step D
              step E

      In this example, steps A, B and C would all be executed in parallel with another task which ran step D then step E. If you had one Transputer in your machine, it would multi-task. If you had multiple CPU's available, it would spread the task across the CPU's.

      It also has a basic construct called a Channel. These were very easy to set up and use. These were how the different tasks communicated with each other.

      It was not difficult to spawn thousands of tasks, each one doing a relatively small part of an overall task, with full communication and synchronization. Again, if you had multiple CPU's available, it would spread the tasks across them. A board with multiple Transputers was usually doing ray-tracing or rendering Mandelbrot fractals as a demo anytime we went to a trade or tech show. They could knock it down to one processor, and things got done relatively quickly. Then, they'd kick in 4 or 16 CPU's and blow people's minds.

      This was in 1990. A 386DX-33 was high-end, back then. The Transputer didn't run DOS or Windows, so it didn't survive in the market of the time. That was a shame; I benchmarked a variety of them, then ran identical benchmarks on various other machines as technology marched on. A T805 running 30 MHz (the top end Transputer I ever got to play with) blasted through mixed integer/floating-point calculations about as fast a 486DX2-66 (which didn't come on the market for another couple years). There was an occasion where I had 16 of those T805's sitting my machine. You'd need a Pentium II to be able to match that occasion. It was well over a decade later that the P-II became available.

      Cool tech, but the programming tools were what allowed you to really use the parallelization. It was typical to achieve over 95% linear speedup (i.e. 20 CPU's gave real-world 19x performance); sometimes we went over 99%. Most Intel SMP machines are lucky if they give 80% linear speedup (4 CPU's = 3.2x total performance).

      --
      ... by the Dew of Mountains the thoughts acquire speed, the hands acquire shakes, the shakes become a warning
    10. Re:I blame the tools by itwerx · · Score: 1

      It's the synchronisation.

      Having done some parallel programming in Fortran back in the mainframe days I have to agree, it's insanely difficult! The only "easy" solution I can think of is, as has been mentioned elsewhere, more intelligent compilers which can identify non-interdependent procedures. It won't be true parallel programming but it will be a lot more so than a purely linear approach.
            That said, what the CPU and OS manufacturers have been doing lately does a pretty damn good job of parallelizing things as they stand. You take any heavily loaded multi-proc server, whether it's handling databases, files, web-sites etc. and the CPU utilization is surprisingly well balanced, all things considered. There's also the added advantage that if you do get a runaway process it's MUCH easier to regain control and kill it in a multi-proc system. Then of course there's the whole VM scene which is making things look more and more like a mainframe environment every day...

    11. Re:I blame the tools by BosstonesOwn · · Score: 1

      While people often refer to these as cores on a chip why not chip on a chip ?

      For instance why does c have to be addressable to p0 p1 p2 p3 p4 p5 p6 p7 ? if p0 is working on c why does p1 need to be able to reach it ? Why not isolate each core and push c to an addressable cache strictly for the core interconnect ? Wouldn't this make for an easier way of parellel programming ?

      p0c could be shared by all procs as a location in the cache , like say 0x00000001. Why not have 1 proc "supervise" the rest ? I really have never understood that. Have proc0 doling out work to all the other procs and have it scan for the other procs jobs already done. At this point the supervisor could be made super efficient and all the other procs could be say crypto/math while the others could be general purpose. Wouldn't this be more suitable for parallel computing ?

      I have not had to program in years and I never really understood multi processors well enough to completely understand how they actually interconnect.

      --
      This package Does Not Contain a Winner
    12. Re:I blame the tools by operagost · · Score: 1

      This was in 1990.

      You'd need a Pentium II to be able to match that occasion. It was well over a decade later that the P-II became available.
      Nope, it was about seven. But that's still impressive.
      --

      Gamingmuseum.com: Give your 3D accelerator a rest.
    13. Re:I blame the tools by KDR_11k · · Score: 1

      That still has issues, e.g. the function calls for modifying it happen simultaneously, you have to order them somehow to make sure all of that is still executed only singlethreaded but you have to prevent simultaneous writing to the queue as well, etc.

      --
      Justice is the sheep getting arrested while an impartial judge declares the vote void.
    14. Re:I blame the tools by KDR_11k · · Score: 1

      if p0 is working on c why does p1 need to be able to reach it ?

      Depends but usually it's the job of the programmer to make sure that p1 can't access c while p0 is working on it. The compiler can't reason that for you (of course, compilers get more intelligent by the day) so you have to tell it that p1 has no business accessing c while p0 is using it. Pushing c to some other hardware thing doesn't solve the issue of read->process->write happening over several cycles and possibly concurrently so p1 reads and processes, p2 reads, p1 writes, p2 processes and writes and you lost p1's result.

      It's not a new issue for multiprocessor systems (other than adding bottlenecks), preemptive multitasking can already cause the same issues.

      --
      Justice is the sheep getting arrested while an impartial judge declares the vote void.
    15. Re:I blame the tools by KDR_11k · · Score: 1

      Starting a thread is easy, making sure the thing doesn't crash is the hard part.

      --
      Justice is the sheep getting arrested while an impartial judge declares the vote void.
    16. Re:I blame the tools by Anonymous Coward · · Score: 0

      The Transputer didn't run DOS or Windows

      But it did run UNIX, in the form of Helios.
      Atari made the Abaq/ATW computer with this.

    17. Re:I blame the tools by ralph.corderoy · · Score: 1

      The Transputer took its model from Tony Hoare's CSP. You're right. Channels are the correct way to do this kind of thing instead of semaphores, etc. You can do them in C these days with things like LibTask.

    18. Re:I blame the tools by DaChesserCat · · Score: 1
      When I first read about the Abaq (Byte Magazine, 1988 IIRC), I was excited. The original idea was something like a Mega ST functioning as a host, with Transputer modules connected to the DMA port on the back end. Then, it changed. You had a typical-looking computer case with a limited number of Transputer boards which plugged in. Do some digging around; you can find pictures.

      Limited amount of expansion available. Normal-looking computer. Disappointing, really.

      Another aspect of the whole Transputer thing is that INMOS (the company which developed the Transputer) had small things called TRAnsputer Modules or TRAMs. You could buy an ISA board (VL-BUS and PCI didn't exist, back then) which had an adaptor for the serial channel and a soft-configurable switch, then plug multiple TRAMs into it (think daughterboards). Assuming each TRAM had four serial channels on it, two of them were hard-wired and the other two went through the soft switch. In that fashion, you could create all manner of topologies without physically modifying the layout on the board. You could get a TRAM with:
      • a screaming fast number-cruncher and some RAM
      • a video adaptor with a certain amount of VRAM and a Transputer
      • one bit-plane for a graphics adaptor and a Transputer
        you could link multiple of these TRAMs to one which actually did the graphics output
        lots of raw processing power applied as a GPU
      • a 16-bit Transputer (T212) and a SCSI adaptor
        think about the kinds of parallel processing RAID-based systems you could build with THAT!


      It's hard to even find information about these things, these days.
      --
      ... by the Dew of Mountains the thoughts acquire speed, the hands acquire shakes, the shakes become a warning
  100. some new research ... by Anonymous Coward · · Score: 0

    My friend has a paper in PLDI 2007 that is starting to address the issues that have come up in this thread, but for 'backwards' languages like C and Java. :) The abstractions are definitely part of the problem ... reasoning in terms of mutexes and barriers and so on is a big pain. Search for "Optimistic Parallelism Requires Abstractions" ... the idea is to define commutativity conditions on the methods of shared data structures, and to execute code speculatively until the commutativity conditions indicate conflicts, which trigger aborts in the system. Ideally, all a programmer would have to do is identify the blocks of code he wants to execute in parallel (with constructs like for-every) and specify some conditions on all the shared data structures he is using, and the system would take care of everything else.

  101. A better approach to parallel programming by MOBE2001 · · Score: 2, Insightful

    The problem with programming is that we are forced to use programming languages. Parallel programming is what programming should have been in the first place. We find it difficult because the tools are inherently sequential. Why? Because they are based on languages (usually English) and languages are inherently sequential. Just the fact that most programmers have to learn a computer language based on English (why not Chinese or French?) should be a clue that the linguistic approach is fundamentally flawed. The way a program works has nothing to do with what language you understand.

    What is needed is a new software paradigm that uses parallelism to start with. It should be a system based on elementary communicating objects. And the best way to depict parallel objects and signal pathways is to do it graphically. I say that the entrire computer industry have been doing it wrong from the beginning (since Lady Ada Lovelace). It is time to move away from the algorithmic model and adopt a non-algorithmic, synchronous software model. Even our processors should be redesigned for the new model. Only then will find that parallel programming is not onl y easy but the only way to do it.

    1. Re:A better approach to parallel programming by hernyo · · Score: 1

      Also few [none?] programming languages have very good parallel programming support. Let's say, you have a long "for" loop which could be executed in many parallel threads. Thus, you have to create the threads, run them, gather the data, and destroy them. What if you could just write:

      #parallel //tells the compiler that the following code can be executed in parallel threads
            for (...) { do something...}
      #end parallel

    2. Re:A better approach to parallel programming by TheRaven64 · · Score: 1

      Erlang is the obvious example of a good parallel programming language. Unfortunately, it's somewhat lacking beyond parallelism and bit manipulation (metaprogramming support is worse than C, and that's saying something). Erlang is based on the Communicating Sequential Processes formalism. Spawning processes is trivial, and costs about as much as a function call in other languages. Sending messages is also easy, and you can filter received messages based on a pattern if you want to retrieve them out of order.

      The biggest problem with writing parallel code is aliasing. If you are using a language like C, then it is impossible for the compiler to completely track aliasing, and non-trivial to track it at runtime. This is a problem, because writing to one memory address can affect the outcome of another process, which makes it hard to reason about things where the order is not guaranteed. Erlang gets around this by making all variables immutable. If you send a message, the receiver gets a copy/reference to the data, but neither of you can change it so it doesn't matter what you do with it. If you need aliasing, you have to be very explicit about it, and create a process that manages the 'real' copy and handles who can access/modify it. I would prefer a slightly looser version, where variables are either writable or aliasable; creating aliases must be done explictly, and makes the variable immutable, but until that point it can be modified.

      --
      I am TheRaven on Soylent News
    3. Re:A better approach to parallel programming by pclminion · · Score: 1

      What wise words. Why don't you write a book and then vanish into obscurity? I hear it's trendy.

    4. Re:A better approach to parallel programming by Colin+Smith · · Score: 1

      It should be a system based on elementary communicating objects. Kind of like... Clients and servers?

      --
      Deleted
  102. Object Oriented Programming is part of the problem by the+agent+man · · Score: 2, Interesting

    because it can make you jump to conclusions regarding how to conceptualize computation. You can end up all too easily with objects and interactions between these objects that are hard to parallelize. With Antiobjects we try to move from the computational foreground into the background. This way one can implement, for instance, game AI, by mapping computation onto dozens, hundreds or thousands of CPU/cores with very little overhead.

  103. MMORPG... by eWarz · · Score: 1

    I am currently working on a game engine for an unreleased MMORPG. The engine is parallel on a massive scale with the ability to use up to an infinite number of threads. Parallel programming is especially effective when dealing with multiple NPCs and their schedules/AI routines, as well as zone management for PCs. The server spawns threads as needed to deal with loads based on number of PCs/Mobs in X area. The client uses threading for graphics (DirectX), Sound, Input, music, and resource management (loading data from disk). It's really hard to further break anything down, however in a single player game things could be broken down much more. Imagine each NPC having his/her own thread to perform advanced AI functions, etc. taking full advantage of the multiple CPUs. Out MMO server does that to a lesser extent (though when dealing with thousands of Mobs, the AI can't be too advanced.) It is not hard to write parallel code. The hard part is finding programmers experienced enough to even know what threading is. You'll usually end up paying 6 figures a year for an experienced C++ dev.

    1. Re:MMORPG... by CodeBuster · · Score: 1

      Perhaps an unrelated question but if I may, what company in their right mind, with all of the risk and complexity of the MMORPG genre, would attempt to compete with Blizzard and everyone else (and their brother) in a market where the switching costs (for the players) are high and almost everyone that wants to play an MMORPG already has an addiction to either World of Warcraft or one of the many other titles currently available? The financial risks for a new title to break into such a crowded space are simply incredible (even by game development standards and MMORPGs are the most risky and expensive of them all). Perhaps you are working on a next generation engine for an existing game, but IMHO new development in this market, especially if you work for a small company going through a larger publisher, is just crazy man crazy. You aren't working on the fallout MMORPG for Interplay (or what is left of them) are you?

  104. multithreaded != super efficient parallel programs by Anonymous Coward · · Score: 0

    But multithreading already helps... It is really pathetic to launch, say, ffmpeg (video encoding) or oggenc on a modern Linux system (like my Core 2 Duo from yesteryear) and see the system poorly using only one core. This is where poorly written programs show their limits. Last time I checked some individual already had 8-core Macs. A poorly written program will then use 1/8th of the CPU's power. Neat no!?

    Now enter the Java world, where all programs are multi-threaded, wether you like it or not. Even the simplest Java programs will have several threads. Like, say, the Garbage Collector thread running in the background. So even the dumbest Java program benefits from multi-threading on multi-core systems. Last time I checked my wonderful IDE (IntelliJ IDEA, arguably the best IDE ever written in any language) was using the two cores perfectly fine. That's one benefit of using a language where multi-threading was not an afterthought.

    Then it's not because you're adding threads that suddenly you're using the most effective kind of parallel processing... Java's threads can't match erlang, for example. While Tomcat 6 (written in Java) and Apache give mostly (I wrote "mostly") the same perfs, an http server written in erlang will smoke these web servers... By an order of magnitude (Google is your friend).

    I'm writing correctly multi-threaded Java programs since years and, unsurprisingly, the multiple cores of recent CPUs are correctly used when running my programs. And I certainly won't say that it's easy to write correctly multi-threaded programs in Java: it is not.

  105. It's hard enough.... by Anonymous Coward · · Score: 0

    The problem is that most VB 'coders' don't know what the word semaphore means.

  106. The problem with multi-threaded programming... by Targon · · Score: 1

    This comes up as a topic several times a year, and the reason people keep asking is because there have been few titles that are multi-threaded being released. It all comes down to the question asked.

    So, is it really all that difficult to write a multi-threaded application? It depends on if you are the type of person who just sits down and hacks the code together, or if you design first, and then code. In order to write a multi-threaded application, you need to decide at the start to make the program multi-threaded. Can you split the program up into pieces that can run independently, while still communicating between the pieces?

    Since this is a design decision that needs to be made VERY early in development, it seems that most of the big development houses out there just can't do it. Too many programs take too much code from previous applications, and that makes it overly difficult to fit into a multi-threaded design. These companies just don't seem to be willing to write anything from scratch at this point. They use engines from previous titles, or that they purchase that were never multi-threaded, and so, you don't see much in the way of change.

    Look at Electronic Arts, they have sports games they release year after year that really don't change, EVER. They add new data, but the game fundamentally doesn't get updated from year to year. The fact that they can get away with releasing the same thing year after year and make tons of money has made them lazy, and they just don't seem to be willing to devote serious effort into new code.

    It takes a developer around 5 years to develop a game fully from scratch if they need to come up with the engine themselves. That involves engine development, storyline(for a game that has a storyline), voice acting, etc. So, if a title takes 3 years, then the engine is probably taken from another project, and is probably single-threaded.

    Now, I have my hopes that Dragon Age(Bioware has it under development right now) will be multi-threaded by design, and it will be very well designed with multi-threading in mind. Being able to take advantage of more than 4 or more cores would be a good thing.

  107. Been there done that... by JerryQ · · Score: 1

    Between 1987 and 1990 I led a team in Digital which built a global currency management system running across 40 machines worldwide acting as a single system, and all operating in parallel, without stopping for synchronisation. We built a global 'synch wave' which allowed the business to be 'closed' without interruption. The near infinitely scaleable techniques we developed were unfortunately never picked up on and exploited, however, it was not particualarly difficult, once we had built our underlying (I only care about my neighbouring process) architecture rather than the central control processor architecture. As for the 'Moores Law for Programming' unfortunately there is not the industry incentive to seek such humungous gains, as the revenues of the business software businesses are predicated upon man hours, effectively 'cost plus' economic models. all the best Jerry

  108. Yes and here is why by deadline · · Score: 1

    Imagine taking your CPU and breaking it into sub-units and then having the user reconnect them with other hardware. Sounds like a programming nightmare. That is exactly the state of parallel computing with clusters and with multi-core (Intel, AMD, and IBM, Sun multi-core are different enough to make a single programming approach "hard")

    The problem "depends" on what you are trying to do. Parallel rendering -- simple. Proteins in water - hard (but much of this work has been done fortunately).

    Parallel programming is faced with the problem that there is no guarantee that a parallel program will be BOTH portable and efficient for a given architecture. (largely due to what I mention above)

    Over my 15+ years of working with parallel programming I have had some ideas. I think the expectation levels need to be lowered i.e. 3 weeks with a functional language equals 2.7 speedup, 2 months with threads or OpenMP or MPI equals 3.5 speedup on 4 cores. Of course the functional language is not quite ready yet!

    --
    HPC for Primates. Read Cluster Monkey
  109. Start with the right platform by Linker3000 · · Score: 1

    Many of the major issues concerning parallel programming can be reduced in complexity and impact by using the correct programming methodologies to map out which tasks can be 'parallelized' (hate that word!) and what dependencies they do or do not reply upon, but the best way forward is to encourage a mind-set change in programming by leaving behind the rigid adherence to a synchronous processing platform that derives all timing from a single clocking source and to embrace an asychronous working environment. Only then can the constraints that come with thinking about linear time dependencies be elminated. Asynchronous biological/optical processors, anyone!

    --
    AT&ROFLMAO
  110. Re:Errors are difficult to find out in such system by himanshuarora · · Score: 1

    No. They are some of the brightest students of my country. Moreover, assignments used to be very very tough.

    --
    Spam: Any activity on internet to gain popularity without paying to advertising companies like Google.
  111. Expression of algorithms by akypoon · · Score: 1

    The problem is that our existing parallel computational models and languages are derived from the sequential ones. This imposes extra complexity in the expression of parallel algorithms. e.g. Procedure, a very fundamental concept in the sequential world, turns out to be hazardous in the parallel world because it multiplexes code. When code is multiplexed, you have all the locking problems and the headache that comes with it. Using a pattern matching mechanism in place of procedural abstraction for expression of parallel algorithm has moderate success (e.g. see Tuple Space) in the past. However, once it is being used with a sequential language, the procedural barrier kicks in and multiplexing returns.

    In summary, when we start to think parallel algorithms are scaled up version of the sequential ones, we already build a lot of artificial barriers in our way to think about parallel algorithms. It is probably not right neither, to think sequential algorithms are special cases of the parallel ones. The reason is that the overall complexity involved in sequential algorithms are much less than the complexity involved in the parallel ones (sequential algorithms have less things to get right than the parallel ones) and there is little reason to tweak the current sequential models at this point in time.

    My modest proposal to the problem of parallel algorithms is to begin in the middle: initially we simply treat the two separate beasts (parallel and sequential) as individuals and find a minimal interface that would handling the complexity in both worlds reasonably well. Then expanding on this interface to cover as many ground in both direction simultaneously. Repeat and rinse until we find a good enough solution that could be implemented and optimized on existing hardware architecture (you want performance from parallel algorithms that compute correctly, right?).

    My hypothesis is that we may never find a good enough interface that covers all of parallel and sequential worlds. However, the proposed process would let us adapt computational models as our needs have changed.

  112. parallelizing office tasks by CarpetShark · · Score: 0

    There is a very real limit as to how much you can parallelize standard office tasks.


    Actually, that's probably untrue, in the way you seem to mean it. Of course there's always a limit, but I think that things like wordprocessing and spreadsheet design could be HIGHLY parallelized.

    The problem at the moment is that only one person does the job, and they do it sequentially. It could be done, however, so that many users each write a paragraph, or proof-read a paragraph, or do the layout, etc. This is what's been done for a long time, in more writing-focused commercial ventures, such as publishing: a different workflow allowing parallelization, and many specialised workers, performing the different tasks.

    This could be applied to parrallel programming, too -- especially as we're moving more and more towards automated spell-checking, grammar checking, stylesheet application, index generation, typography rendering, etc.

    Equally, in spreadsheets, there's no need for one cell to be designed with another cell or spreadsheet already in place. If you know the formula you're entering, someone else could easily complete the other cells later. Workflow is a bottleneck here, but that's arguably because the tools we've used until now haven't provided the opportunity for a different, better workflow.

    Beyond that, there are still PLENTY of places where the UI itself could be parallelised: updating thumbnails, loading images, re-rendering at a new DPI, or rendering a different part of the page, drawing widgets on the screen (already partly parallelized by GPUs).

    A move to a more event-oriented programming methodology would probably help a LOT of this stuff.
    1. Re:parallelizing office tasks by Anonymous Coward · · Score: 0

      There's still little need to parallelise the code that performs updates etc on these applications. Al you need to to be able to lock a cell or paragraph so one the editing user can edit it. A single-threaded application can then work quite happily as before whilst still allowing multiple users access to the single shared document.

      Now perhaps that's what you mean by parallel applications - allowing many tasks to operate on shared data, but the moment you introduce people to the job. Its a good example of what to use threads for in an application, but obviously not useful when you have real people working on stuff - we're too slow for the effort to be worth it.

      A message-passing architecture actualy has the opposite effect of parallelising things, you end up with a single thread where the messages are sent and processed, and even if they're handed off to a component, it still tends to be driven within that main thread.

      Now, 1 thread for drawing the UI, another for handling user input, another for fetching data, that'd work. But bear in mind the experiences of the Windows Explorer team when they first moved to Win95 that had these newfangled thread things - they put a thread in for everything (eg, open a folder, spawn a thread to get the data to draw the tree, etc). And Explorer performed truly abysmally.

    2. Re:parallelizing office tasks by CarpetShark · · Score: 1

      No, I don't mean allowing tasks to share data. There's lots of scope for parallelisation in spreadsheets. Every individual calculation can be parallelised, and some of the more complex functions alone could be ran on an entire cluster of machines. This will only increase, as an ever-growing number of cores encourages more complex functions to be included in apps.

  113. Has been done. by jshriverWVU · · Score: 1

    Programs that benefit from parallel programming more than likely are already parallelized. (Photoshop, Maya, Chess programs, Games, etc) What's the point in parallelizing Notepad? My point not everything needs to be developed like this, but anything CPU intensive can benefit and most of the time does.

    1. Re:Has been done. by C_Kode · · Score: 1

      Who said anything about notepad? Notepad turned into Wordpad. Wordpad turned into Micrsoft Word. Apps are getting bigger not smaller. For one, I think web browsers should be written parallel allowing threads to handle embedded technologies like Flash, Silveright, Java, JavaFX, Flex, etc that are now apart of most websites.

  114. Ask Dijkstra: It's hard to do right by Hyperbolix · · Score: 1

    The problem faced when developing multi-threaded applications has two fundamental parts: safety and liveness.
    Safety is ensuring one thread does not clobber some other thread, while liveness is ensuring the threads do not cause each other to lock.
    The classic example is Dijksta's dining philosophers problem. In this problem you have a set of five philosophers seated around a circular table. Between each pair of philosophers is a single fork, but each philosopher needs both the fork to his right and the fork to his left to eat. Being philosophers, each can either eat or think. To facilitate safety, one must ensure that when a philosopher wants to eat, he cannot use a fork that is already in use. To facilitate liveness, one must ensure that if a philosopher wants to eat, and it is safe, then he/she can eat.
    Clearly, one cannot compromise safety, as this will cause fundamental problems with the software. A programmer must deal with liveness in at least a minimal manner to prevent deadlock, that is, the case wherein every philosopher, in order around the table, picks up his right fork and sits waiting for the left to become available - which will never happen, and execution stops. One solution prevents this by numbering the forks, ensuring that each philosopher picks up the lower numbered fork first, and as such, in this case, the final philosopher would attempt to pick up the lower number fork, already held by the first, and not do so as it is locked, thus allowing the fourth philosopher a chance to eat, though in this case only one philosopher can eat at a time. A better solution involves having each philosopher pick up the even numbered fork, ensuring the maximum number of philosophers that want to eat, can eat.
    As you can see, there are two major issues to deal with, and only one offers any flexibility. In choosing how to implement liveness, that is, how to dealing conflicts in locking, we find added complication that must be overcome to maximize efficiency. In reality, this is a question of finding your critical sections of code and using fine locking, wherein you hold only the mutex of the data structure you are modifying. This is significantly more difficult that holding the mutex on the entire thing. To draw a correlation, the first solution to liveness in the dining philosophers problem can be achieved with a single mutex on the table. The second solution requires one mutex per fork (or, for another way to think about it, one mutex per philosopher.)

  115. The UNIX KISS principle by Pig+Hogger · · Score: 1

    Why should it be hard?

    I mean, with UNIX, it's easy to write complex applications thanks to the "each program is a filter" paradigm and with pipes.

    Each program sends it's output to the next, and so on.

    So why not do the same with processes?

    A program would define serveral separate processes (functions), which are then parallelized through pipes; then, the various processes (functions) would simply be executed through the OS what would take care of the scheduling.

  116. Re:Object Oriented Programming is part of the prob by CrankyOldBastard · · Score: 1

    I don't think that OOP is the problem, rather that most OOP languages are jut syntactic sugar on top of the good old 'sequence, selection and iteration' models. An Actor model however suits ||ism quite nicely though. An OOP language (such as Smalltalk or even Java) could be used for quite nice || code in a Actors with Consumers and Producers IF a good memory manager and Garbage Collector was developed. I base my opinion on playing with Visual Works on IBM's SP2 architecture about 12 years ago.

  117. It's getting harder, not easier. by LordNimon · · Score: 1

    I work for a company that makes microprocessors. Obviously, I can't give you specifics, but based on our future plans, I can tell you that parallel programming is only going to get harder, not easier, with silicon advancements. Our customers want more features and more performance, and that means exposing the programmer to more of what the hardware is doing, not less.

    On a side note, let me just add that IMHO 90% of programmers I've seen really aren't very good, so complaining about such-and-such being "too hard" is cliché. I'm sorry that some companies out there are having a hard time finding programmers who know what they're doing, but that's just the way it is.

    --
    And the men who hold high places must be the ones who start
    To mold a new reality... closer to the heart
  118. LabVIEW by SydShamino · · Score: 1

    I think that what's most likely to happen is we'll see the emergence of a new programming model, which allows us to specify an algorithm in a form resembling a Hasse diagram [wikipedia.org], where each point represent a step and each edge represents a dependency, so that a compiler can recognize what can and cannot be done in parallel and set up multiple threads of execution (or some similar construct) according to that.

    You just described LabVIEW. It is a dataflow graphical programming language, meaning that each component executes when all of its inputs are ready. Multiple components that are ready simultaneously can be processed simultaneously. Programs can even consist of completely separate functional dataflows, and both will execute in parallel.

    Yes, I believe it already supports multiple processors.

    --
    It doesn't hurt to be nice.
  119. bluring the lines a bit... by pjr.cc · · Score: 1

    Its interesting how technology has evolved over the last 20 years and this is a prime example... go back 15 years and high-end was truely high-end, desktop was very low-end and there was varying shades of grey all throughout the spectrum.

    Those 2 ends of the spectrum still remain to a large extent, but the distance between them really has narrowed. Sure you can buy a huge multi-rack (possibly even custom designed) box if your a company and the raw grunt of it will slaughter your over pc. But, the architectual differences are nowhere near as huge as they were.

    But parallel programming is by no means new, and in fact it was really big news 15 years ago on MPAR boxes. It was a highly specialised area and while MPAR boxes still do exist, the demand for the skill set has certainly all but disappeared... Well now its back again, possibly with a vengence. But when you look around, theres alot of parallel type paradigm's already in existence that can probably help the industry grow. Take (as an example out of thing air) stackless pythons model of (sort-of) blowing away the threading model and going with something they like to call tasklets and micro-threads. To me, this whole concept sounds rather antiquated much like the pre-smp-desktop era with its co-operative multi-tasking, but its a concept that is worth building on.

    Personally i think perhaps they'll find a way of overcoming the whole "we cant make cpu's any faster anymore" thing with some new technological discovery. If they don't however, it really could spell a new era of computing in some ways. People might possibly start looking at CPU architecture with a new eye. Its been a while since we even had (real) arguments about RISC v CISC for example.

    Imagine a completely new cpu design thats like nothing we've seen, but scales in some horizontal way thats transparent to programmers. Necessity is the mother of invention after all;)

    What I really am interested in seeing is how something like that would develop? Microsoft have been traditionally very bad at dealing with architecture changes on those kinds of scales (think smp, 64bit, etc) and thats not to say linux, apple, Sun, BSD (or anyone else) would be able to adapt. But if there were a fundamental shift in the basis of computer design there stands a chance for someone to win a pretty big victory. Although I personally hope its not apple, apple seem great at farming a new technology and making it just a little expensive and forcing someone to come out with a cheaper (not just in cost) alternative (a good example of that was firewire vs USB, firewire should have won that battle if only apple just hadn't made it way too expensive to license).

    But, i think by "necessity is the mother of invention" the end result is going to be something more like a shift in the way people code - perhaps a new language, new design principles, etc that lend them self to parallel programming. Perhaps even a method of virtualisation that solves the problem?

    Whatever does happen, it'll be exciting to be along for the ride! (i hope).

  120. Quantum Computers by Anonymous Coward · · Score: 0

    Why paralelize when we have quantum computers?

  121. Yes it's hard, but it could be easier by tyme · · Score: 1

    The main reason that 'parallel' programming is hard is that current tools support it only as an afterthought. All mainstream tools (languages, compilers, libraries, debuggers, etc.) are built, primarily, to support single-threaded code. It is up to the individual programmer to write code that is multi-thread safe by enclosing dangerous sections of code in mutexes, erecting semephores to coordinate multiple threads, and so on. Even languages with explicit support for multi-threading (e.g. Java) only support it as the exception: all code is presumed to be inteded for a single-threaded environment unless the programmer explicitly identifies it as multi-threaded (e.g. 'synchronized').

    A better solution would be to assume that all code is run in a multi-threaded environment and have the tools build the code for mutual exclusion, unless explicitly told otherwise by the programmer. The language and libraries could also provide basic utilities and data structures in thread-safe implementations by default, requiring the programmer to specifically select a non-thread-safe version when desired. Monitors (thread-safe objects) were invented decades ago, but are still not in common use in modern languages.

    The fundamental problem is that people are really, really bad at reasoning about thread-safety and figuring out where mutually exclusive sections of code and race conditions are. Relying on the programmer to get such things right is a guarantee of failure. The tools (languaes, compilers, etc.) should be able to determine when methods/functions access the same common state and automatically insert mutexes/semephores to enforce mutual exclusion, or at least assume that, unless told otherwise, all methods/functions must have mutexes/semephores. You'd still have instances where a programmer thought, incorrectly, that some code could be run with a mutex, but it would be the exception rather than the rule.

    --
    just a ghost in the machine.
  122. Depends on the problem and the need. by Pedrito · · Score: 1

    Most apps that real people use don't need to be parallel processing. Word processing, e-mail, web browsing, even 95% of spreadsheets. These apps do some stuff in multiple threads, but they're not truly parallel processing so much as performing some operations in background threads. So I think part of it is that the problem needs to be better defined as to what you consider parallel processing. If you mean simply running a thread in the background, that's not a big deal and I do it all the time in my own code.

    True parallel processing only needs to come into play with very compute intensive problems. In these cases, parallel processing needs to be taken into consideration in the initial design. Proper design can usually avoid serious problems, but it's also a learned skill, like any other aspect of programming. The mistake is to think that someone who can program should inherently have this skill. People specialize in it. Just like some people specialize in 3D apps or database apps. If you do it enough, it's not that hard. I mean, no harder than any other specialized field, like 3D. It's simply learning a new set of issues to deal with, how to avoid problems related to parallel processing and how to debug those problems when they do appear.

    Generally, the biggest problem is coming up with a suitable way to represent a computation in a parallel way. Many compute intensive problems are simply hard or impossible to handle in a parallel way because of dependencies that require some computations to take place before other computations. Some problems, on the other hand, lend themselves quite well to parallel processing.

    But the question, "Is Parallel Programming Just Too Hard?" No. It's not. It's hard, like anything else that requires time and skills to develop, but it's not "too hard" as a field. But as I said, certain problems simply don't lend themselves to parallel processing. In those cases, it's not that parallel processing itself is "too hard," it's simply that the problem isn't one that's necessarily solvable in a parallel way.

  123. No - it's not difficult. It's rather easy. by TemporalBeing · · Score: 1

    No, writing programs that do parallel processing (whether using threads or processes to do it) is really quite easy. You do need to have a good background in programming before you take up the challenge, though, or you will really mess it up - but that is true for any more advanced technique in a field - you need to know the basics to do the advanced stuff.

    Single threaded apps are really the basics of programming, and today's environments really, really require multi-threaded/multi-processed apps. For example, GUI environments usually require having a thread dedicated to handling the GUI interface, and running lots of worker threads to perform the various tasks. (If you get a GUI program whose window hangs on you, it is because either (a) it was not written correctly and does not use a dedicated thread to handle its GUI, and/or (b) it got stuck waiting on something. 'a' is the more likely cause.)

    Now, what can be a bit difficult is determine what parts of the program to offload to another thread. And the simple answer there is anything that could block the program if it does not return fast enough. (Fast enough being
    The problem simply becomes that we do not want to do it because we think it is hard. And it is not a matter of language issues either. Certainly some languages may make it easier, but it is easy to do multi-threaded and multi-processed programming in C and C++ - OO makes it even easier. What programmers need to learn is how to use locking mechanisms correctly to protect the data, and how to write code that will keep locks for minimal amounts of time in order to minimize possible locking conflicts. (OO's Get/Set methodology helps this tremendously.)

    So, no - it is not hard. Most programmers are just to lazy to learn how and/or attempt it. Reality is, if you want to maintain a responsive interface you have to do it.

    FYI - I've been doing this very thing for a quite while now, and in C/C++ in a Win32 environment none-the-less. I've also done similar work under Linux. When you architect your program correctly, it becomes really easy to do. I would offer that the real cause is that software programmers don't do enough software engineering for their programs; so everything happens in chaos, which does make it difficult to do. (Thus the perception of being hard, and the laziness of programmers in doing it.)

    --
    Truth is like the sun. You can shut it out for a time, but it ain't goin' away. - Elvis Presley (source: imdb.com)
  124. OS support matters more than languages by Junks+Jerzey · · Score: 1

    Erlang succeeds because it has message passage between lightweight processes, not true OS threads. You can easily get 100,000 processes cooking along and talking to each other in Erlang, but such numbers would kill most operating systems. And even if you could get those numbers with Linux or Windows, Erlang would still walk all over them performance-wise by a huge factor.

    So what we really need is for OSes to be designed around having massive numbers of threads that communicate via message passing (i.e. shared nothing). Then the need for custom languages will go away.

    1. Re:OS support matters more than languages by Eli+Gottlieb · · Score: 1

      To implement "lightweight" or "fast" threading, operating systems must try to always switch to a thread from the current process when scheduling. If they can't do that, they end up performing a process switch.

      And unfortunately, a process switch involves a costly hardware context switch, and for all the work that goes into making chips faster nowadays, nobody has tried to make context switching on a standard x86 faster. Other architectures had tagged TLBs and other optimizations for fast context-switching for ages, but nobody has brought it to a processor on which you or I can run desktop Linux.

  125. Re:Yep by Anonymous Coward · · Score: 0

    While I don't disagree that many consumer apps work OK on single thread hardware, it certainly isn't the case with every app and certainly not emerging apps.

    A current example are things like video encoding or in some cases play back. Other things like word processors are enhanced by threaded hardware due the number of threads they spawn. Often the consumer benefit is snappy performance on low power machine (power as in wattage).

    Given the above I don't think that the big benefit of MSP hardware at the consumer level is the acceleration of any one program. Rather I see the development as enabling the broader use of a computing system due to the OS being able to keep the system responsive during multitasking. It would not be impossible to have a video conference take place while encoding a movie and maybe a word processing or Internet operation going on. Of course somebody is going to ask who would want to do something like that - the easy reply is grand parents. Or more exactly children of grand parents responding to requests to see the latest pics or movies.

    It is the ability of the coming multi core processor to adapt performance to user needs that will make these PC's high in demand. Adaptability is a clear goal of AMD's coming quad core with the independent control they now have of the individual cores on the chip. Basically it allows the operating system to supply the computational power required on demand. Frankly the coming technology has put me off buying a new machine. The reality is that I may be able to buy a quad core machine that uses far less power on average than the single core machine I have now. That is cool.

    The other thing that people should recognize is that many so called professional application of computers is so simple because of the hardware required to run the software. Give consumer hardware to approximate that professional hardware and you will see consumers running "professional software". And if not consumers a good number of professionals that don't have the bank roll of a Fortune 500.

    So is SMP hardware difficult to exploit in consumer applications. I'd say not at all. You just don't need to consider that all programs don't need to be parallel to justify the SMP hardware. As to the whining about single thread performance, I don't think people will have much to complain about with the advent of some of the new processor technology about to hit the marketplace, it will get better and you will have multiple cores to boot.

    Dave

  126. Re: Lack of Need by Loismustdie129 · · Score: 1

    Maybe there just isn't a big enough need to use parallel programming. Sure there are some programs which just need it but for the most part the general consensus is that we just don't needed. I know you think that we should advance in loo of the demand but in the long run programs are made for the user and maybe he/she just doesn't see the need.

    --
    "Health nuts are going to feel stupid someday, lying in hospitals dying of nothing." - Redd Foxx
  127. Challenge is needed by athloi · · Score: 1

    Through strife, we become stronger, and less bored. And right now, it seems everyone is bored. How many web apps can you code before you shoot yourself to see what's on the other side? I'll never give up Perl and its swiss army knife approach, but I think challenges make me grow and keep from becoming a stagnant, boring curmudgeon (or more of one).

  128. Hard? Huh? by ancient_kings · · Score: 0

    Not if you're are doing it with Fortran95 and MPICH-2....its really a piece of cake...

  129. Threads can simplify by DusterBar · · Score: 2, Interesting

    Threads (multiple threads) can actually simplify the software rather than making it more complex. Or, rather, simplify writing the software.

    Ok, so maybe I am an old hand at multi-threaded programming (over 20 years of doing this stuff) but it just makes sense for so many things. Past examples that the general public may have seen are things I wrote on the Amiga, machines with interrupts, Apache, etc. (Imaging writing a high-volume web server without multiple threads!)

    There was a Hockey game on the Amiga that had each player on the ice having its own thread and own IA behavior. The code became so much easier than the traditional multiple interlocking state machines that such simulation games had to run that in order to port it to the PC they ended up writing their own multi-threading environment that ran on top of DOS.

    Personally, I think that too many people are scared away from multi-threaded programming because of the "horror stories" and a few "old guard" that don't feel comfortable in such an environment. For me, many problems are so much easier in the multi-threaded solution space that I rarely think of non-multi-threading. (Well, co-routines are sometimes required when the platform does not support true multi-threading)

    1. Re:Threads can simplify by KDR_11k · · Score: 1

      Games often use cooperative multitasking but preemptive multitasking is rare.

      --
      Justice is the sheep getting arrested while an impartial judge declares the vote void.
    2. Re:Threads can simplify by Nutria · · Score: 1
      Imaging writing a high-volume web server without multiple threads!

      Sure, no problem: select() and epoll().

      --
      "I don't know, therefore Aliens" Wafflebox1
  130. If past is prologue by George+Johnston · · Score: 1

    If past is prologue then developers will spend time optimizing the wrong part of their program for parallelism...

    --
    Orignator of the Miserable Failure Googlebomb
  131. Programming is hard by ebunga · · Score: 2, Insightful

    Most "programmers" seem to have a difficult time churning out normal, non-parallel code that runs, much less code that is bug free. Do you seriously think your average code monkey reusing snippets from the language-of-the-week cookbook is going to be able to wrap his head around something that actually requires a little thought?

  132. Yes--resounding! by null-sRc · · Score: 1

    You're right, and have convinced me: parallel programming is too hard. I'm going to disable my 2nd core, delete all my threaded applications and libraries in anticipation of the new age.

    Finally things make sense again!

    --
    -judging another only defines yourself
  133. Parallel programming not hard by Maxo-Texas · · Score: 1

    I've transformed several processes in this fashion and I'm no super brain. In many cases, the issue is not processors but saturating the I/O channel. There isn't much point in adding more parallel processing if your disks have 10 second queues for I/O.

    Also, some problems do not break into pieces.

    My understanding of the hard part currently is being able to write a straightforward loop and the compiler will know when to break it into "X" pieces.

    The fundamental problem is probably lack of pay in parallel programming. If the pay is there, people who are talented will enter the field.

    --
    She was like chocolate when she drank... semi-sweet at first and then increasingly bitter.
  134. Re: The hard thing is the synchronisation by Anonymous Coward · · Score: 0

    This is just a bad parallel algorithm that doesn't lend itself to synchronization. Two procedures (p1 and p2 here) should not both be responsible for setting the same result variable (C here).

    If two procedures contribute to a result C, then they should each place their results in intermediate variables (A and B). The final result is C = A[+]B (where [+] is some operation). This is how implicitly parallel compilers work, such as Fortran and ADA. Consider a Fortran dot-product operation.

    If two procedures each set a result C, then only one procedure is really needed. In the sample, procedure p1's effort is clobbered by p2. Some parallel compilers might be able to tell which procedure (p1 or p2) is useless.

  135. Er. by stonecypher · · Score: 1

    one has to ask: is parallel programming just too difficult for most programmers? Are the tools inadequate or perhaps is it that it is very difficult to think about parallel systems?
    God, no. Just start learning the appropriate tools (erlang, twisted python, mozart-oz, et cetera.)

    Parallel programming's actually pretty easy.
    --
    StoneCypher is Full of BS
  136. Multics by Mybrid · · Score: 3, Informative
    Multics was the precursor to Unix. Multics was a massively parallel operating system. It was designed to be an OS for a public utility. The thinking back then was all Americans would have computer terminals like a vt100 and plug into a municipal computer over a network.

    Multics was designed for long lived processes. Short lived processes are something we take for granted today but wasn't assumed back then. Today we assume that the sequence is we open a program, perform a task, close the program. Microsoft Outlook, for example, relies on Outlook being closed for its queue when to purge email that's been deleted. Programs are not designed to be up years-on-end. In fact, Microsoft reboots their OS every month with Windows Update. I've often speculated that the reboot is often requested not because the patch requires it but because Microsoft knows that its OS needs rebooted, often.

    Why? Why wouldn't one just leave every application you've ever opened, opened?

    The reason is that programmers cannot reliably write long running process code. Programs crashed all the time in Multics. Something Multics wasn't very good at handling back in the 1960s. There was some research done and it was observed that programmers could write code for short lived processes fairly well but not long lived.

    So, one lessoned learn from from the failure Multics is that programmers do not write reliable, long running code.

    Parallel processing is a processing better suited to long running processes. Since humans are not good at writing long running processes it makes sense then that parallel processing is rare. The innovation to deal with this sticky dilemma was the client-server model. Only the server needs to be up for long periods of time. The clients can and should perform short lived tasks and only the server needs to be reliably programmed to run 24/7. Consequently you see servers have clusters, RAID storage, SAN storage and other parallel engineering and clients do not. In some sense, Windows is the terminal they were thinking of back in the Multics days. The twist is that given humans are not very good at writing long running processes then the client OS, Windows, is designed around short lived processes. Open, perform task, close. I leave Firefox open for more than a couple of days and it is using 300MB of memory and slowing my machine down. I close and reopen Firefox daily.

    Threads didn't exist in the computing word until Virtual Memory with it's program isolation came to be. What happened before threads? What happened before threads is that programmers were in a shared, non-isolated environment. Where Multics gave isolation to every program, Unix just recognizes two users: root and everyone else. Before Virtual Memory, this meant that all user programs could easily step on each other and programs could bring each down. Which happened a lot.

    Virtual Memory is one of the greatest computing advances because it specifically deals with a short coming in human nature. Humans are not very good at programming memory directly, i.e. pointers.

    It wasn't very long after VM came out that threads were invented to allow intra-application memory sharing. Here's the irony though. There still as no advancement in getting humans to perform reliable programming. Humans today are still not very good at programming memory directly, even with monitors, semaphores and other OS helpers.

    When I was in my graduate OS class the question was raised then of "when do you invoke a thread?" given you probably shouldn't to avoid instability.

    The answer was to think about threads then as "light weight processes". The teaching was that given this a thread was appropriate for:

    1. IO blocked requests.

      Have one thread per IO device like keyboard, mouse, monitor, etc. There should be one thread dedicated to CPU only and the CPU thread controls all the IO threads. The IO threads should be given the simple task of servicing requests on behalf of the CPU thread.

    2. Performance

      Onl

    1. Re:Multics by Anonymous Coward · · Score: 0

      It's not just that it's hard to program long-running programs. The problem is that humans are not omniscient when we code things, and most programming environments make it hard to change running programs. Ideally, we could exploit the "soft" in software to change a program as it runs in response to changing conditions and understanding. That seems to be the norm in the dynamic systems, including Erlang, Lisp, and the fully interpreted systems (Python, Perl, PHP...).

      Long-running programs can be written. Good operating system kernels are the usual example. Ideally, the common programmer should leave the hard part of making a static base program to the OS and VM designers, and use dynamic programming to fix problems without rebooting.

    2. Re:Multics by Eli+Gottlieb · · Score: 1

      I don't think it is written in stone that humans cannot program easily write long running processes. I think there is a golden opportunity for OS researchers to tackle this problem. The sticky thorn is going to be how to provide isolation as with VM but without sacrificing performance. Threads violate VM protection within the application but at the expense of reliability--programs crashing when threads are programmed incorrectly. Fast thread/context switching has been in processors with tagged Translation Lookaside Buffers (the processor doesn't have to flush the entire TLB on a context switch) for ages. However, nobody has brought it to the x86.

      Fine-grained memory sharing can't be done on systems that rely on paging. I repeat, systems that manage memory using fixed-size pages cannot support fine-grained memory sharing at the operating-system level. The hardware prohibits it.

      Really, most of these problems rest on the hardware. We OS guys do what we can, but we have to do it with what we can.
    3. Re:Multics by Anonymous Coward · · Score: 0

      If I understand correctly what you are saying:

      Multics = multithreading = long running processes
      UNIX = only one thread = Windows = short running processes

      I think you are overgeneralizing.

      The reality is that Linux can run for years without needing a reboot. Services written in Java are better than those written in C, because there are less memory leaks and there is less memory fragmentation, so they perform better over time.

    4. Re:Multics by MikeBabcock · · Score: 1

      The reason is that programmers cannot reliably write long running process code. Programs crashed all the time in Multics. Something Multics wasn't very good at handling back in the 1960s. There was some research done and it was observed that programmers could write code for short lived processes fairly well but not long lived.

      So, one lessoned learn from from the failure Multics is that programmers do not write reliable, long running code.


      This is one of the reasons I love daemontools by DJB. I run tcpserver to launch sshd even, so that SSHD isn't running all the time -- it gets executed if a connection comes in and not before. tcpserver is nice and small and easy to audit for long-running bugs.

      Using 'launcher' programs to load the parts of a system that are needed when they're needed would make many systems more reliable, IMHO, not just network servers.
      --
      - Michael T. Babcock (Yes, I blog)
  137. our tools aren't wired to think in parallel by samkass · · Score: 1

    "Since this discussion has been going on for over three decades with little progress in terms of widespread change"

    Actually, there has been huge progress in the last 5-10 years. Before Java, there were no mass-market programming languages that included explicit support for threading primitives. Now that Java is dominant, or at least widespread, in all areas of software except the desktop and game consoles, multithreading has become much more ubiquitous. And game consoles have their own brand of multithreading-- look at the Cell in the PS3.

    There are a lot of ideas for what will be the next generation of tools, which will lead to the next generation of capabilities. It's really all about the tools that make these things easier, more than the developers who just do whatever's the easiest way to fulfill their contract.

    --
    E pluribus unum
  138. excuse for lazy compiler writers by peter303 · · Score: 1

    A good OS and compilers should do most of the work.

  139. Or do most programmers just suck? by Chris+Snook · · Score: 1

    Parallel programming is hard, but I'm not sure that's really such a bad thing. I don't mean that I like inadequate tools, but there *is* a fundamental human limit, and overcoming it requires discipline and training or experience. If the rise of multi-core machines results in greater stratification to distinguish Software Engineers from Computer Programmers, I won't shed a tear. There's a lot of bad software in this world, and simple economics dictates that this will always be true. If we can push that niche towards less important, marginal tasks that are happy being single-threaded, and away from the primary workloads of our increasingly SMP machines, maybe software on the whole will suck a tiny bit less.

    --
    There's no failure quite as dissatisfying as a complete and total solution to the wrong problem.
  140. Practice practice practice... by javabandit · · Score: 1

    The difficulty of a particular parallel programming task depends greatly on the complexity of the task at hand. Serial programming has the same issues.

    I've had lots of serial programming tasks that are actually very difficult to break down, modularize, and make extensible. I've also had parallel programming tasks that have been pretty simple -- and some that have been pretty difficult. Let's face it... a task which involves a simple fire-and-forget is parallel... but incredibly easy. It is when notification and state management are involved that things get more complicated. But that's the same with serial programming -- although serial is a little more straightforward.

    Any programmer worth their salt will become more and more proficient in parallel programming over time. It just takes practice, knowing what to look for, knowing what pitfalls there are, et cetera.

    It just takes practice.

  141. Pre-cooked solutions deter thinking by roman_mir · · Score: 1

    Pre-made solutions that are supposed to 'scale' your applications, things like app-servers, that's what is really not letting the developers of projects to truly parallellize applications.

    In reality many of the back-end applications are parallel just by virtue of sharing common data resources and running on multiple cores/systems. A common database is a synchronized data store, which forces sequential (transactional) processing, but beyond that, the multiple threads running for multiple users are basically parallellilized programs.

    Currently I am on a project where the company decided they wanted a cheap solution, so no Weblogic licenses for this project (Java stuff.) Instead of relying on a cluster of weblogic nodes, I decided to make the application distributable/scalable/parallel just by virtue of the design itself. The design breaks application down into multiple independent services. Each service has a thread pool, each request gets its own thread. All calls between services are asynchronous, a well-defined state machine is forcing a specific order of execution depending on the current state and output conditions from the current service being executed. Each service can be distributed on its own and multithreaded. The communication protocol is done through yet another service, something like a lightweight-persistant message queue. This message service is also distributed, but synchronized on a database table (where the messages are stored.) The message service is aware of each other running service and it decides which instance of a particular service to send a message to (round robin and business/health checks are also included into the decision.)

    So a client makes a call to the system through a web-service, which puts the client to wait and starts a state machine handler, which decides what is the next process going to be. All communications are asynchronous, once the client's thread wakes up, the data is either there or not. The client can be either released (timed-out) or put to sleep again to wait some more time. Even if the client is released, the state machine continues processing and gets the data and stores it in local cache. The next time this data is requested it is already retrieved and preprocessed and can be retrieved immediately from cache. Cache expires/clears based on predefined rules for this data type.

    This is an application that is distributed and parallel by design and not by the virtue of running in a so called 'distributed parallel container'. If more parallellization becomes necessary at any step, it can be outsorced to yet another service, and the state-machine will be modified to include this service into account.

    I find that this is the simplest approach to parallellization of very large systems but I am pretty certain this can be used even for simple algorythms.

  142. Is Parallel Programming Just Too Hard? by Anonymous Coward · · Score: 0

    Yes No Yes No Yes Yes No No No Yes No

    Is it, Linus?

  143. System of Systems by Zarf · · Score: 2, Interesting

    System of Systems is a philosophy that should look a helluva lot like the Unix Philosophy because... it is the same philosophy... and people do write code for these environments. If you want Parallel Programming to succeed make it work as systems of systems interacting to create a complex whole. Create environments where independent "objects" or code units can interact with each other asynchronously.

    Otherwise, as discussed in TFA there are certain problems that just don't parallelize. However, there are whole classes of algorithms that aren't developed in modern Computer Science because such stuff is too radical a departure from classical mathematics. Consider HTA as a computing model. It is just too far away from traditional programming.

    Parallel programing is just alien to traditional procedural declarative programming models. One solution is to abandon traditional programming languages and/or models as inadequate to represent more complex parallel problems. Another is to isolate procedural code to message each other asynchronously. Another is to create a system of systems... or combinations of both.

    If there is a limitation it is in the declarative sequential paradigm and that limitation is partially addressed by all the latest work in asynchronous 'net technologies. These distributed paradigms still haven't filtered through the whole industry.

    --
    [signature]
    1. Re:System of Systems by serbianheretic · · Score: 1

      Parallel programming is hard. And we have hit the GHz limit with
      current technology. What to do?

      1)
      Move to real parallel technology. Maybe 1 processor/task :)
      Hard. Didn't work very well so far.

      2)
      Do what we did so far, but instead of increasing the clock speed,
      use wider bus. Instead of 32/64 bit bus, move to 256, 512 or 1024 bit
      wide bus.
      If we do this, design process and programming concepts stays the same,
      but processing speed increases.

      Having said that, I'm all for parallel processing if we can make it
      practical.

    2. Re:System of Systems by Zarf · · Score: 1

      instead of increasing the clock speed, use wider bus. Instead of 32/64 bit bus, move to 256, 512 or 1024 bit wide bus.

      The network is a bus, the bus is a network. Distributed processing is the same core idea if it happens over a WAN, a LAN, a USB hub, or an internal bus on the same chip. Create OS as an ecosystem to support asynchronous communication between buses. Programs as autonomous organisms living in an environment interacting with each other. Emergent behaviors could be a problem.

      --
      [signature]
    3. Re:System of Systems by serbianheretic · · Score: 1

      You have made an interesting and true statement about the distributed processing
      (WAN, LAN, USB, internal).

      In living beings, it appears that many parallel processes take place at once.
      Our serial execution computers are not so good at that, doing process switching
      (as far as I know), therefore only one task is executed at one time in reality,
      for example binary addition.

      For comparison, output of one neuron may be available as input to 1000 other neurons,
      at the SAME TIME.
      I don't know how we could do that in hardware, and have changing "weights" like
      in living brain.

    4. Re:System of Systems by Zarf · · Score: 1

      I don't know how we could do that in hardware, and have changing "weights" like in living brain.

      One amongst many ideas about how to do this is here: http://en.wikipedia.org/wiki/Artificial_neural_net work and earlier on Slashdot a story about Numenta put forth their ideas for doing likewise. If one neuron is one process then many neurons are many processes spread over many processors. The way you get the processes to communicate is an implementation detail. Synchronous versus Asynchronous neuron states is another implementation detail. Not that implementation details are trivial, but, you should be able to simulate these neurons on existing hardware ... for example in Linux try a neuron simulation that is a kernel module (virtual hardware) that uses the DBUS to communicate with other neuron kernel modules. All the tools are in front of you... just make the connections.

      --
      [signature]
    5. Re:System of Systems by serbianheretic · · Score: 1

      Thank you.

      I'll investigate your suggestions further.

  144. Generation gap by Anonymous Coward · · Score: 0

    My experience is that parallel programming is not all that difficult. However, there is a generation of x86-architecture developers that have developed "bad" single-processor/single-thread habits and are not inclined to change. Many of these folks are the team leads/architects/supervisors/managers of today. Not only that, because they are not inclined to learn threading, they cast doubt on the skills of those who can exploit some of its benefits.

    As an example:

    I worked as a developer for a large payroll processing company several years ago. At one point, due to numerous headaches compiling eight different executables, I broke out their state income tax methods into "plug-in" libraries. I wrote a threaded loader so that the application could continue on its merry way while the plug-ins were loading (adding a some logic to control access until all plug-ins were loaded). The code was solid and ran flawlessly for about a year. Forward a year and an access violation starts showing up. Immediately the manager and "expert" developer (throwback developer) pointed the finger at the threading code without doing any homework and demanded it be changed to non-threaded. Lo and behold the access violation did not go away. Ended up being a memory leak introduced by the so-called "expert". However, did the threading get added back in? Of course not. So to this day the application hangs for about a minute while the libraries load.

    Old habits die hard.

  145. Dataflow could handle the problem by HiThere · · Score: 1

    Back around Mac OS 7.5 there was a language called Prograf which (logically speaking) could handle this problem easily. It required thinking slightly differently, but that wasn't it's real problem. It's real problem was that it didn't have any compact textual representation. Also that is only ran on the Mac. (I believe that it died during an attempt to transition to MSWind, as so many other programs did.)

    They called it a dataflow architecture. (Well, with the Mac being a single processor system the "architecture was entirely software, but ...).

    However it could handle common parallelizations quite easily. A node of the program was defined in terms of what it required to operate, and what it did. The compiler did a kind of reverse sort, starting with the answer it built the required availability of data sources, and chained backwards. There were a few explicitly sequential steps, but they weren't common. E.g., addition was defined as (approx.) to get the answer you need two numeric inputs...THESE, add them together to get the answer. Then the compiler figures out how you are telling it to get THESE.

    I understand that there are still a couple or three dataflow languages around, but the last time I checked two were special purpose and one was obscure. (Well, it's been a few months. There were reasons in each case why I didn't check further into using them.)

    Erlang can also handle the stated problem, but it's SLOW. I don't know if this is inherent or can be fixed. (It may not be fixed even if it can be, becasue it's fast enough for what it was designed to do.) Still I keep coming back to Erlang, because it appears to be the best thing currently active that handles THAT part of the problem space. Then I look at how it handles the rest of the problem space and look for something better.

    Currently I'm quite unsatisfied with all of the parallelization tools that I know of. This isn't something intrinsic in the problem, but because it hasn't been of serious concern among large numbers of people for very long. Good answers exist (in principle), they just don't appear to be currently available.

    --

    I think we've pushed this "anyone can grow up to be president" thing too far.
  146. I've been waiting... by Teunis · · Score: 1

    I've been waiting for access to multiprocessor/multicore systems for YEARS. Right now I'm writing this on a dual core laptop that I've had for two months - and is the first such system I've had in my life. (I've been programming since 1984 - however outside of some circa 1980-ish "big iron systems" in the early 90s I've had no access to that world.

    now I do and I'm starting to recode all the work I did in prep for this day.

    The cost has dropped. It can finally be tested by those of us operating on a shoestring budget with hand-me-down equipment.
    About time :)

  147. Not too hard .. *yet* by Sloppy · · Score: 1

    Will we really see progress in the next 10 years that matches the progress of the silicon?

    On just about everything I work on, I often come to a point where I see that something could be broken into multiple processes -- I wouldn't even have to dirty my hands with all the trickiness of multithreading, shared memory, etc.

    But the easiness (usually) only goes up to a point. I think programming for today's multi-core chips isn't all that hard. But when I hear about 80-core chips, I realize: no, I just don't see that many processes in the problem that I'm looking at. To really use that kind of hardware, most (though not all) problems are going to take some pretty serious work (at best) or maybe even a totally alien way of looking at them, and I probably will have to deal with nontrivial concurrency issues.

    There's a little bit of good news, though: many application programmers don't have to see the whole picture. Remember that your app is just one of the things that a user's desktop machine is running. If you can only use 20 of a machine's 80 cores, that's ok. The user would probably bitch anyway, if your 80-way game caused his PVR to transcode more slowly, his VoIP to stutter because it can't encrypt fast enough, and his Gentoo package compile to take longer. I think it's ok for the hardware to be a bit overkill compared to the individual applications. Yeah, maybe that doesn't apply to some of you guys, who are working in situations where a machine is dedicated to a single problem, but with personal computers, the programmer doesn't have to "use up" the whole box -- in fact, he probably shouldn't.

    --
    As copyright owner of this comment, I authorize everyone to defeat any technological measure which limits access to it.
  148. is Dual Core faster by AmericanInKiev · · Score: 1

    Even with multi-threaded apps, I find older single core (but fast) processors to be ~3x faster than my dual core AMD.

    I am writing n-threaded app now, the trade off appears to be stability - particularly the stability of 3rd-party libraries (.net).

    But the question is with image loading and processing. Some functions can be split, but the slowest functions are spatial filters(ie Gaussian blur), and these have overlapping datasets (though only in read mode). So it seems that the applications will become multithreaded when the libraries are smart enough to break down long functions into sub threads.

    The other solution - which is to divide threads at the higher level would seem to quickly hit the serialization horizon.

    AIK

  149. Re: do you "get" recursion as well as you think? by Anonymous Coward · · Score: 0

    Programmers tell me all the time that they find recursion difficult - difficult to write, difficult to trace, difficult to understand, difficult to debug. Conversely, I find it easier - all I have to do is reduce the problem to its simplest form and determine the end case, and a tiny snip of code will do where a huge mess of iterative code would otherwise have been required. So, I don't understand why anyone would want to write iterative code when recursion can solve the problem.
    I won't disagree that recursion can give very elegant solutions, but this kind of statement implies a bit of naivety on the part of the parent poster. One could transpose iteration and recursion in the quoted paragraph and make the exact opposite case, since iteration and space-bounded recursion are not as different as you'd like to believe.

    Simple fact: Any recursion that works in O(1) space can be reimplemented as a loop. That's actually how O(1) recursion works: the compiler emits an unconditional jump to the start of the "loop". Yes, I will grant that there is some benefit to being able to chain together a sequence of mutually tail-recursive functions: foo -> bar -> baz -> foo -> ... -> foo, but surprise surprise such cases actually difficult to debug [someone else's code] because the calling stack frames are lost.

    The other reason people don't like recursion is simple: stack overflows. The C language, for example, does not guarantee O(1) tail recursion even though good compilers like gcc will recognize it and implement it as such. You'll be wishing you had used iteration when you find out 6 months after the fact that the compiler failed to recognize space-bounded recursion and your app crashed on a customer system.

    So either the parent is writing proper tail recursion recursion and assuming the compiler will actually emit an O(1) jump, or he is writing non-tail-recursion and just assuming that it won't smash the stack. In either case, I submit that the parent probably doesn't understand recursion as well as he thinks he does.

    There's a time for iteration and a time for recursion. Understanding and embracing both will help you write better code in each paradigm.

    p.s. Quicksort is a recursive algorithm with linear fan-out (logarithmic depth), right? Well go look at the source for your library's implementation of quicksort in C. Now try to understand why the iterative library code outperforms anything you could possibly write using recursion.
  150. Nothing is written to more than once by tepples · · Score: 1

    That is, how do you prevent a sequence of events:
    1. p1 reads C
    2. p2 reads C
    3. p1 writes to C
    4. p2 writes to C - p1's change just got clobbered
    Solution: Nothing is ever written to more than once. Here, p1 and p2 run in parallel, reading C1 and writing to C2, and another process p3 that has been blocking on both p1 and p2 reads C1 and C2 and writes C3. See also Static single assignment form.
    1. Re:Nothing is written to more than once by apoc06 · · Score: 1

      it isnt just the write. often times in parallel applications it also matters during the read.

      1. p1 reads c1
      2. p2 reads c1
      3. p1 writes to c2
      4. p2 performs function x(c1) = d

      in theory p3 [which has dependencies on p1 and p2] has to wait for p1 and p2s output before writing c3, but in this case p2 could be performing function x() and may need c1 or c2 as a proper argument to produce a valid d.

      this happens in the db world, or better yet an atm where c1 would have to be locked during #1.

      --

      either way, parallel programming will catchup and become much more simpler. some systems have required parallel programming for a long time, but most CS curriculums only mildly touch on the subject. now that multicore/ multi processors PCs are more mainstream and wildly available for your average user to hack around on, you will see new paradigms emerge and eventually see courses tailored towards it. of course its hard to program parallel apps when only 2% of your formal education concerns it.

  151. pffft, it is easy by Mathness · · Score: 1

    Parallel programming is very easy to do, when you know the trick to it, do the parallel programming in a parallel universe.

    --
    Carbon based humanoid in training.
  152. Increase utilization of cores per user? by tepples · · Score: 1

    That said, what the CPU and OS manufacturers have been doing lately does a pretty damn good job of parallelizing things as they stand. You take any heavily loaded multi-proc server, whether it's handling databases, files, web-sites etc. and the CPU utilization is surprisingly well balanced But can this encouraging result be extended to a workstation, which will come to have far fewer simultaneous users than cores?
    1. Re:Increase utilization of cores per user? by itwerx · · Score: 1

      far fewer simultaneous users than cores

      The question isn't the number of users so much as the number of processes and every workstation has at the very least the OS and a few applications running most of the time. E.g. I'm typing this on a dual-core machine which is currently running web browser, email, word processor, file browser, terminal sessions and several background file-transfer tasks. I pull up the CPU utilization though and it's pretty well distributed.

    2. Re:Increase utilization of cores per user? by tepples · · Score: 1

      The question isn't the number of users so much as the number of processes and every workstation has at the very least the OS and a few applications running most of the time. Are they running or blocking? A PC can have a whole bunch of apps minimized, and when these apps are minimized, they are blocking, not running.

      E.g. I'm typing this on a dual-core machine which is currently running web browser Blocking on network I/O and typing.

      email Blocking on network I/O and typing.

      word processor Blocking on typing.

      file browser Blocking on disk I/O and typing.

      terminal sessions Blocking on network I/O (if remote) and typing.

      and several background file-transfer tasks. Blocking on disk I/O and network I/O.

      I pull up the CPU utilization though and it's pretty well distributed. But is the total CPU utilization among cores regularly greater than 100%? Of course it's easy to put applications with which the user is not interacting on separate cores, but is it easy to put a single focused application on multiple cores? For instance, is parsing and laying out a single HTML document easily parallelized?
    3. Re:Increase utilization of cores per user? by itwerx · · Score: 1

      apps are minimized, they are blocking, not running
      That would be a pretty poorly written app! :)

      Blocking...blocking...blocking...blocking
      None of these should be truly be "blocking". Unless you're using the term to mean something else...?

      But is the total CPU utilization among cores regularly greater than 100%?
      By definition, no. :) But I understand what you mean, and if I'm doing something compute intensive like a compile yes, one CPU will usually be totally maxed and the other will usually be at about 75%-100% depending on what all else I'm trying to do at the same time.

      is parsing and laying out a single HTML document easily parallelized?
      Within a single application, no, of course not, that's what this whole discussion is about. But overall, across applications, yes indeed! My web browser can be loading pages on one monitor (I have multiple screens) while I'm typing away in the word processor on another, and if I look at the CPU affinity for these apps there's a 50-50 chance they will be on different cores. (Obviously if they are on the same core then it's just task switching and they're not really running in parallel.)
            Now if you want to nit-pick and say they are still not truly in parallel because the video updates to the screen(s) come down a single bus and they have to take turns well then that's true, and is also true of a ton of other IO functions, but it's also not really related to the parallel processing question. (Be nice if there was a solution for that though!)

  153. That's a Cell by tepples · · Score: 1

    For instance why does c have to be addressable to p0 p1 p2 p3 p4 p5 p6 p7 ? if p0 is working on c why does p1 need to be able to reach it ? Why not isolate each core and push c to an addressable cache strictly for the core interconnect ? Wouldn't this make for an easier way of parellel programming ? That's called a Cell processor, and game engine developers on the PLAYSTATION 3 platform say the Cell is a bitch and a half to utilize properly.
  154. Not a Fundamental Limit by bratwiz · · Score: 1


    I don't think this is too hard for humans-- humans manage parallel processing all the time-- albeit in other guises commonly referred to as "multitasking". Managers, for example, process in parallel frequently when they sit down and assign tasks to various staff members who then go away and get them done and come back for more assignments. Sometimes the assignments are standalone, and sometimes they involve interdependencies with tasks assigned to other staff members, and sometimes tasks are handed-out without truly understanding what sort of dependencies or interactions will be required and just assume that either the individual staff members can get together to figure it out, or else they can do as much as possible and then return for a full staff meeting/briefing to assess the status and determine what tasks are still left to perform.

    In a similar fashion, people parallel process all the time. They have their email open in one window, an IM client in another, have Slashdot open in yet another window, and are busy typing in a word processor / spreadsheet / vi / whatever in yet another. While it is true that most folks must multi-task in the more traditional manner (ie. task switch, so perhaps not true parallel in the strictest form), some people have secretaries or assistants they can off-load task functions to (reading/responding to emails for example) which would fit the definition.

    Yet other people perform parallel processing on the weekends. There are things to do at home-- chores for example, so the occupants get together and divy up the tasks and one person mows the lawn, another one vaccums the carpet, another goes to the store and gets groceries and another takes out the trash. Collectively, concurrently, all of the tasks get accomplished. Whenever interaction is required, either due to interdependencies-- ie. needing to go to the gas station to buy gas for the mower-- and hitching a ride with the person going to the grocery store.

    Or when manufacturing a product. Thing A happens while thing B happens but thing C has to wait until A and B are ready.

    There are countless examples of concurrent and parallel processing in the real world, and even in IT on a regular basis. Most loosely (or unrelated) tasks even on a uni-processing, multi-tasking system are for most intents and purposes parallel. The real problems creep in when considering how to implement low-level details such as interlocking processes, interdependent processes, process notification, task granularity and dispatching, and other similar concepts. I think much of the problem comes about in the fact that people "naturally" parallel process things from a higher-level abstract point-of-view, but rarely have to deal with the detailed subtleties that arise when having to figure out the whys and hows. However, in the real world (TM) there are Project Managers and Planners who work out these details. They are the "programmers" of these processes. They determine how collisions or other interactions will be handled if/when they arise. Sometimes (in fact, probably most of the time) in the real world these details just sort of "happen" without much overt planning. Instead little "scripts" that people know take care of these details. Such as-- "Oops, I'm out of gas. Since you're going to the store, can you drive me by the gas station on the way?" or "I'm stuck on my project and can't continue until George gets his part done." And other such examples.

    In my view the real way to win at parallel processing is to make processors plentiful and ubiquitous. Instead of having a system with just one or two processors, have a system with 10,000 or 100,000 or even a million processors. Just hanging around waiting to be tasked. Each a little tiny "computer system" unto itself, and yet attached to a larger system with common peripherals, communication pathways, and the like. Then to have one (or perhaps a group of) executive processors who interact with the user (or the user's executive "processor agent") to get its marching orders and t

  155. Buzzword soup... by cant_get_a_good_nick · · Score: 1

    "We do now face the challenge of figuring out how to move, I'll say, the whole programming ecosystem of personal computing up to a new level where they can reliably construct large-scale applications that are distributed, highly concurrent, and able to utilize all this computing power," Hmm:
    • reliably
    • large-scale
    • distributed
    • highly concurrent


    Pick any one...
    1. Re:Buzzword soup... by DaveV1.0 · · Score: 1

      It is that kind of thinking that makes the phrase "software engineering" an oxymoron. There is are reasons software can not be reliable, large-scale, distributed, and highly concurrent: laziness and incompetence.

      --
      There is no "-1 offended" or "-1 you don't agree with me" mod options for a reason.
  156. c# by Anonymous Coward · · Score: 0

    Some of the things being done in C# I think will perhaps partially address this problem.

    Anders Hejlsberg often talked about parallelism, specifically with constructs such as the new LinQ add-ons. He's talked about multi-threading and parallelism being handled more by the compiler.

    He rightly describes the problem as simply being an abstract one: specificaly, when you might write a simple "for" loop - you're essentially giving the compiler very detailed instractions on what you wish to have your program do and how you want it to accomplish it, however, if you use a "foreach" loop, all of a sudden, you're telling the compiler WHAT you want to do, as opposed to HOW you want to do it.

    This kind of thinking gives the compiler more freedome to make parallel desicions.

  157. Are Universities Producing Competent Programmers? by jkro · · Score: 1

    I think this is a more appropriate question.

  158. There is not an overriding need... by Lodragandraoidh · · Score: 1

    The need for parallel applications is overblown, particularly when modern OSs can manage single threaded applications across multiple CPUs and you can use interprocess communication to communicate between parent and child processes. For the uninitiated, a parent application forks (creates a copy of itself) child processes (which themselves can fork child processes - ad infinitum) all of which can run on seperate CPUs and communication with each other. Modern OSes manage the distribution of processes across multiple CPUs.

    This is a model that has been around a long time, is easy to program, and just works. Whatever efficiency is lost in interprocess communication between single threaded applications is made up for in dealing with mutex issues in parallel programs. (From Wikipedia) "The programmer needs to be careful to avoid race conditions, and other non-intuitive behaviors. In order for data to be correctly manipulated, threads will often need to rendezvous in time in order to process the data in the correct order. Threads may also require atomic operations (often implemented using semaphores) in order to prevent common data from being simultaneously modified, or read while in the process of being modified. Careless use of such primitives can lead to deadlocks."

    I don't see the benefit of doing concurrent programming in all cases, and see many problems that increase the complexity beyond what is reasonable to manage from a QA standpoint in most (in most applications data must be atomically modified - obviating the need to multithread, since all other threads will be busy-waiting for the data to be freed up anyway before they can work on it).

    For computational research, I could see the usefulness of multithreading inside of an application. For practical applications it is too complicated, and the cost of time spent building and debugging a multithreaded system does not balance out against the return on the investment. Computer systems are complex enough as it is; lets work smart and not latch onto the latest buzz word/tool at the expense of all others. It might be cheaper to wait 6 months, and the percieved bottleneck may have been cleared up by the application of new hardware anyway (Beowulf cluster, or faster/more capable processors etc).

    I view parallel programming much as I do assembly language: it is a tool that is useful for a specific problem domain - but I wouldn't want to do all of my programming in it.

    --

    Lodragan Draoidh
    The more you explain it, the more I don't understand it. - Mark Twain
  159. Two minds are better....? by canagape · · Score: 1

    Unlike you poor people out there, I have two brains, so parallel programming comes quite naturally to me -- at least on dual-cores....

    It's a nice little advantage, but deadlocks can be quite painful.

  160. VHDL by TheBean · · Score: 1

    VHDL and Verilog are perhaps the most widespread
    parallel programming languages in use today.

        Admittedly, hardware design is, by nature, more
    static than most software designs. Nonetheless,
    hardware designers seem to have relatively little
    difficulty programming "in parallel".

        Or perhaps they are just smarter .. ;)

  161. Never Happen by hardgeus · · Score: 1

    The gigantic paradigm shift to parallel programming ain't going to happen for the programming "public at large". Most programmers are high level script programming dudes who don't even understand pointers, the stack, the heap, or the concept of "type". You think they're all of a sudden going to become code-ninjas who understand massively parallel programming? How is some guy who doesn't even understand what a memory address is going to deal with this sort of thing?

    The only way this problem is going to be solved by software (if at all) will be at the compiler, OS, and tool level. Joe-script-dude isn't going to get any better.

  162. Threaded Prog Made Easy -Intel Threading Tools... by Glasswire · · Score: 1

    ...check out these tools

  163. Human attention span by tepples · · Score: 1

    Blocking...blocking...blocking...blocking None of these should be truly be "blocking". Unless you're using the term to mean something else...? Blocking means a process is stopped while waiting for an input or output operation to complete. A well-designed app takes less than 1% CPU during this time, except for incidental animations such as a blinking insertion point.

    But is the total CPU utilization among cores regularly greater than 100%? By definition, no. :) If one core of a quad-core system is 75% running, one is 50% running, and the other two are 30% running, some operating systems will report total CPU load as 185%. This is distinct from the average CPU load, which is 46%.

    But overall, across applications, yes indeed! My web browser can be loading pages on one monitor (I have multiple screens) Most home and office computers do not have multiple screens. Entry-level users think 2 "TVs" are for 2 computers, and of course there should be 2 cores.

    while I'm typing away in the word processor on another Many computer users aren't that good at multitasking. Sure, if you have a lot of CPU-bound apps running at once, there's an advantage to a 2-core CPU, but beyond that, the human attention span is a limit on how much parallelism a workstation can handle.
    1. Re:Human attention span by itwerx · · Score: 1

      human attention span...has nothing to do with parallel programming. How the heck did we get on that topic?!? :)

    2. Re:Human attention span by tepples · · Score: 1

      human attention span ...has nothing to do with parallel programming. How the heck did we get on that topic?!? :) With single-thread tasks on a computer with more than two cores and only one user, the user's attention span becomes the bottleneck. In order to exploit more cores than one for the task interacting with the user and one for background tasks, the foreground task needs to be split into processes or threads.
    3. Re:Human attention span by itwerx · · Score: 1

      With single-thread tasks on a computer with more than two cores and only one user, the user's attention span becomes the bottleneck.

      While that is certainly quite be true for specific cases applying it as a general rule is ridiculous.
            (And it's STILL irrelevant to the topic at hand... :)

  164. Games and multimedia, spread sheets... by stonewolf · · Score: 1

    Take a look at the XB0360 and the PS3. Both of these combine several multipurpose cores with a huge number of special purpose SIMD cores used just for graphics. (A typical modern GPU is a large collection of SIMD cores.) So there you have a huge market for multithreaded consumer-level applications.

    In business there are people who would be very happy to see a multithreaded spread sheet program. Anyone who works with database extracts in a spread sheet would love that. So, there is at least one business app.

    Stonewolf

  165. But the whole world runs in parallel! by Anonymous Coward · · Score: 0

    How can our brains not be wired to think about parallel processes? Everything around us in running in parallel. Physical objects don't sit in stasis taking turns moving. Surely our brains can handle this.

    What we need is a programming language that works the way the world does. For starters, objects don't modify each others' internal states. But they might send messages to each other.

    So if you want a parallel langugage that works the way your brain works, try Erlang. It works just like that, and Erlang programmers are universally of the opinion that multicore/distributed processing isn't hard at all.

  166. It's hard, too... by Anonymous Coward · · Score: 0

    The context shifts between languages can get really confusing, though. Especially if you speak more than two languages and for everything you hear, you have to first identify the language (by which point, you're struggling to catch up with what was just said).

  167. Yes, and it should remain difficult by pestilence669 · · Score: 1

    This is a problem for such a small niche of coder... to pretend that it will affect everyone is just scare-mongering. It's difficult and it should remain that way. This isn't some defect in the language(s), but in the very problems themselves.

    Parallel coding requires discipline. If you don't want to spend the time to do it properly, then don't write parallel code. This isn't a very big deal. The fat, bloated, and lazy scripters (I write some PHP & Ruby myself) will find parallelism in concurrent execution of the same sequential script(s). The guy who writes the webserver? He'll be writing actual parallel code. This is the way it is now.

    Video game code? Ever more complex APIs are being introduced to shield coders from actual coding. I anticipate next gen consoles will provide their own complete game engine implementations. No problems there. Database (form) applications? No need to go parallel unless you're insane. Spreadsheets?... maybe if you're the one writing the actual spreadsheet software (Excel, OpenOffice, Lotus). Parallelizing formulas is just stupid.

    The majority of applications run just fine sequentially. I once worked for a place that threaded everything. It was a mess. We had simple U.I.'s under serious lock contention, and sometimes deadlock, for tasks that would normally complete in milliseconds. Their love of threading creating a soiled heap of horrid code that ran so erratically, I quit. They applied it incorrectly and without discipline.

    Only serious low-level or networking coders need to worry about such things. If your computation is so starved that it needs to run on multiple cores, then you could probably benefit from vectorization and assembler tweaks. Once you're in that realm, complexity is nothing new. If you're parallelizing fat code, then you're just being wasteful, perhaps unnecessarily.

    Your average corporate drone writing accounting software, or form-based UI front ends to databases, or reporting, ... will never ever need to worry about parallelism. Most coders will never need to worry about it, so I suggest everyone stop worrying about it. Everyone that needs to go parallel already knows it.

  168. Learning? by CMF+Risk · · Score: 1

    Lots of comments have been about the validity and/or the ease, or not, of parallel programming - but I think everyone can agree that there just isn't enough education on the topic - for or against it.

    Does anyone have any good books, sites, tutorials, or classes to recommend on parallel programming (or writing parallel algorithms I should say, since most people seem to agree that programming them is the easy part. Or yes, I would even take good material on threading.).

  169. How do we educate developers? by tepples · · Score: 1

    The problem there isn't parallelism at all. The problem there is a novice's view of threading. In other words, the problem is in education. So how do we solve this?

    Are you open to the possibility that there are other such things you have yet to learn, particularly in the area of parallelism? Are you open to the possibility that there are other such things that instructors at too many universities have yet to learn?
  170. BINGO! by Anonymous Coward · · Score: 1, Funny

    "There has been a lot of talk recently about the need for programmers to shift paradigms and begin building more parallel applications and systems. The need to do this and the hardware and systems to support it have been around for a while, but we haven't seen a lot of progress. The article says that gaming systems have made progress, but MMOGs are typically years late and I'll bet part of the problem is trying to be more parallel/distributed. Since this discussion has been going on for over three decades with little progress in terms of widespread change, one has to ask: is parallel programming just too difficult for most programmers? Are the tools inadequate or perhaps is it that it is very difficult to think about parallel systems? Maybe it is a fundamental human limit. Will we really see progress in the next 10 years that matches the progress of the silicon?"

    BULLSHIT!

    Anyone remembers the bullshit bingo game? :)

  171. Apply a limited threading paradigm to processes by NNland · · Score: 2, Interesting

    Having written MPI and Linda work-alike libraries, developed parallel and distributed systems, and being a heavy user of threads and remote procedure calls (via xml-rpc), I will say that the general issue that all of these different systems try to handle is one of API. How does one have data X handled by function Y in thread/process Z. In the realm of threading, we use queues with locks. MPI/PVM/Linda/XML-RPC all use sockets to pass data between processes, and all but Linda requires that you specify the destination process explicitly.

    One interesting recent development is the processing package for Python: http://www.python.org/pypi/processing/ . The idea is that you create processes like you would threads, then use shared queues, key-value mappings, etc., to pass data between the processes like you would threads. By sticking with generalizations that are seen to be 'easy' to understand and use (primarily queues), they bypass the majority of the difficulty people have when using threads and processes. Of course it doesn't hurt that the data transfer is pretty fast.

    The only limiting factors with the particular implementation is that it relies on fork in *nix, and the transfer of code as data in Windows (which isn't generally possible for all languages, especially with the NX processor extension). If Windows had a usable fork, and if there was a 'fork across machines' (think mosix), many of these discussions would result in "just program it like you had a thread and use shared queues and the processing package for your language".

  172. Functional programmers: lazy/stupid by Anonymous Coward · · Score: 1, Insightful

    Multi-core designs do not change the fact that processors will always execute the vast majority of their instructions sequentially. Even a 1000 core machine would still be executing more instructions in serial than in parallel. If each core ran at 1Hz they would still be executing 1000 instructions per second in parallel but each of those is also part of a sequence in each core so it is executing >1000 in serial depending on how deeply pipelined the cores are! The extreme of parallelism is a neural network but neurons do not execute instructions: if you want each time-step of the processor to have a well defined meaning (so that it could justifiably be called an instruction execution) then it needs a context - it needs to be part of a sequence.

    On a more general note I don't know why people have taken to evangelising functional programming for this discussion. Functional languages are particularly not the solution for parallel programming. People are too dumb or lazy to write explicitly parallel code and think if they write everything in a functional language the compiler will handle that messy business for them. Wrong! As soon as you get to something moderately complex like matrix multiplication functional languages will fail to find a good strategy. There is no way in hell a compiler can figure out an optimal way to parallelise matrix multiplication for an arbitrary architecture because the optimal matrix blocking and memory access patterns depend on the processors cache design. The ATLAS project achieves this to some extent but it is a highly specialised 'compiler' if you can call it that, and needs to know the cpu type and cache sizes/organisation to work optimally.

  173. Re: The hard thing is the synchronisation by KDR_11k · · Score: 1

    They don't just set it, they read, modify, THEN set it. E.g. two threads, one counts mouseclicks and the other counts keypresses and both add their numbers to the same counter. You could add one counter for each thread but now say we have threads that are spawned at a specific interrupt, calculate for a while and then write their result somewhere. How do you fit that into a formula?

    --
    Justice is the sheep getting arrested while an impartial judge declares the vote void.
  174. Where's BEOWOLF?? by lugannerd · · Score: 1

    // processing - Where is the Cluster Joke????

  175. Parallel Programming by AmberBlackCat · · Score: 1

    I think this problem is a good example of why companies should take a Computer Science degree seriously instead of assuming a three-hour programming class will make an employee capable of doing what's best for the company.

  176. Multicore Development Platform - RapidMind by techpragmatist · · Score: 1

    As many comments suggest, there are those for whom parallel programming isn't hard, but that is a small minority of the programmers in the world. Most of the code is use today was not written by those elite few. Unless we want to limit the continuation of Moore's Law to only applications written by those few programmers we need a better way. RapidMind has created a development platform that simplifies development of parallel applications for vector and multicore processors. Using RapidMind, the programmer masses can develop parallel applications using their existing skills, compilers and IDE's. The RapidMind runtime platform takes care of the parallelization and load balancing across any number of available cores. In addition, code written using the RapidMind platform will run unchanged on NVIDIA and ATI GPGPUs, IBM Cell BE and Multicore Intel and AMD processors. Even the elite few that can parallel program would have to port and refactor to support multiple or future processor architectures. Just as higher level programming languages like Visual Basic and now Ruby have enabled laymen to be productive programmers, a similar level of abstraction will be needed in the parallel world just to keep existing programmers productive. Check it out, it is free to download and try @ www.rapidmind.net

  177. Too much legacy by ozzee · · Score: 1

    To really provide parallel programming support, you want to have more asynchronous services. Unfortunately, none of the operating systems provide a very good interface for asynchronous services, they're incomplete and littered with limitations.

    Some of these problems can be mitigated by libraries but you're still stuck much of the time and there are very few cross platform asynchronous libraries.

    There are some very simple multi threaded programming models that I have used. The issue is that there is an inevitable learning curve. Most developers have no idea what a state machine is. Inevitably, you end up making state machines to handle much of the complexity of things happening in different order.

    Then, what for ? Most of the written can't benefit (even if they tried) from parallelization. High performance code, like servers, graphics intensive applications, video editing applications to name a few, might have some benefits, however, that's a small chunk of the code written today.

    1. Re:Too much legacy by MikeBabcock · · Score: 1

      There are a lot of easy ways to benefit from parallel programming. Think of something as simple as "find / -print0 | afio -o | nice gzip -7 > backup.afio.gz". Building up a list of files on the filesystem need not slow down the process of reading each file to back it up, nor should the compression delay the prior processes, except in terms of buffer space.

      A webcam chat application should be handling retrieving data from your webcam, receiving data from the network, codecs and sending data to the network in separate threads so as to avoid processing delays using simple semaphores and buffers.

      There are a lot of applications that handle things linearly that really don't have to be that linear -- or could work as assembly lines with buffer space (FIFOs) in between.

      --
      - Michael T. Babcock (Yes, I blog)
  178. There are just usually better ways of doing things by pseudorand · · Score: 1

    I took a parallel programming class recently. We took an algorithm and made three performance improvements to it. Two involved parallelization (one on a shared-memory machine (OpenMP), the other on a cluster (MPI)), and the third involved reordering some stuff to take advantage of the CPU's L2 cache. The non-parallel solution provided by far the best performance improvement, even though our parallel machine had 32 CPUs. This is, of course, very specific to the algorithm, but the point is that there are often better AND less error-prone ways of improving performance than parallelization. These techniques are also often viable even for algorithms that aren't parallelizable.

    It seems that someone needs to do some sort of massive code review study to figure out what our computers do most and what types of performance improvement techniques would probably be most beneficial before making any broad statements on the subject. That said it seems that increasing the number of cores in a system, especially a desktop system, is limited by cost, technology, and physical space on the chip. Even if we had 32-core desktops, that's still only a 32 fold improvement. Since we have to pay to retrain programmers either way, that cost cancels out. Doesn't it seem like training in other algorithmic approaches may have more potential for quicker improvements than buying our way out of the performance problem with...

    Wait a minute, what performance problem? My desktop does all kinds of fancy things I don't need it to do and its single-core CPU is still usually idle. And as for server apps, isn't your database, web server, etc. already multi-threaded? What, exactly, is all this CPU-bound code that's supposedly running out there? I would have though that network and disk speed is by far a greater bottleneck to the majority of things computers do these days. Why not just scrap the CPU crap, write sloppy code, and retrain a bunch of programmers as EE's to do I/O research.

  179. "Extreme Concurrency" & Erlang - presentation by toby · · Score: 1

    Tom Leonard, a programmer from Valve, gave a fascinating talk about this

    Game developers are getting excited about technology like Erlang. A link to Extreme Concurrency and Erlang, an entertaining presentation by André Pang, was posted to the erlang-questions list by Miguel Rodríguez Rubinos on 12 April.

    --
    you had me at #!
  180. Verilog is ALL parallel programming! by RKBA · · Score: 1

    Nonsense. Verilog is a very popular programming language for small projects, and within a Verilog program, EVERYTHING happens all in parallel unless you specifically structure your Verilog program to execute groups of instructions serially with a state machine of some kind (and doing this explicitly with a CASE statement or other construct is usually necessary, except for purely combinatorial functions). Verilog programming is on par with assembly language as far as difficulty of learning the language, and many of the operators, etc., use C language syntax. As FPGA's become larger, more popular, and easily reconfigurable "on-the-fly", expect more employers to start looking for people who know a Hardware Description Language (HDL) like Verilog, VHDL, etc. Verilog can also be used to design VLSI ASIC's.

    1. Re:Verilog is ALL parallel programming! by dyumnin · · Score: 1

      Verilog for small projects?
      Most of the verilog projects I have been involved in consisted of a team of 50+ people working across countries for a duration of more than a year.
      i.e. an average HDL project requires investment of more than 50 man years.

  181. Programmer vs "Real Programmer" by bill_kress · · Score: 1

    Most "Programmers" don't really understand their system. The typical level of understanding goes from memorizing single lines of code that fit in certain places and cutting/pasting groups of lines to a more advanced ability to understand the piece you are working on, refactor, significant design of clearly defined parts of a system and some level of planning and debugging skills.

    nearly all programmers fall into that range somewhere, and most teams consist exclusively of these programmers.

    The things that are outside that range are accurate up-front design, accurate up-front planning, good fully-factored object-model design and comprehension across a large system and more advanced topics like threading. It's my opinion that you are no more likely to hit this level simply because you program than you are to become a rockstar simply because you have a garage band. In fact, I'm fairly sure it's an innate talent that you can't improve much. If I set out to learn to paint and become an artist, I can't assume that I can challenge the great artists simply because I want it and I study a lot.

    For difficult programming tasks you absolutely need the ability to manipulate the entire job (Object model, gui, ...) in your head. You need complete understanding of the entire model, then you need to twirl it around and reshape it, add to it and refactor it and you need to notice voids and inconsistencies while doing so.

    In 20 years I've met very few people with this ability--one or two, and a quite a few who more are pretty close.

    Yeah, threading is hard, so is writing a #1 hit. Hard stuff is the most rewarding and fun. Who wants to play the Aramada Room at the Holiday Inn for the rest of their lives IF they have the ability to do more?

    The really funny part I've noticed is that until you have passed a certain stage as a programmer you have minimal ability to understand the levels above you--so nearly all programmers think they are at or near the top. As they learn more they start to recognize the levels they have passed through, but rarely recognize those they have not seen in action.

  182. It's easy to parallelize existing Matlab code! by Grammar+Gorilla · · Score: 1

    Try this: http://www.cs.wlu.edu/~levy/software/pecon/ I wrote it and have run it on Linux and Mac OS X. It's a free, bare-bones alternative to something that Mathworks sells for a lot more money: http://www.mathworks.com/products/distriben/ Of course, if you want *real* high-performance, you won't run Matlab, but lots of people have tons of Matlab code and many idle processors, like the original poster.

  183. Time-to-market issue by anars · · Score: 2, Informative

    Pardon me if this point has already been made.

    What's the most important thing in high-performance computing nowadays; is it super-optimized low-level parallel programming or is it just plain parallel programming? I'm talking about any high-level framework which allows for easy multi-threading in applications which need it. A framework that will not only heighten developer productivity, but also utilize the additional cores in a computer system with a minimal effort. Wouldn't that be better than not doing it at all? The C-omega language http://research.microsoft.com/Comega/ by Microsoft Research Labs does exactly this.

    I have to agree, though, that the problem here is us - the programmers. The implementation of the language can only as smart as it is, and potential side-effects in terms of data dependencies etc. will definately occour. I'm not aware of any languages which implement a degree of Data Flow Analysis http://en.wikipedia.org/wiki/Data_flow_analysis, which allows the compiler to alert of such "stupidities" propagated by us--or perhaps even optimize them for the better.

    As several of you pointed out, matrix calculations can easily be distributed onto n number of cores, computers, or whatnot without any problems. I can't mention any real-life application where fast matrix calculations could save lives, but hey..

  184. Optimisation is Hard by dpuu · · Score: 1

    I'd say the problem is that premature optimization leads people to overly complex, and therefore hard, solutions. If you're willing to live with a pure message passing system (i.e. something equivalent to Unix processes, not threads) then most of the problems associated with parallel programming a vastsly diminished (spaghetti coding may still lead to deadlocks and livelocks; but a little disciple will avoid that, most of the time -- it's not "hard").

    If this pure message passing system can take advantage of an extra core or two, then maybe you can live with its inefficiency. To assume otherwise is a premature optimization. Once you identify that optimization is actually necessary then you have two options: optimize it into a single threaded program (yes, sequentialization is an optimization) or else start sharing memory and adding locks, etc.

    Most problems are moderately parallelization; so you should train yourself to code them in that way. Then you don't need to rearchitect to take advantage of the extra hardware resources.

    --
    Opinions my own, statements of fact may contain errors
  185. DS isn't really SMP by tepples · · Score: 1

    € I apologize for being unfamiliar with the market in Ireland and mainland Europe.

    Or 40€ for a game for the DS (which I think has two processors) compared to the 60€ for the Wii. Two issues here:
    1. DS uses models with fewer vertices than Wii. Smaller models take less time and still look passable on a 256x192 screen. Yes, I admit that the Wii also uses smaller models than the multicore systems.
    2. DS multiprocessing is not symmetric. Licensed DS programmers don't write programs for the second CPU. Nintendo provides the program that runs on the second CPU, which handles nothing but power management, audio, and networking.
  186. The bottom line is $$$ by tepples · · Score: 1

    (And it's STILL irrelevant to the topic at hand... :) "Too hard" is a business decision. Any endeavor where the effort does not justify the earnings is "too hard" on the bottom line. Therefore, if 2 threads (GUI and worker) are good enough for an app that spends the vast majority of its time in user interaction, then the company will find it uneconomic to pay programmers to make more threads.
    1. Re:The bottom line is $$$ by itwerx · · Score: 1

      Therefore, if 2 threads...for an app that spends the vast majority of its time in user interaction, then the company will find it uneconomic

      And again, that's a specific case, (or, rather, class of cases), which cannot be used as a broad-stroke brush in the big picture. The original submitter's question remains valid for a great deal of "back end" operations. To be fair though, your reference to the economics of such development being the sticking point still tends to hold true. (Though if a compiler/interpreter could be made smart enough those economic hurdles could quite easily vanish.)

  187. Vista can handle 15 threads? by Anonymous Coward · · Score: 0

    "Vista, he said, is designed to handle multiple threads, but not the 16 or more that chips will soon be able to handle. And the applications world is even further behind."

    I thought this quote from the article was rather funny. Vista is so advanced it can almost handle 16 threads!

    1. Re:Vista can handle 15 threads? by raygunz · · Score: 1

      I suspect he meant (or actually said and was misquoted) 16 *cores*, which is a much harder thing to deal with.

      --
      "Debugging" by Dave Agans - the perfect gift for your favorite imperfect engineer.
  188. Re:Careful with process algebra and process calcul by dr_pump95 · · Score: 1

    I've previously developed a language, execution semantics and implementation of the semantics that provides this. In my case, I was trying to build a language and execution engine that could be easily distributed. The result is a fully asynchronous, distributed, state machine. Works well but it is very much a research prototype. Interesting. Is the implementation available anywhere online? I'd be interested in playing with it. No, it was never polished or stable enough to let loose on the public. The PhD thesis is online, however, at http://whyanbeel.net/phd/phd.pdf. The execution semantics is formally specified in the thesis using axiomatic Z notation (sets, relations, functions).
  189. I believe it requires us to pop up a level by caywen · · Score: 1

    I think parallel programming as it pertains to multicore CPU architectures and multi-CPU architectures will always remain roughly similar to what we see today. Some problems can be highly parallelized and others will be harder. It will remain up to the brilliance of the engineers/scientists to do this work. There's no great language or tool breakthrough that will save us the work of understanding each case-by-case problem of how to make our programs optimal on parallel architectures. The future of parallelism isn't about how we can make what we currently do faster. It's about what new things become possible.

  190. Re:Careful with process algebra and process calcul by GileadGreene · · Score: 1

    The PhD thesis is online, however, at http://whyanbeel.net/phd/phd.pdf.
    Thanks! From a quick skim it looks quite interesting (although it'll obviously take me a while to digest the whole thing :-) The few examples of Finesse that I ran across are (to me) reminiscent of Wright - which I guess shouldn't be surprising, since I gather you spent some time with Garlan at CMU. It'll be interesting to see how those kind of ideas can be turned into an implementation instead of an analytical tool. Looking forward to working my way through your thesis.
  191. Re:Careful with process algebra and process calcul by dr_pump95 · · Score: 1

    Send me email to an address at the domain above. It should get to me. The email address on the thesis has died and gone to heaven, unfortunately.

  192. too hard? by aled · · Score: 1

    the simple answer is: YeNso

    --

    "I think this line is mostly filler"
    1. Re:too hard? by tedgyz · · Score: 1

      LOL! Too funny!

      --
      "No matter where you go, there you are." -- Buckaroo Banzai
  193. LabVIEW is CRAP by Anonymous Coward · · Score: 0

    LabVIEW as a programming "language" is certainly interesting, but I find it oversold -- too poorly implemented to actually be useful.

    Numerous fatal bugs (that only seem to show up in complex projects involving >100 VI's) have existed since version 8.0 onwards. These bugs can cause the loss/corruption of entire VI files and result in LabVIEW crashing.

    I also find its run-time performance leaves much to be desired. Try creating a simple "while" loop that increments a 32-bit integer until it reaches zero (due to overflow, resulting in ~4 billion iterations). In a C, this would be a simple 2-3 line program that would take 1-2 seconds to execute (depending on processor). Try the same thing in LabVIEW. It will take significantly longer (~10X). It doesn't matter whether or not you make this VI reentrant, execute as a "subroutine", or do any other LabVIEW-specific trick. It just runs slowly.

    Now this toy example involves no arrays, no memory allocation, etc etc..

    My theory right now is that *EVERY* single loop iteration and *EVERY* single damn VI is dynamically scheduled -- even if it is just a simple add in a single VI program that does nothing else. In a complex application, I have seen this result in a C implementation of a simple routine to be 10-20X faster than my best LabVIEW implementation (and yes, I tried many ways).

    Based upon what I've seen in NI's Developer Zone, I can only concluded that the Test & Measurement (T&M)market doesn't care about most of the functionality that NI offers. It would seem that the T&M market doesn't care about generating dynamic (non-static) analog waveforms or real-time processing. It would seem the only goal is to transmit and receive a short analog waveform (few seconds at most) and then perhaps spend ~1 minute doing *offline* processing. In practice, (despite NI's advertised capabilities) doing anything else is almost infeasible in LabVIEW.

  194. Amen! by woolio · · Score: 1

    The parent makes many execellent points.

    At my university, I attended once of these rare "distinguished" lectures that usually involve really famous people. Some bigshot from Intel was describing how in the future everyone would have a 1 TeraFLOP computer in their homes... It would use advanced modeling/prediction algorithms to help the user. (Something similar to weather prediction, but for other tasks specific to the individual such as buying groceries, etc). Well, the lecture seemed like crap. (Doesn't he realize that most of the users are still struggling with basic day-to-day tasks and aren't going to spend the time or effort required to *configure* such a complex program, much less actually use it?)

    I believe that once the majority of the public gets used to having 2 or 4 cores in their desktop/laptop, Intel will be screwed. At that point, once core can handle the user's tasks and the other core can handle anti-virus and other background programs. The second nail in the coffin will probably be FLASH drives replacing hard-drives. I find that most of the perceived sluggishness of a computer is due to the hard-drive and not due to the processing speed. (e.g. try network-booting a Linux workstation and see what makes it appear slow). I've tried using laptop hard drives in desktops for a while now (to have a quieter computer). I'm starting to wonder if any "new" computer only seems fast because its harddrive is faster/performs better than the one in the "old" computer.

    As it is, I'm typing this on my 1-Ghz Pentium III laptop. It's not the fastest around, but it does what I need (web, email, writing papers, software development, occasional games) very well. Several years ago, I bought it used for $400 and can't *justify* to myself the need for a faster computer right now.

  195. Terracotta - a Clustered JVM by cybergoat · · Score: 1

    Terracotta (an open-source solution to clustering at the JVM level) approaches this problem by recognizing that multi-threaded programs can become multi-JVM programs. Here's a great article just posted on Dr. Dobbs -> http://www.ddj.com/dept/java/199703478 with more details and links about Terracotta.

    Disclaimer: I work for Terracotta.

  196. transputers were great by bobkoure · · Score: 1

    They had a great programming model, really nice scalability (the notion of each core being both a computation center for its own stuff plus a "pass it along" communications center for jobs/results that weren't for that particular core was not only elegant, but allowed additional cores to be added as needed.
    I was sad to see it go...

  197. Re:Parallel Programming is EASY (APL, J, K langaug by SagSaw · · Score: 1

    Add LabView to that list (although it's probably a bit more application specific).

    Any two chunks of code which do not depend on each other in some way can, and most likely will, execute in parallel. Most non-trivial programs I've seen tend to be designed so that multiple loops, each handling different aspects of the program, operate in parallel. For example, a program controlling a durability test stand might have a motion control loop which is designed to execute as quickly as possible, a data acquisition loop which reads data from a buffer every 100ms, and a user interface loop which is waiting for the user to hit a button, select a menu, etc. all running in parallel.

    --
    Come test your mettle in the world of Alter Aeon!
  198. Still applicable by apsmith · · Score: 1

    Amdahl's law still applies - look at Gustafson's graphs. The assumption is that the serial part stays constant while the parallel part grows with the number of processors (because you are handling a larger number of problems). Therefore the serial fraction shrinks, and the speedup available is larger. If you tried to run the large problem on a single CPU it really would take that much longer. But that's only in this sort of case where the serial fraction is independent of problem size. Seems like a pretty special case to me, but in any case, Amdahl's law is as valid as ever here.

    --

    Energy: time to change the picture.

  199. don't think threads -- there are alternatives by bugi · · Score: 1

    Don't think threads. The thread model is inherently non-deterministic, and when you program with them you spend most of your time fighting to make the result deterministic.

    There are other concurrency models without this problem. For a nice summary of some alternatives, see the "Alternatives to Threads" section of the article "The Problem with Threads" in the May 2006 issue of Computer.