Anything related to processor affinity, also known as CPU pinning. The processor affinity is a propriety of a process or a thread in an OS on multi-processor or multi-core systems that influences the OS' scheduling algorithm, binding the execution of that process (or thread) to a specific processor (or core). DO NOT use this tag as a synonym for [affinetransform] tag.
Questions tagged [affinity]
330 questions
10
votes
3 answers
how to set CPU affinity of a program?
I have a program written in C#, I am using VSTS 2008 + .Net 3.5 + Windows Vista Enterprise x86 to develop a Windows Forms application.
My current computer is dual-core CPU, I want to set CPU affinity of my program to run on a specific CPU and free…

George2
- 44,761
- 110
- 317
- 455
9
votes
2 answers
setting cpu affinity for linux kernel, not process
I am having a hard time finding information about how to set cpu affinity for linux kernel (with all of its loaded modules), NOT for a specific process.
This is because I want the kernel to run on CPU 0 all the time to handle I/O stuff, and not do…

Nulik
- 6,748
- 10
- 60
- 129
8
votes
4 answers
Why would one CPU core run slower than the others?
I was benchmarking a large scientific application, and found it would sometimes run 10% slower given the same inputs. After much searching, I found the the slowdown only occurred when it was running on core #2 of my quad core CPU (specifically, an…

Edi H
- 783
- 6
- 8
8
votes
3 answers
How to set processor affinity from Batch File for Windows XP?
I've got a dual processor machine and I would like to launch an executable via a batch file on both processors.
For example:
(1) Launch Notepad.exe on Processor 1, and
(2) Simultaneously, Notepad.exe on Processor 2
Currently, I'm using the…

JustADude
- 2,619
- 7
- 31
- 45
8
votes
2 answers
What could cause my program to not use all cores after a while?
I have written a program that captures and displays video from three video cards. For every frame I spawn a thread that compresses the frame to Jpeg and then puts it in queue for writing to disk. I also have other threads that read from these files…

Nioreh
- 253
- 3
- 14
8
votes
3 answers
How to start a thread on a specific core?
I have a quad core CPU, and lets say I always want to start a Thread on the second core.
Is that possible in C#?

Rosmarine Popcorn
- 10,761
- 11
- 59
- 89
8
votes
2 answers
Is sched_getcpu() reliable on Linux?
I'm trying to debug some performance issues with pthreads on Linux and I think sched_getcpu() may be lying to me. It reports a constant CPU for each thread, whereas profiling experiments seem to suggest the threads are actually migrating from one…

Paul R
- 208,748
- 37
- 389
- 560
8
votes
1 answer
OpenMP: splitting loop based on NUMA
I am running the following loop using, say, 8 OpenMP threads:
float* data;
int n;
#pragma omp parallel for schedule(dynamic, 1) default(none) shared(data, n)
for ( int i = 0; i < n; ++i )
{
DO SOMETHING WITH data[i]
}
Due to NUMA, I'd like to…

user2052436
- 4,321
- 1
- 25
- 46
8
votes
2 answers
Obtaining thread Core affinity in C++ 11 through pthreads
I'm trying to set core affinity (Thread #1 goes on first core, Thread #2 goes on second core, ...) while using std::thread in C++ 11.
I've already searched around various topics and on the internet and it seems C++ 11 API doesn't provide such low…

Cob013
- 1,057
- 9
- 22
8
votes
1 answer
Pin processor CPU Isolation on Windows
In linux where I work mostly, we use a technique called CPU isolation, that effectively locks a process on to a processor and also prevents the processor from running anything else. Our kernel guys did some magic to handle the interrupts.
In…

user805547
- 1,245
- 1
- 15
- 23
7
votes
3 answers
Set processor affinity for MATLAB engine (Windows 7)
I'm developing an application in c++. One of the components of the application uses Matlab (via the Matlab engine) for data processing. At the same time, a data acquisition system is streaming data to disk. Occasionally, during periods of intensive…

tmpearce
- 12,523
- 4
- 42
- 60
7
votes
0 answers
Using Pearson correlation in sklearn FeatureAgglomeration
I have a pandas dataframe with 100 rows and 10,000 features. I want to fit hierarchical clustering on my data by using pearson correlation as the affinity argument in sklearn.cluster.FeatureAgglomeration.
I've tried two ways to make it work so…

Bruce Kent
- 73
- 1
- 6
7
votes
2 answers
ixgbe: setting the number of RX/TX queues
I want to set the number of RX/TX queues used by an Intel 10G NIC. Let me explain why:
I am using an Intel 10G NIC of type X520, on a Dell R720 system. I am using ixgbe version 3.6.7-k. The kernel in Ubuntu 3.2.0-59.
I am running my network…

Ofir Hermesh
- 125
- 1
- 1
- 7
7
votes
1 answer
Disable hyperthreading vs. changing ProcessorAffinity?
I have noticed that several of my multi-threaded calculations run faster if I disable hyper-threading in the BIOS.
I have also learnt that I can programmatically disable the (logical) CPU:s by modifying the processor affinity for the current…

Anders Gustafsson
- 15,837
- 8
- 56
- 114
6
votes
1 answer
How to prevent inheriting CPU affinity by child forked process?
I have a server process that forks many child processes. The server process has affinity to a CPU core, but I don't want that affinity to be inherited by child process (rather OS should handle where to run these processes). Is there a way to delink…

user424060
- 1,545
- 3
- 20
- 29