Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Score: Perl 1, Ruby 0

by Anonymous Monk
on Feb 21, 2006 at 16:47 UTC ( [id://531735]=note: print w/replies, xml ) Need Help??


in reply to Score: Perl 1, Ruby 0

Writing applications to use threads (or concurrency of any stripe) is largely a waste of time unless you really need the performance gains.

Otherwise, the headaches just aren't worth it (TM). There isn't a formal model for debugging concurrent applications; multi-threaded and multi-process systems are a pain to debug, understand, and maintain.

I wouldn't damn a programming language on the basis of obscure features like threading; how about real world work instead?

Replies are listed 'Best First'.
Re^2: Score: Perl 1, Ruby 0
by BrowserUk (Patriarch) on Feb 21, 2006 at 20:32 UTC

    From my perspective, which goes back to before I ever used Perl or iThreads, almost the last reason for using threads/concurrancy is performance.

    The best reason is simplicity. It is just so much easier to code anything that takes a long time as a simple, linear subroutine, and then kick it off into a thread and let your main program get on with whatever else needs to be done.

    The alternatives, like finite state machines are hard to code, and totally unportable even to the same OS on a faster processor. You take your slow, linear subroutine and break it into iddy-biddy chunks, carefully sized so that each one only takes as much time as you have available between doing the other things that need to be done, (like interacting with the user).

    Move it to another, slower processor, (or just run another heavy process on the same machine), and your user interface is slow as molasses.

    Move it to a faster machine and you either refactor all your stateful chunks into fewer, bigger chunks, or you waste half your cycles 'task switching' before it is necessary.

    With threads, you write self contained, linear code, stick 'em in a thread and the scheduler takes care of everything else. The only time threads are a pain to debug is when people try to write them as a closed coupled state machine. Which is simply the wrong approach and easy to avoid.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

      Multitasking doesn't require threads, even on win32 AIUI (I appreciate it might not be as easy as on a real OS, but sucks to be you). Having another task in the same address space as you, but doing something unrelated is just a huge pain for no gain.

      --
      James Antill

        I wouldn't use threads to run unrelated tasks in the same process. It's when the tasks are related and need to share data bi/multi-directionally that threads come into their own.

        As for the gibes about "real OS", if you think that following the fad for white on black 24x80 screens, advisory locking and all the other artifacts from the 1970s makes you an uber-geek, you're welcome to them :)


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.
Re^2: Score: Perl 1, Ruby 0
by bitstream (Sexton) on Feb 21, 2006 at 19:38 UTC
    Threading is an obscure feature? What is this real world work you speak of? Or perhaps you do a different type of real world work than I. Undoubtedly so, threading is *important*. Meanwhile, I concur that Ruby is very cool ... and spiffy threading support may come. Heck, I'm still hoping for Ruby-on-Parrot :)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://531735]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (2)
As of 2024-04-25 20:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found