How to assign different task to different CPUs

Hello,
I am using the Xavier NX production module with SSD.
I have some CPU-intensive tasks going (for example Image processing pipeline and video streaming pipeline)
video streaming consuming all 4 CPUS to nearly 100%
SWAP is : 0 %
memory is: 75%

My question is can I divide these tasks to each CPU separately or is there any other way to use the CPUs very efficiently so that my other processes don’t lag?
please suggest any solution for this.

thank you

Hi,

Specifically for your questions there are two options that come to my mind right now.

  1. You could play around setting the “niceness” of process for the kernel scheduler (also known as process priority). Changing this value when launching a process is a matter of using the command “nice”:
#Change niceness value when launching a process
nice --adjustment=<niceness-value> [command args]

There is a complete article about it here if you are interested in more in depth information: How to Set Linux Process Priority Using nice and renice Commands

  1. Change the affinity of a process. The affinity allows to assign a specific CPU core (or several in fact) to a process. There is a tool called taskset that allows to set the affinity of a process.

Some reference links:

You could even combine both settings (niceness and affinity). I encourage you to experiment with what suits best your application.

If possible you could also explore the idea of accelerating your application with the dedicated hardware processors (like the GPU). For example if you are using GStreamer there are these options provided already by the NVIDA BSP: https://developer.download.nvidia.com/embedded/L4T/r32_Release_v1.0/Docs/Accelerated_GStreamer_User_Guide.pdf. Can you please share more information about your use case to be able to provide more specific feedback?

Hope this info helps.

Jafet Chaves,
Embedded SW Engineer at RidgeRun
Contact us: support@ridgerun.com
Developers wiki: https://developer.ridgerun.com/
Website: www.ridgerun.com

1 Like

If your video streaming involves encoder such as H264,H265 or VP9, then you may try using HW encoder that will improve performance while saving CPU load. You can easily use it with gstreamer, otherwise code it against Nvbuf_utils API.
Also, boost clocks with sudo jetson_clocks

You may also see: Allow only one proccess to run on specific core - #6 by Honey_Patouceul and consider using isolcpus for further control.

3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.