Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Can I expect to have ithreads available?

by BrentDax (Hermit)
on Oct 31, 2009 at 19:18 UTC ( #804304=perlquestion: print w/replies, xml ) Need Help??

BrentDax has asked for the wisdom of the Perl Monks concerning the following question:

I'm working on a Perl script that's part of a wider system which might be deployed to arbitrary "consumer" Unixes (Mac OS, Linux, maybe BSD, etc.). Can I generally expect the Perls on these sorts of platforms to support modern threading, or should I stick to more pedestrian things like fork()?

--Brent Royal-Gordon

  • Comment on Can I expect to have ithreads available?

Replies are listed 'Best First'.
Re: Can I expect to have ithreads available?
by Corion (Patriarch) on Oct 31, 2009 at 19:34 UTC

    I think most system perls are nowadays compiled with ithreads enabled. There is the forks module that emulates threads with fork() and Storable I believe. I'm not sure what you want to use threads for, so I cannot comment on the feasibility of using fork() instead.

      This is as part of the client for a file-syncing application, somewhat like Dropbox. (It's a university project.) It basically has three broad responsibilities—monitoring the filesystem, watching the server for remote changes, and uploading and downloading files. I'd like to split these into three communicating threads or processes.

      Using threads would allow me to pass full objects around through something like Thread::Queue, instead of having to serialize the data somehow onto a socket or pipe, so if that's a viable solution it strikes me as likely being better.

      --Brent Royal-Gordon

        My reading of the tea leaves says you're planning on rolling this app out onto a bunch of oddball departmental servers which are probably not under your direct control. If your school is anything like the university I worked at, that means some of those machines are crust old boxen that should just be shot and put out of their misery, but geology has to have that exact version of perl 4 to support their favorite app. Sigh.

        So, what happens if the threaded code doesn't work on every single machine? Is the project a failure or will your PHBs be happy with 95% coverage? Can you go install a private version of perl on the machine in question? Is that ancient server lurking in some obscure corner of the campus going to come back to haunt you?

        That said, sure, reasonably up to date versions of perl will typically be compiled with ithreads on the major platforms. Really, it's up to you to make the call, but those are the points I would consider.

Re: Can I expect to have ithreads available?
by tbone1 (Monsignor) on Nov 02, 2009 at 15:36 UTC
    I would suspect so. I haven't done this on EVERY available Unix variant or BSD/Linux release, but I've not encountered a problem yet. Also, keep in mind that OS X's Darwin is based on FreeBSD, so there are two birds with one stone.

    But it always pays to test, test, test. Some of us here have the scars to prove it.

    tbone1, YAPS (Yet Another Perl Schlub)
    And remember, if he succeeds, so what.
    - Chick McGee

Re: Can I expect to have ithreads available?
by fullermd (Priest) on Nov 03, 2009 at 02:31 UTC

    The ports for perl (5.8 and 5.10) on FreeBSD build with threading disabled by default.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://804304]
Approved by Corion
Front-paged by Burak
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (1)
As of 2022-01-25 18:12 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (67 votes). Check out past polls.