in reply to Re^4: while reading a file, transfer the same data to two different processes.
in thread while reading a file, transfer the same data to two different processes.
Thanks. If you've the inclination to indulge me a little further, what results do you get from the following?
use strict; use warnings; use threads; my $str = 'x' x 32_000_000; sub fork_wait { my $pid = fork; if ($pid) { wait; } else { my $l = length( $str ); exit 0; } } sub create_thread_join { threads->create( sub { my $l = length( $str ) } )->join; } use Benchmark qw( cmpthese ); cmpthese - 3, { Forks => \&fork_wait, Threads => \&create_thread_join, };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: while reading a file, transfer the same data to two different processes.
by almut (Canon) on May 20, 2010 at 23:57 UTC | |
by BrowserUk (Patriarch) on May 21, 2010 at 00:29 UTC | |
by almut (Canon) on May 21, 2010 at 02:02 UTC | |
by BrowserUk (Patriarch) on May 21, 2010 at 09:42 UTC | |
by almut (Canon) on May 21, 2010 at 10:11 UTC | |
by rowdog (Curate) on May 21, 2010 at 11:21 UTC | |
|