Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Proposal how to make modules using fork more portable

by moritz (Cardinal)
on Mar 30, 2011 at 11:35 UTC ( [id://896382]=note: print w/replies, xml ) Need Help??


in reply to Proposal how to make modules using fork more portable

I'm all for better documentation, and in my experience, p5p has been very responsive to small scale doc patches.

So I'd suggest you come up with a patch and submit it. See perlhack and perlrepository for how to do it.

Replies are listed 'Best First'.
Re^2: Proposal how to make modules using fork more portable
by Anonymous Monk on Mar 31, 2011 at 08:31 UTC

    I will try to create a patch, but it will take some weeks.

    Before creating the patch, could I get some feedback?

    This is my proposal to changes:

    Added at end of “=item fork” in pod/perlfunc.pod

    On some platforms such as Windows, where the fork() system call is not available, Perl can be built to emulate fork()in the Perl interpreter. The emulation is designed to, at the level of the Perl program, be as compatible as possible with the “Unix” fork(). It has however some limitation that has to be considered, for all in code intended to be portable. See L<perlfork> for more details.

    Added at end of =item kill SIGNAL, LIST in pod/perlfunc.pod

    On some platforms such as Windows where the fork() system call is not available. Perl can be built to emulate fork() at the interpreter level. The emulation has some limitation related to kill that has to be considered, for code running on Windows and in code intended to be portable. See L<perlfork> for more details.

    Added at the end of =item kill() in pod/perlfork.pod

    There is a probability that the process which implements all the pseudo-processes is blocked.

    New section added before =head1 BUGS in pod/perlfork.pod

    =head1 PORTABLE PERL CODE

    In portable Perl code, kill(9, $child) must not be used. The forked processes must terminate themselves.

    The kill(9) protocol is “taken from Unix,” and it does not have a good parallel in the Windows world. In Windows forked processes are implemented as pseudo-processes.

    To use kill(9, $child) for pseudo-processes is unsafe and there is a probability that the process which implements all the pseudo-processes is blocked. The outcome of kill on a pseudo-process, depends on the timing in the operating system, and code that has worked, suddenly can fail, resulting in errors which are difficult to find.

      =head1 PORTABLE PERL CODE In portable Perl code, kill(9, $child) must not be used. The forked pr +ocesses must terminate themselves.

      This is wrong. The problem only exists for pseudo-processes, not for other processes.

        Is this better?

        =head1 PORTABLE PERL CODE

        In portable Perl code, kill(9, $child) must not be used on forked processes. The forked processes must terminate themselves.

      To me, the following sentence is not sufficiently clear:   “There is a probability that the process which implements all the pseudo-processes is blocked.”

      As an English sentence, the beginning clause makes a clumsy use of third-person passive voice.   (Should I be placidly ignoring an 0.01% probability, or running away for dear life from 99.9?)   The remainder of the sentence might be technically correct, but it does not convey to me what the sentence means to me.   What do I do?

      With regard to the final paragraph, well, I can’t close my eyes and readily visualize what a “pseudo-process” might be, nor does the text (as I read it on my computer now) contain a prior use of that term.   (Note that I am not, right now, reading that perlpod on a Win32 computer.)   Whether I am “familiar with Unix but not with Win32,” or vice-versa, or I am equally acquainted with both, I am not prepared by this sentence to know what I am dealing with, nor to understand both its superficial and its deeper implications.

      The same line of reasoning could also be applied to the earlier sentence ... “the emulation has some limitation related to kill.”   (Oh, my!   And what on earth might that “limitation” be, and why do you say, “some?”)   Once again, I need to understand what it means to me.   The documentation should have a clear meaning, and a definite, un-ambiguous answer for:   “so what?”

      (Note:   I am delighted to see you working on this documentation!   I mean my feedback only in the most constructive way possible.)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://896382]
help
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-03-29 14:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found