How to reduce CPU usage while mining

Is there anyway to restrict mining to few cores instead of taking up the entire CPU? Its always at 100%. Any help would be appreciated

Command line options for either mining software:

Xmrig: --threads 2
Dero Miner- --mining-threads=2

Both mining software has configurable threads to utilize when mining. If you are using config file for xmrig, there is cpu threads like [0, 1, 2, 3, 4] potentially, which you can modify to be [0, 2] . And dero-miner is just the above param --mining-threads=x