Are processes bound to cores?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












1















Let's say I have a CPU with lots of cores. Is a given process, once started, bound to one of the cores?



Does that mean that a process can become sluggish even if there are several unused cores? For example, core0 is being used by process A and B, process A is using 100% of the core, and process B can not run, even though core1 is completely free.



Is this correct?










share|improve this question


























    1















    Let's say I have a CPU with lots of cores. Is a given process, once started, bound to one of the cores?



    Does that mean that a process can become sluggish even if there are several unused cores? For example, core0 is being used by process A and B, process A is using 100% of the core, and process B can not run, even though core1 is completely free.



    Is this correct?










    share|improve this question
























      1












      1








      1








      Let's say I have a CPU with lots of cores. Is a given process, once started, bound to one of the cores?



      Does that mean that a process can become sluggish even if there are several unused cores? For example, core0 is being used by process A and B, process A is using 100% of the core, and process B can not run, even though core1 is completely free.



      Is this correct?










      share|improve this question














      Let's say I have a CPU with lots of cores. Is a given process, once started, bound to one of the cores?



      Does that mean that a process can become sluggish even if there are several unused cores? For example, core0 is being used by process A and B, process A is using 100% of the core, and process B can not run, even though core1 is completely free.



      Is this correct?







      linux process






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 15 at 9:49









      volingasvolingas

      82




      82




















          1 Answer
          1






          active

          oldest

          votes


















          3














          Processes are not intrinsically bound to cores. Each time a process is scheduled for execution it may be executed by any core in its affinity list. If the affinity list has not been set explicitly, a process can be run on any core.



          You can check or set the affinity set for a process with the taskset command (see man taskset for its documentation). In particular, it writes that,




          The Linux scheduler will honour the given CPU affinity and the process will not run on any other CPUs. Note that the Linux scheduler also supports natural CPU affinity: the scheduler attempts to keep processes on the same CPU as long as practical for performance reasons. Therefore, forcing a specific CPU affinity is useful only in certain applications.




          Example



          sleep 1000 & slpid=$!
          echo "PID of sleep is $slpid" # 5221

          taskset --pid $slpid
          pid 5221's current affinity mask: 3 # bitmask

          taskset --cpu-list --pid $slpid
          pid 5221's current affinity list: 0,1 # list of potential cores

          taskset --cpu-list --pid 0 $slpid
          pid 5221's current affinity list: 0,1
          pid 5221's new affinity list: 0 # bound now only to core 0

          kill $slpid # all done, tidy up





          share|improve this answer

























          • Does it mean that processes can start in any core, or that they can run in any core? Said otherwise: can a process start in core0, run for a while there, and continue running in core1?

            – volingas
            Jan 15 at 10:03











          • Thanks, it is clear now. So normally I would see a process jumping around cores, according to core availability, specially in a system when one or several cores are experiencing high load, right? Is the default policy to allow a process to run in any core, if tasksetis not used?

            – volingas
            Jan 15 at 10:14











          • The default policy is any core, yes. (I can't quickly find documentation to that effect but it's implied in the man page.)

            – roaima
            Jan 15 at 10:20











          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f494566%2fare-processes-bound-to-cores%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          3














          Processes are not intrinsically bound to cores. Each time a process is scheduled for execution it may be executed by any core in its affinity list. If the affinity list has not been set explicitly, a process can be run on any core.



          You can check or set the affinity set for a process with the taskset command (see man taskset for its documentation). In particular, it writes that,




          The Linux scheduler will honour the given CPU affinity and the process will not run on any other CPUs. Note that the Linux scheduler also supports natural CPU affinity: the scheduler attempts to keep processes on the same CPU as long as practical for performance reasons. Therefore, forcing a specific CPU affinity is useful only in certain applications.




          Example



          sleep 1000 & slpid=$!
          echo "PID of sleep is $slpid" # 5221

          taskset --pid $slpid
          pid 5221's current affinity mask: 3 # bitmask

          taskset --cpu-list --pid $slpid
          pid 5221's current affinity list: 0,1 # list of potential cores

          taskset --cpu-list --pid 0 $slpid
          pid 5221's current affinity list: 0,1
          pid 5221's new affinity list: 0 # bound now only to core 0

          kill $slpid # all done, tidy up





          share|improve this answer

























          • Does it mean that processes can start in any core, or that they can run in any core? Said otherwise: can a process start in core0, run for a while there, and continue running in core1?

            – volingas
            Jan 15 at 10:03











          • Thanks, it is clear now. So normally I would see a process jumping around cores, according to core availability, specially in a system when one or several cores are experiencing high load, right? Is the default policy to allow a process to run in any core, if tasksetis not used?

            – volingas
            Jan 15 at 10:14











          • The default policy is any core, yes. (I can't quickly find documentation to that effect but it's implied in the man page.)

            – roaima
            Jan 15 at 10:20
















          3














          Processes are not intrinsically bound to cores. Each time a process is scheduled for execution it may be executed by any core in its affinity list. If the affinity list has not been set explicitly, a process can be run on any core.



          You can check or set the affinity set for a process with the taskset command (see man taskset for its documentation). In particular, it writes that,




          The Linux scheduler will honour the given CPU affinity and the process will not run on any other CPUs. Note that the Linux scheduler also supports natural CPU affinity: the scheduler attempts to keep processes on the same CPU as long as practical for performance reasons. Therefore, forcing a specific CPU affinity is useful only in certain applications.




          Example



          sleep 1000 & slpid=$!
          echo "PID of sleep is $slpid" # 5221

          taskset --pid $slpid
          pid 5221's current affinity mask: 3 # bitmask

          taskset --cpu-list --pid $slpid
          pid 5221's current affinity list: 0,1 # list of potential cores

          taskset --cpu-list --pid 0 $slpid
          pid 5221's current affinity list: 0,1
          pid 5221's new affinity list: 0 # bound now only to core 0

          kill $slpid # all done, tidy up





          share|improve this answer

























          • Does it mean that processes can start in any core, or that they can run in any core? Said otherwise: can a process start in core0, run for a while there, and continue running in core1?

            – volingas
            Jan 15 at 10:03











          • Thanks, it is clear now. So normally I would see a process jumping around cores, according to core availability, specially in a system when one or several cores are experiencing high load, right? Is the default policy to allow a process to run in any core, if tasksetis not used?

            – volingas
            Jan 15 at 10:14











          • The default policy is any core, yes. (I can't quickly find documentation to that effect but it's implied in the man page.)

            – roaima
            Jan 15 at 10:20














          3












          3








          3







          Processes are not intrinsically bound to cores. Each time a process is scheduled for execution it may be executed by any core in its affinity list. If the affinity list has not been set explicitly, a process can be run on any core.



          You can check or set the affinity set for a process with the taskset command (see man taskset for its documentation). In particular, it writes that,




          The Linux scheduler will honour the given CPU affinity and the process will not run on any other CPUs. Note that the Linux scheduler also supports natural CPU affinity: the scheduler attempts to keep processes on the same CPU as long as practical for performance reasons. Therefore, forcing a specific CPU affinity is useful only in certain applications.




          Example



          sleep 1000 & slpid=$!
          echo "PID of sleep is $slpid" # 5221

          taskset --pid $slpid
          pid 5221's current affinity mask: 3 # bitmask

          taskset --cpu-list --pid $slpid
          pid 5221's current affinity list: 0,1 # list of potential cores

          taskset --cpu-list --pid 0 $slpid
          pid 5221's current affinity list: 0,1
          pid 5221's new affinity list: 0 # bound now only to core 0

          kill $slpid # all done, tidy up





          share|improve this answer















          Processes are not intrinsically bound to cores. Each time a process is scheduled for execution it may be executed by any core in its affinity list. If the affinity list has not been set explicitly, a process can be run on any core.



          You can check or set the affinity set for a process with the taskset command (see man taskset for its documentation). In particular, it writes that,




          The Linux scheduler will honour the given CPU affinity and the process will not run on any other CPUs. Note that the Linux scheduler also supports natural CPU affinity: the scheduler attempts to keep processes on the same CPU as long as practical for performance reasons. Therefore, forcing a specific CPU affinity is useful only in certain applications.




          Example



          sleep 1000 & slpid=$!
          echo "PID of sleep is $slpid" # 5221

          taskset --pid $slpid
          pid 5221's current affinity mask: 3 # bitmask

          taskset --cpu-list --pid $slpid
          pid 5221's current affinity list: 0,1 # list of potential cores

          taskset --cpu-list --pid 0 $slpid
          pid 5221's current affinity list: 0,1
          pid 5221's new affinity list: 0 # bound now only to core 0

          kill $slpid # all done, tidy up






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Jan 15 at 10:20

























          answered Jan 15 at 9:59









          roaimaroaima

          44.2k555119




          44.2k555119












          • Does it mean that processes can start in any core, or that they can run in any core? Said otherwise: can a process start in core0, run for a while there, and continue running in core1?

            – volingas
            Jan 15 at 10:03











          • Thanks, it is clear now. So normally I would see a process jumping around cores, according to core availability, specially in a system when one or several cores are experiencing high load, right? Is the default policy to allow a process to run in any core, if tasksetis not used?

            – volingas
            Jan 15 at 10:14











          • The default policy is any core, yes. (I can't quickly find documentation to that effect but it's implied in the man page.)

            – roaima
            Jan 15 at 10:20


















          • Does it mean that processes can start in any core, or that they can run in any core? Said otherwise: can a process start in core0, run for a while there, and continue running in core1?

            – volingas
            Jan 15 at 10:03











          • Thanks, it is clear now. So normally I would see a process jumping around cores, according to core availability, specially in a system when one or several cores are experiencing high load, right? Is the default policy to allow a process to run in any core, if tasksetis not used?

            – volingas
            Jan 15 at 10:14











          • The default policy is any core, yes. (I can't quickly find documentation to that effect but it's implied in the man page.)

            – roaima
            Jan 15 at 10:20

















          Does it mean that processes can start in any core, or that they can run in any core? Said otherwise: can a process start in core0, run for a while there, and continue running in core1?

          – volingas
          Jan 15 at 10:03





          Does it mean that processes can start in any core, or that they can run in any core? Said otherwise: can a process start in core0, run for a while there, and continue running in core1?

          – volingas
          Jan 15 at 10:03













          Thanks, it is clear now. So normally I would see a process jumping around cores, according to core availability, specially in a system when one or several cores are experiencing high load, right? Is the default policy to allow a process to run in any core, if tasksetis not used?

          – volingas
          Jan 15 at 10:14





          Thanks, it is clear now. So normally I would see a process jumping around cores, according to core availability, specially in a system when one or several cores are experiencing high load, right? Is the default policy to allow a process to run in any core, if tasksetis not used?

          – volingas
          Jan 15 at 10:14













          The default policy is any core, yes. (I can't quickly find documentation to that effect but it's implied in the man page.)

          – roaima
          Jan 15 at 10:20






          The default policy is any core, yes. (I can't quickly find documentation to that effect but it's implied in the man page.)

          – roaima
          Jan 15 at 10:20


















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Unix & Linux Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f494566%2fare-processes-bound-to-cores%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown






          Popular posts from this blog

          How to check contact read email or not when send email to Individual?

          Displaying single band from multi-band raster using QGIS

          How many registers does an x86_64 CPU actually have?