Hello,
Following is the code I am running to retrieve current processor affinity, and
reduce the number of cpus by one. The call to the GetProcessAffinityMask()
method is successful. I get a memory reference error when calling the
SetProcessAffinityMask() method.
Win32::Process::Open($hprocess,$$,1); #open process for current processid
$hprocess->GetProcessAffinityMask($processaffinitymask,$systemaffinitymask);
if (($processaffinitymask > 1) && ($processaffinitymask % 2 == 1)) {
#remove cpu0 from affinity mask
$processaffinitymask--;
$hprocess->SetProcessAffinityMask($processaffinitymask);
}
Thanks,
Ray
-----Original Message-----
From: Sisyphus [mailto:[EMAIL PROTECTED]
Sent: Thursday, January 19, 2006 8:37 PM
To: Ray Albert; [email protected]
Subject: Re: Windows2000 Process Affinity
----- Original Message -----
From: "Ray Albert" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Friday, January 20, 2006 2:37 AM
Subject: Windows2000 Process Affinity
> Has anyone successfully used the GetProcessAffinitymask and
SetProcessAffinitymask methods within Win32::Process?
>
> I have been unable to successfully implement them and was hoping someone
might have sample code they could provide.
>
> I am trying to limit Perl to running on all CPUs but one on a Windows2000
multi-processor server due to Perl consuming all available CPU on each
processor that it executes. This will allow Perl to execute without
consuming 100% CPU on the server.
>
I haven't tried these out .... but I think they should work ok.
A (minimal) sample script that demonstrates the problem might help - along
with error messages that you're getting. If GetProcessAffinitymask and/or
SetProcessAffinitymask are failing (ie returning zero) then check the
contents of $^E for Windows error messages.
Cheers,
Rob
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs