Sample Header Ad - 728x90

Understanding CPU threads is used by a multithread application

0 votes
0 answers
105 views
Recently, I did some research on how the CPU core is used by a multi-threaded application. I can see what cores each thread is using by using the following command: For example: ceph-osd is a multi-threaded application
for i in $(pgrep ceph-osd); do ps -mo pid,tid,fname,user,psr -p $i;done
My CPU has 32 cores and 72 threads, so the ceph-osd will have 72 TID (thread ID):
PID     TID COMMAND  USER     PSR
 336157       - ceph-osd ceph       -
      -  336157 -        ceph       6
      -  336160 -        ceph      51
      -  336162 -        ceph      57
      -  336163 -        ceph      23
      -  336164 -        ceph      22
      -  336168 -        ceph       7
      -  336169 -        ceph      17
      -  336203 -        ceph       1
...
...
But what I don't understand is: - This ceph-osd process will use all the CPU cores, or if the thread is just allocated and maybe not always in use? - If I use numactl to define affinity and bind the process to specific threads, will it make any different than before? - There are more than one ceph-osd process on my server, so will it help improve performance when binding manually? Thanks in advance.
Asked by huynp (3 rep)
Nov 20, 2023, 12:55 PM