Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
No amount of syntax will give me SMP-multithreading in Perl

Do you mean perl 5.005 threads?

IIRC, the conclusion we got from there is that it is not doable without rewamping the runtime completely.

Perl internal data structures were never designed for atomic access so locks need to be used to serialize their access. You could do as Python, have a global lock (bye bye SMP!) or require the programmer to lock by hand (that was the 5.005 approach), but that didn't work. Most modules failed to work in multithreading environments, usually because of the perl internals becoming corrupted... XS code was even worse.

Perl 5.6 threads was a compromise where everything is cloned so that there is no interference between threads and whenever you want to share something, you have to say it explicitly and an intermediate (and quite inefficient) layer that does the locking and serializes access is set up by the runtime.

So, in conclusion, do you want SMP in Perl 5? then write a new runtime! and forget about compatibility with any XS module!!!

Would it be worth the trouble? IMO, well, maybe yes. There are so many things in Perl 5 that need fixing that could only be fixed by using a new runtime!!!

But anyway, who is gonna do it?

Update: oops, s/5\.6/5.005/g; s/5\.8/5.6/g;. I knew I had it wrong because I can still remember my excitment trying the threads support with LWP and getting SIGSEGVs all the time when perl 5.005 was released 22 years and two days ago! Just one of those things than randomly stick in your mind!


In reply to Re^12: Amicable divorce by salva
in thread Amicable divorce by ribasushi

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-04-24 08:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found