Max threads

How calculate max threads and cores for a machine?