Questions tagged [setthreadaffinitymask]

23 questions
0
votes
1 answer

How to set affinity on multiple cpus by sched_setaffinity

I want to set affinity on multiple CPUs by sched_affinity as follows. void pin(pid_t t, int cpu) { cpu_set_t cpuset; CPU_ZERO(&cpuset); CPU_SET(cpu, &cpuset); sched_setaffinity(t, sizeof(cpu_set_t), &cpuset); } My environment is 32 cores,…
rosetta-jpn
  • 13
  • 1
  • 5
0
votes
1 answer

MacOSX: Scheduler affinity seems not to work

I tried to follow the suggestions in this blog, and it seems that, even if I'm setting the CPU Set to only one core of my MacOS, more of one thread is involved per time. Is it possible to make the thread run only in one processor on such Operative…
jackb
  • 695
  • 8
  • 26
0
votes
1 answer

SetThreadAffinityMask() seems doesn't work if the thread function contain "printf()"

I have written a test program to bind a thread on a CPU.Here is my test code: #include #include #include DWORD WINAPI ThreadFunc(LPVOID pM) { while(1) { printf("Doesn't work anymore"); //If i add this…
sj_lxd
  • 1
  • 1
0
votes
2 answers

Windows Affinity

When setting the Windows CPU affinity mask for Core 2, is the mask supposed to be 0x0010 or 0x0001? I have seen an example where the mask was set to 0x0010 for Core 0 but this didn't make much sense?
user3811839
  • 141
  • 7
0
votes
1 answer

SetThreadAffinityMask has no effect

I want a test program only run on cpu1 ,so i write the code like that #include #include int main(){ ::SetThreadAffinityMask(::GetCurrentProcess(),1); while(1) ; return 0; } but when…
Ryan_Liu
  • 269
  • 4
  • 9
0
votes
2 answers

How to get windows thread to work with two functions at the same time?

The question is simple but the solution eludes me. I want to get two functions to be called and have them run at the same time (in separate threads), but I can only get void function1() called and void function2() runs only afterwards not during. I…
pandoragami
  • 5,387
  • 15
  • 68
  • 116
0
votes
1 answer

limit the number of cores used by MySQL

On Linux, can you ensure that MySQL leaves one core free? (We have a small Python server that can become unresponsive when MySQL running on the same box is under load.)
Will
  • 73,905
  • 40
  • 169
  • 246
-1
votes
1 answer

Why is SetThreadAffinityMask ignored?

Why is SetThreadAffinityMask ignored? I'm trying to write a program that sets the Affinity of each process thread according to the value of IdealProcessor. But SetThreadAffinityMask is ignored. using System; using System.Collections.Generic; using…
Aspector
  • 7
  • 2
1
2