Always use 1 CPU in Tx2

I am new users for Tx2. When I run the Tx2 , I found that always use 1 CPU. core. No matter how many program I run or how many thread I run in my code…
PS: My code is using the python to get the IP cameras …

Can someone provide the suggestion… Tks

Be sure to have all the cores up

sudo nvpmodel -m0

Also, beware that cache is involved. Whenever multiple threads are reading and writing to the same memory there is a performance loss if the threads must copy the data back and forth between cores…the cache is a miss instead of a hit in cases where the cache is separated on two different cores. On the other hand, if the threads do a lot of work and only talk to the same memory region when they join or on occasion, then it might be better on multiple cores. The scheduler has some idea of keeping threads on one core for cache hits, and thus won’t automatically put them on different cores. The scheduler will tend to try to avoid cache misses.

You can use affinity to set which core in most cases (exceptions occur if hardware I/O is required and the hardware doesn’t have access from all cores, but purely software processes/threads can go to any core). There are a number of ways to do this, but you might start with:

man pthread_attr_setaffinity_np
man sched_setaffinity

Within the kernel source there is a “Documentation/” sub-directory, and there is a nice intro to affinity in the doc “IRQ-affinity.txt”.

I’m not sure how Python would do this, but it would definitely have some equivalent to the C way.

thanks for your reply. I will test it …