[USRP-users] C++ thread Priority.
Marcus D. Leech
patchvonbraun at gmail.com
Wed Jul 22 13:12:05 EDT 2020
On 07/22/2020 12:56 PM, David Carsenat via USRP-users wrote:
> Hello, I have made a c++ code which sends samples in the main function
> and receives samples in a thread launched in this main function.
> I have read that we can set the real time priority with the
> set_thread_priority function.
> I have tried to call this function (with parameters (1,true) inside
> the main function but it doesn't seem to change the priority of the
> executable. When I launch another application, I have lots of U and O.
> Do you have an idea how to achieve what I want ? i.e. allocate almost
> all computer resources to my uhd program ? What is the best way ?
> I have already tuned my ubuntu with advice given on Ettus site.(
> cpu-freq set etc...)
> Many thanks
In general, applications have only very-rough control over the behavior
of the scheduler. This is true in most general-purpose operating system
environments, whether it's Windows, Linux, *BSD, MacOS, etc.
If you've played with priorities, and starting up other programs causes
OU to happen, you should probably consider:
(A) Optimizing your code -- find out where the hot-spots are, and see if
they can be improved
(B) Choosing a faster CPU
The CPU usage of a DSP flow is roughly proportional to:
inherent-per-sample-complexity X sample-rate
Can you lower the sample rate and still achieve what you need to
achieve? Can you improve the main-path per-sample complexity?
More information about the USRP-users