Share CPU core

Hi,

I have 2 physical processor UltraSPARC-T2 with 32 virtual processors
I want to execute a perl program on 10 virtual processors.
I try prset command, but I don't see a difference.

psrset -c   "created processor set 2" 1 2 3 4 5 6 7 8 9 10" 
psrset -b 2 `pgrep program.pl`

Maybe I need to add kernel option in /etc/system ?

Thanks

What says

psrset -i
psrset -q

?

 
 psrset -i
user processor set 1: processors 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
 
psrset -q
process id 21811: 1

Thanks

So a processor set is properly configured although with 16 VCPUs instead of 10.

What do you mean "I don't see a difference", i.e. what difference are you expecting that you don't see ?

Hi,

When I use mpstat command, I wish to see 4 or 5 CPU virtual core used.
But only one virtual core is using.
Maybe my script don't need more CPU and I need to modify my script with threads module for example.
Because my script read one line in a source file and put it in an output file.
I can put into memory 10000 lines with a thread, and put in an output file 10000 lines

 
#!/usr/local/perl/bin/perl
use warnings;
use strict;
use threads;
sub ProcessLog{
        my $l__line = "";
        my $i = 0;
        my $core=0;
        while ( defined($l__line = <INPUT_FILE>)){
            chomp($l__line);
            $i++;
            $core=0;
            if($i==10000){
                $i=1;
            } 
            if($i==1){ 
                 $core++;
                 my $thr = threads->new(\&sub1,$l__line);
                 if($core==32){
                     $thr->join;
                 }
                 sub sub1 {
                     #print "In the thread\n";
                     my $line=$_[0];
                     #print "LINE:".$line;
                     if ($line ne ""){
                         my $val1="";
                         my $val2="";
                         my $val3="";
                         if(defined $line){
                             ($val1,$val2,$val3)=split(/ /,$line);
                         }
                         my $l__newLine = $val1.";".$val3;
                         print OUTPUT_FILE $l__newLine."\n";
                         #return($l__newLine."\n");
                     }
                 }
            }
        }
}
my $l__logInput = $ARGV[0];
my $l__logOutput = $ARGV[1];
open(INPUT_FILE, "< $l__logInput") || die "probleme d'ouverture du fichier de lecture\n";
open(OUTPUT_FILE, "> $l__logOutput") || die "probleme d'ouverture du fichier d ecriture\n";
&ProcessLog;

Thanks

Perl is probably not the best language to experiment with threads (and to experiment with anything IMHO).
Anyway, what perl version is /usr/local/perl/bin/perl ?

/usr/local/perl/bin/perl --version

Is threading support enabled ? As far as I know, it is still quite experimental.

/usr/local/perl/bin/perl -V | grep thread

I compiled perl with options -Dusethreads -Dprefix=/usr/local/perl

 
$ /usr/local/perl/bin/perl --version
 
This is perl, v5.8.8 built for sun4-solaris-thread-multi
Copyright 1987-2006, Larry Wall
 
 
$ /usr/local/perl/bin/perl -V | grep thread
    osname=solaris, osvers=2.10, archname=sun4-solaris-thread-multi
    config_args='-ds -e -Dprefix=/usr/local/perl -Dusethreads'
    usethreads=define use5005threads=undef useithreads=define usemultiplicity=define
    libs=-lsocket -lnsl -ldl -lm -lpthread -lc
    perllibs=-lsocket -lnsl -ldl -lm -lpthread -lc
    /usr/local/perl/lib/5.8.8/sun4-solaris-thread-multi
    /usr/local/perl/lib/site_perl/5.8.8/sun4-solaris-thread-multi
prcsvadm15-new:~/testdir

As I wrote I'm no perl expert but perhaps is your thread code too lightweight to show up in the stats. You should use something more compute intensive to have more than one CPU busy with your code.

I resolved my problem.
I used an other server with many physical core and it's works perfecty.
Thanks.