This question already has an answer here:

Is there any way to tune processor cores to use fixed number of cores in range of 1-n (n is the maximum number of available cores) on Ubuntu 16.04?

My processor is Intel i7-7500U processor with 4 logical cores.

marked as duplicate by Stephen Kitt, Andy Dalton, Rui F Ribeiro, Mr Shunz, GAD3R Apr 15 at 14:45

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.