Search code examples
perlprocessmulticoreparallel-processing

Assigning Process to Cores using Perl


How can I assign processes to specific cores ?. I have a 16 core machine and need to assign processes to multiple cores rather then all/few of them running on same cores.

Can Parallel::ForkManager do this ?. or How do you do it with using standard perl distribution ?

Any pointers are appreciated.

Thanks


Solution

  • Under Windows, you can use Win32::Process, it has a subroutine called SetProcessAffinityMask, which should do what you want.

    Under Linux, take a look at Sys::CpuAffinity.