Can a core be dedicated to one user-space app (e.g. for the purpose of bit-banging GPIO without any interruptions)?
1 Answer
You could use the kernel isolcpus
option in conjunction with the taskset
command.
On the Raspberry Pi reserve the core(s) you want to use by appending the following to the line in /boot/cmdline.txt
.
E.g. to reserve cores 2 and 3.
isolcpus=2,3
Then use taskset to assign programs to the core(s).
E.g. to launch the Python interpreter.
taskset -c 3 python
(look here for information on how to use the command).
If this is Raspberry Pi specific do you need to bit bang? There may be already existing solutions.
cgroups
, I think specifically thecpuset
parameter; see e.g. here (scroll down to the "cgroups" section). Hopefully excluding everything but a specific group from a specific core is not too convoluted.