Cannot avoid context-switches on a process launched alone on a CPU

后端 未结 3 940
南旧
南旧 2021-01-12 04:28

I am investigating how run a process on a dedicated CPU in order to avoid context-switches. On my Ubuntu, I isolated two CPUs using the kernel parameters \"isolcpus=3,7\" an

3条回答
  •  忘掉有多难
    2021-01-12 05:16

    Potentially any syscall could involve context a switch. When you access paged out memory it may increase context switch count too. To reach 0 context switches you would need to force kernel to keep all the memory your program uses mapped to its address space, and you would need to be sure that none of syscalls you invoke entails a context switch. I believe it may be possible on kernels with RT patches, but probably hard to achieve on standard distro kernel.

提交回复
热议问题