Isolcpus and Taskset help (LED Matrix)!

New Member
Hey all! I'm trying to run a 128x32 LED matrix display ticker with the Raspberry Pi 3 A+. Currently I have two python3 processes that run the display, the first being the process that actually drives the pixels. The second process being an API caller that basically only pulls in data from the internet to be displayed. I'm using the Raspbian Lite OS (Non GUI), the Hzeller RGB RPI Matrix library, and the Adafruit RGB Matrix bonnet.

With that said, I noticed that the 2nd Python process (API caller) causes flickering in the display, and I'm pretty sure this is because both Python processes are being used by the same CPUs as part of the kernel scheduler algorithms , and it is known that little disruptions to the process that drives the LED matrix could cause flickering, and the API caller is definitely a disruption.

So I looked into the web, specifically Hzeller's RGB Matrix library, and he suggested to use isolcpus=3. I tried that in the boot cmd.txt but that didn't seem to do much? After looking at htop, it seems that the 4th CPU (3) is still being used and not completely isolated? Is this because I haven't done taskset to specify which process should go to the isolated CPU?

If you look at this image, this is with isolcpus=3 set in the cmd.txt in boot but haven't used taskset yet. Can someone explain to me why the 4th CPU is still being used?

Anyways, since doing isolcpus=3 didn't help with the flickering, I decided to try using taskset, to specifically assign the API caller python process to the isolated core (4th CPU). I did the following in the SSH:

sudo taskset -cp 3 494 (494 being the PID of the API caller process and 3 being the 4th CPU)

That seemed to do the trick! The flickering was completely gone! Now my concern is this.

If you look at the above image (after doing taskset on the API caller process to be only used in the 4th CPU), why is the 4th CPU pretty much always at 95% usage or above? Why are the other cores barely being used? It seems like both Python processes are now running under the 4th CPU when I've only assigned the API caller process to be used by the 4th CPU? Also why did the CPU% of the Python API caller process decrease significantly from the average of 70-80% (if you look at the first image) to now around 20-25% usage?

Is it gonna be bad for the CPUs long term if the 4th CPU (3) is pretty much always gonna be operating at full capacity while the other cores are at very low usage?

So I checked the affinity list of the API caller process and the LED driving process and they both seem to be correct. (PID 495 being the Python process that drives the display and PID 494 being the Python process that calls the API)

Maybe I'm just misinterpreting things here?

What do you guys think? Sorry if some of the terminology used here were wrong, I'm no expert when it comes to hardware modifications!

Many thanks!!
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Members online