How to optimize core and threads

I dont know how to do optimize core and threads.
Will anyone know about this ?