Interesting, thank you Almut.
If you have time & inclination, I've one final line of enquiry:
use strict; use warnings; use threads; my $str = 'x' x 32_000_000; sub fork_wait { my $pid = fork; if ($pid) { wait; } else { substr( $str, $_, 1 ) &= ~ ' ' for 0 .. length( $str ) -1; exit 0; } } sub create_thread_join { threads->create( sub { substr( $str, $_, 1 ) &= ~ ' ' for 0 .. length( $str ) -1; } )->join; } use Benchmark qw( cmpthese ); cmpthese - 3, { Forks => \&fork_wait, Threads => \&create_thread_join, };
In reply to Re^7: while reading a file, transfer the same data to two different processes.
by BrowserUk
in thread while reading a file, transfer the same data to two different processes.
by avanta
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |