Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

assign each thread a cpu core

i have a windows service written in .net 4 which doing jobs periodically using Threads. the server has more than 20 cpu core.

i create 10 threads in my windows service. is it possible to assign each thread a cpu core?

like image 291
ehsan Avatar asked Mar 21 '12 06:03

ehsan


1 Answers

The OS already does precisely that for you. It doesn't guarantee that each thread will stay on the same core forever (and in nearly all cases, there's no need for that either), but it does try to keep as many cores busy as possible. Which means giving all available threads their own core as much as possible.

like image 81
jalf Avatar answered Oct 13 '22 17:10

jalf