Slashdot Mirror


Threads Considered Harmful

LBR9 writes "James Reinders compares native threads with the goto statement so famously denounced 40 years ago by Edsger Dijkstra. Paraphrasing Dijkstra, he says they both 'make a mess of a program,' and then argues in favor of a higher level of abstraction. A couple of people commenting on the post question whether or not we should be even be treading into the 'swamp of parallelism,' echoing the view recently espoused by Donald Knuth."

8 of 266 comments (clear)

  1. How about "C++ threads considered harmful"? by krog · · Score: 4, Insightful
  2. Not really news by AKAImBatman · · Score: 5, Insightful

    Threads have been considered a "bad idea" by the CompSci profession for a little while now. So there is definitely nothing new about the author's statements. That being said, there is a fundamental difference between Dijkstra's paper 40 years ago and this summary: Dijkstra started his paper by holding up examples of better practices. Only after establishing their existence did he go on to suggest that the GOTO keyword was "too primitive" to be of practical use in software development.

    The author of this "article" (and I use the term loosely) doesn't really present such options. He hand waves a few work-in-progress solutions at the end, compares threads to GOTO statements, then asks the readers to fill in the (rather sizable) blanks.

    Long story short, it's a good topic of discussion, but the comparison to Dijkstra's famous paper is just an advertising point. Nothing more, nothing less.

  3. Making a parrallel with Edsger Dijkstra's article? by Lazar+Dobrescu · · Score: 2, Insightful

    You know the big difference between TFA and Edsger Dijkstra's paper?

    The second one made an argument, showed alternatives that were at least summarili demonstrated to be better and used reasoning.

    The first one just says "Edsger Dijkstra's paper said goto was harmful and he ended up being right, thus if I say threads are harmful, I'm also right. Oh and here are some threading libraries I've found in a quick google search, they might be better."

  4. Re:processes by Nutria · · Score: 2, Insightful
    I'd love to see a web server spawn a separate process for every page access.

    Apache 1.x is not multi-threaded.

    --
    "I don't know, therefore Aliens" Wafflebox1
  5. Re:Slowaris caused threading by LizardKing · · Score: 3, Insightful

    Complete crap. Threads solve a number of programming problems much more elegantly than forked processes and sharing data through some IPC mechanisms. Anecdote time: a stock price system I worked on. The first generation used separate processes for a single writer and a large number of readers, with shared memory for interprocess communication. This was switched to a threaded implementation for the second generation, which was faster, even though it was using the old LinuxThreads implementation, and more easily maintained as the pthreads API is much richer than IPC ones.

  6. Re:processes by Metasquares · · Score: 2, Insightful

    That's what select() is for.

  7. That's not disagreeing with Dijkstra by Anonymous Coward · · Score: 4, Insightful

    I know nobody born in the last 30 years has bothered to read his memo, but he doesn't pretend gotos are "evil". Just that people should adopt structured control flow structures instead. Meaning, design and use languages with such advanced features as "if/else" statements, and "while" loops, and "functions". Goto considered harmful was written in a time when most people were not using the fancy new languages that offered these features, and he was suggesting that they do so, in order to improve the quality of their code.

    Unless you seriously think people should use gotos instead of loops and if/else statements, then you don't disagree with Dijkstra.

  8. Except ... by Pinky's+Brain · · Score: 2, Insightful

    Functional programming is hard, non intuitive and even plain distasteful to me. Now I know I'm an idiot, but the problem is most programmers are idiots. The language has to make parallelism easy for us, and if it starts out being functional it's already lost that battle.