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

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.

Replies are listed 'Best First'.
Re^8: threading a perl script
by vkon (Curate) on Apr 24, 2011 at 16:36 UTC
    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.
        in threads.xs I see
        thread->interp = perl_clone(aTHX, CLONEf_KEEP_PTR_TABLE | CLONEf_C +LONE_HOST);
        in win32\perlhost.h(1830)PerlProcFork I see
        PerlInterpreter *new_perl = perl_clone_using((PerlInterpreter*)aTH +X, CLONEf_COPY_STACKS, h->m_pHostperlMem, h->m_pHostperlMemShared, h->m_pHostperlMemParse, h->m_pHostperlEnv, h->m_pHostperlStdIO, h->m_pHostperlLIO, h->m_pHostperlDir, h->m_pHostperlSock, h->m_pHostperlProc );
        well, instead of perl_clone there is a call to perl_clone_using. and perl_clone calls perl_clone_using.
        This does not surprise me - this is what I actually expected to see.

        So, I still fail to see why my misunderstanding is manifest.