/mobile Handheld Friendly website

 performance measurements

Each table row shows performance measurements for this Perl program with a particular command-line input value N.

 N  CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
500,000Timed Out  353   

Read the ↓ make, command line, and program output logs to see how this program was run.

Read thread-ring benchmark to see what this program should do.

 notes

This is perl 5, version 18, subversion 0 (v5.18.0) built for i686-linux-thread-multi

Compile-time options: HAS_TIMES MULTIPLICITY PERLIO_LAYERS
                        PERL_DONT_CREATE_GVSV
                        PERL_HASH_FUNC_ONE_AT_A_TIME_HARD
                        PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP
                        PERL_PRESERVE_IVUV PERL_SAWAMPERSAND USE_ITHREADS
                        USE_LARGE_FILES USE_LOCALE USE_LOCALE_COLLATE
                        USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_PERLIO
                        USE_PERL_ATOF USE_REENTRANT_API

For this to work on 32bit we have to set ulimit -s 100

 thread-ring Perl program source code

# The Computer Language Benchmarks Game

# http://benchmarksgame.alioth.debian.org/


#  contributed by Richard Cottrill



use strict;
use warnings;
use threads;
use threads::shared;
use Thread::Semaphore;

my $numThreads	:shared;
my $data	:shared;
my $result	:shared;
my @mutex	:shared;

$numThreads = 503;

sub thr_func {
  my ($nextThread, $thr_name);
  $thr_name = threads->tid();
  threads->detach();
  if ($thr_name == $numThreads) {
    $nextThread = 1;
  }
  else {
    $nextThread = $thr_name + 1;
  }
  while (1) {
    $mutex[$thr_name]->down();
    if ($data) {
      $data = --$data;
      $mutex[$nextThread]->up();
    }
    else {
      $result = $thr_name;
      $mutex[0]->up();
    }
  } 
}

$data = $ARGV[0];

$mutex[0] = new Thread::Semaphore(0);
{
  for (1 .. $numThreads) {
    $mutex[$_] = new Thread::Semaphore(0);
    threads->create(\&thr_func);
  }
}
$mutex[1]->up();
$mutex[0]->down();
print "$result\n";
exit(0);

 make, command-line, and program output logs

Wed, 22 May 2013 11:43:02 GMT

COMMAND LINE:
/usr/local/src/perl-5.18.0/bin/perl threadring.perl 500000

TIMED OUT after 3600s


PROGRAM OUTPUT:

Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.
Thread creation failed: pthread_create returned 11 at threadring.perl line 49.

Revised BSD license

  Home   Conclusions   License   Play