linux - Can I programmatically pick and choose which core of a multi-core CPU my thread should run on? -


Or is it controlled by the operating system? I have heard that there is inherent features to go for that granular for a programmer in new go language from Google or have I misunderstood it?

For Linux OS, shade_set affinity is your answer, this is Linux kernel 2.5. Supported since 8th.

Name

schedule_setaffinity, set_getaffinity - set and get a CPU affinity mask of a process

  #define _GNU_SOURCE # Include & lt; Schedule.h & gt; Int shade_sestifinity (pd_t pid, size_t cpuset, cpu_set_t * mask); Int shade-gatefinity (pd_t pid, size_t cpuset, cpu_set_t * mask);  

Affinity mask is actually a per-thread feature that can be adjusted independently in a thread group for each thread, given to Getitid (2) received from the call Argument can be given in logic. Specifying PID as 0 will set the attribute for the calling thread, and set the attribute for the main thread of the thread group to return the value returned by getpid (2) to the call Will. (If you are using the posix threads API, use pdf_setaffinity_np (3) instead of set_setaffinity ()).


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -