Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Win32: Starting and stopping processes (part 1)

by bojinlund (Parson)
on Oct 19, 2011 at 08:08 UTC ( #932326=note: print w/replies, xml ) Need Help??


in reply to Win32: Starting and stopping processes (part 1)

In Win32 you should avoid using kill on forked processes.

From http://perl5.git.perl.org/perl.git/blob_plain/HEAD:/pod/perlfork.pod:

perlfork - Perl's fork() emulation

...

The fork() emulation is implemented at the level of the Perl interpreter. What this means in general is that running fork() will actually clone the running interpreter and all its state, and run the cloned interpreter in a separate thread, beginning execution in the new thread just after the point where the fork() was called in the parent. We will refer to the thread that implements this child "process" as the pseudo-process.

...

=item kill()

C<kill('KILL', ...)> can be used to terminate a pseudo-process by passing it the ID returned by fork(). The outcome of kill on a pseudo-process is unpredictable and it should not be used except under dire circumstances, because the operating system may not guarantee integrity of the process resources when a running thread is terminated. The process which implements the pseudo-processes can be blocked and the Perl interpreter hangs. Note that using C<kill('KILL', ...)> on a pseudo-process() may typically cause memory leaks, because the thread that implements the pseudo-process does not get a chance to clean up its resources.

As the terminated thread runs inside the same process as the controlling thread, it is always possible that the controlling thread will get damaged by this action.

See also:

  • Comment on Re: Win32: Starting and stopping processes (part 1)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://932326]
help
Chatterbox?
[Discipulus]: i'v installed ubuntu 16.04lts and i'm quite disappointed: is deadly simmilar to new win osses where you cannot find even simple things...
[Corion]: Hi Discipulus ;)
[Corion]: Mj1234: Maybe Ubuntu didn't package Devel::GDB? In that case, consider using local::lib and install the module from CPAN
[Corion]: But a quick Google search turns up this page, which seems to suggest that it should be packaged
[Discipulus]: iirc active perl has repositories only for last 2 o 3 major release of perl Mj1234. I strongly suggest portable version of strawberry perl and use cpan client to install modules
[choroba]: Also, who needs GDB when there's hdb?
[Discipulus]: in this ubuntu i'm not able to find resource monitor, graphical mount program.. just office and amazon are exposed!

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (7)
As of 2016-12-07 08:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (125 votes). Check out past polls.