Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^6: threading a perl script

by vkon (Curate)
on Apr 24, 2011 at 08:45 UTC ( [id://901031]=note: print w/replies, xml ) Need Help??


in reply to Re^5: threading a perl script
in thread threading a perl script

on windows fork is emulated via standard perl threads (ithreads), and threads.pm module use this same engine, which is heavyweight and non-stable

addition please notice, that I am not stating, that 'fork()' is implemented via 'threads.pm', I am stating that they both use same underlying threading engine,
with some said characteristics (heavyweight, etc)

Replies are listed 'Best First'.
Re^7: threading a perl script
by BrowserUk (Patriarch) on Apr 24, 2011 at 11:44 UTC
    threads.pm module use this same engine, which is heavyweight and non-stable.

    Your misunderstanding is manifest.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
      how so?
      Enlighten me in couple of words, please :)

      this is on linux:

      vad@p100 ~ $ perl -Mthreads -we 1 This Perl not built to support threads Compilation failed in require. BEGIN failed--compilation aborted. vad@p100 ~ $ perl -V Summary of my perl5 (revision 5 version 13 subversion 11) configuratio +n: Snapshot of: c0331f4216be1694777ceb04d36e300210e71ef9 Platform: osname=linux, osvers=2.6.28-tuxonice-r11, archname=i686-linux uname='linux p100 2.6.28-tuxonice-r11 #20 preempt sun feb 14 14:58 +:37 moscow 2010 i686 amd athlon(tm) 64 processor 3000+ authenticamd g +nulinux ' config_args='-de -Dusedevel -Dusemymalloc -Uusethreads -Dprefix=/o +pt/perl-5.13.11-357-d -DDEBUGGING' hint=recommended, useposix=true, d_sigaction=define useithreads=undef, usemultiplicity=undef useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=und +ef use64bitint=undef, use64bitall=undef, uselongdouble=undef usemymalloc=y, bincompat5005=undef Compiler: cc='cc', ccflags ='-DDEBUGGING -fno-strict-aliasing -pipe -fstack- +protector -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-O2 -g', cppflags='-DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector +' ccversion='', gccversion='4.5.2', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=1 +2 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', + lseeksize=8 alignbytes=4, prototype=define Linker and Libraries: ld='cc', ldflags =' -fstack-protector' libpth=/lib /usr/lib libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc libc=/lib/libc-2.11.so, so=so, useshrplib=false, libperl=libperl.a gnulibc_version='2.11' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E' cccdlflags='-fPIC', lddlflags='-shared -O2 -g -fstack-protector' Characteristics of this binary (from libperl): Compile-time options: DEBUGGING MYMALLOC PERL_DONT_CREATE_GVSV PERL_MALLOC_WRAP PERL_PRESERVE_IVUV PERL_USE_D +EVEL USE_LARGE_FILES USE_PERLIO USE_PERL_ATOF Built under linux Compiled at Apr 1 2011 21:33:38 %ENV: PERL5LIB="/Personal/perlutl:/Work/PerlScripts/utl:/Work/PerlScript +s/sgml:/Work/PerlScripts/translations:/Work/PerlScripts/pleps" PERL6LIB="/Personal/p6utl:/Work/PerlScripts/p6" PERLSCRIPTS="/Work/PerlScripts" @INC: /Personal/perlutl /Work/PerlScripts/utl /Work/PerlScripts/sgml /Work/PerlScripts/translations /Work/PerlScripts/pleps /opt/perl-5.13.11-357-d/lib/site_perl/5.13.11/i686-linux /opt/perl-5.13.11-357-d/lib/site_perl/5.13.11 /opt/perl-5.13.11-357-d/lib/5.13.11/i686-linux /opt/perl-5.13.11-357-d/lib/5.13.11 .
      an excerpt from win32/Makefile:
      # # Beginnings of interpreter cloning/threads; now reasonably complete. # This should be enabled to get the fork() emulation. This needs # USE_MULTI as well. # USE_ITHREADS = define
      so I come to conclusion that fork emulation on windows use this 'ithreads' engine.

      given said all that, how that manifests my misunderstanding? :)

      TIA,
      Vadim

        Whilst the mechanisms are similar, the devil is in the detail.

        To see the differences, contrast win32\perlhost.h(1830)PerlProcFork(struct IPerlProc* piPerl) and threads.xs ithread_create(...)


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://901031]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2024-04-25 19:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found