in reply to Re: Critical sections; In the Perl interpreter
in thread Critical sections; In the Perl interpreter
APerl is no different,
Actually, Perl's threads are very different from your description.
And, copy on write has almost zero benefit in perl scripts, because almost every access to every scalar (and every other internals data structure based upon them) is a write access. Either the reference count is incremented or decremented; or the status bits are changed; or a number is referenced in a string context and the SV field is written, or vice versa; or strings are encoded or decoded.
Each and every change, even the setting or clearing of a single bit (IV_OK etc.) causes the entire 4kb it is located in to be allocated to the new process and duplicated. CoW buys Perl almost nothing.
The bottom line is that a working knowledge of the basic executable structure doesn't tell you much about Perl processes and almost nothing about Perl threading.